Pragmatic AI Labs

Zig From Zero

Noah Gift

Instructor: Noah Gift

Included with Coursera Plus

Gain insight into a topic and learn the fundamentals.
Beginner level

Recommended experience

5 hours to complete
Flexible schedule
Learn at your own pace
Gain insight into a topic and learn the fundamentals.
Beginner level

Recommended experience

5 hours to complete
Flexible schedule
Learn at your own pace

What you'll learn

  • Read and write Zig — including the four standard-library allocators (GPA, Arena, FixedBuffer, page_allocator) — and map each idiom back onto Rust

  • Build a tiny statically-linked Zig binary and ship it inside a multi-stage Dockerfile that produces a kilobyte-sized container image

  • Make the language choice on a real team — pick Zig for footprint, fast cold start, and C interop; stay with Rust for long-running services

Details to know

Shareable certificate

Add to your LinkedIn profile

Recently updated!

April 2026

Assessments

3 assignments

Taught in English

See how employees at top companies are mastering in-demand skills

 logos of Petrobras, TATA, Danone, Capgemini, P&G and L'Oreal

There are 7 modules in this course

The four-card framing — memory, errors, generics, cleanup — and the four companion essays that walk each card against the Rust idiom it replaces. Allocator parameters travel through every function signature instead of lifetime annotations, !T plus try replaces Result plus the question-mark operator, comptime T type replaces trait bounds plus derive plus macro_rules, and defer plus errdefer replaces impl Drop with finer-grained lexically visible cleanup.

What's included

1 video4 readings1 assignment

Install Zig 0.13, build a hello-world with zig build-exe, read the four release modes — Debug, ReleaseSafe, ReleaseFast, ReleaseSmall — against the same source file, and cross-compile to a Linux musl target with one -target flag. The week's payoff is the moment a Linux binary falls out of a macOS host with no extra toolchain — the same primitive that drives every later Lambda and edge-runtime deployment.

What's included

1 video3 readings

The optimization matrix on a 4096-by-4096 matrix multiply — Zig versus Rust versus Go on the same workload — measuring binary size, cold-start, and steady-state throughput across all four release modes. The week teaches the measurement loop that turns "is this faster?" into "by how much, on which dimension, against which baseline?" — the same loop that drives the Lambda and edge decisions in later weeks.

What's included

1 video2 readings

Build the marcopolo command-line tool from std.process.argsAlloc with a GeneralPurposeAllocator and std.testing.allocator so a leak fails the test suite, then walk all four standard-library allocators side by side — GPA for application code with debug-mode leak detection, ArenaAllocator for parse-and-discard scopes that free everything in a single deinit, FixedBufferAllocator for stack-only buffers with no heap, and page_allocator for direct mmap-backed allocations.

What's included

2 videos4 readings1 assignment

A 30-line HTTP server using std.net plus std.http, then the multi-stage Dockerfile that lands the final image at single-digit megabytes against a scratch base, then the use-case map for AWS Lambda, edge runtimes, and embedded targets where the binary footprint and cold-start budget dominate the workload's value over the borrow checker's compile-time payoff.

What's included

2 videos4 readings

Zig idioms a Rust developer trips on, when to reach for comptime versus a runtime branch, the Rust-or-Zig decision rule for a data-engineering team, the FFI patterns that let Zig call Rust and Rust call Zig over a C-ABI seam, and the path to Zig 1.0 that tells you which 0.13 features are stable to ship today versus which features need a feature-flag strategy.

What's included

1 video2 readings

A culminating practice assignment that synthesizes every framework and pattern from Weeks 1 through 6 into one shippable production Zig component. Pick a Lambda or edge target, walk the four-card framing on the workload, build the Zig handler with a logic-versus-wiring split, ship the multi-stage Dockerfile against a scratch base, and add the named-contract assertInvariant helper that fires on container start before the binary fetches its first invocation. The reference implementation that grounds every deliverable lives at https://github.com/paiml/zig-from-zero — the workspace ships five demos (hello, marcopolo, http-server, sqlite-ws, lambda) that walk every standard-library allocator and every deployment target the course covers.

What's included

3 readings1 assignment

Instructor

Noah Gift
Pragmatic AI Labs
34 Courses2,487 learners

Offered by

Why people choose Coursera for their career

Felipe M.

Learner since 2018
"To be able to take courses at my own pace and rhythm has been an amazing experience. I can learn whenever it fits my schedule and mood."

Jennifer J.

Learner since 2020
"I directly applied the concepts and skills I learned from my courses to an exciting new project at work."

Larry W.

Learner since 2021
"When I need courses on topics that my university doesn't offer, Coursera is one of the best places to go."

Chaitanya A.

"Learning isn't just about being better at your job: it's so much more than that. Coursera allows me to learn without limits."
Coursera Plus

Open new doors with Coursera Plus

Unlimited access to 10,000+ world-class courses, hands-on projects, and job-ready certificate programs - all included in your subscription

Advance your career with an online degree

Earn a degree from world-class universities - 100% online

Join over 3,400 global companies that choose Coursera for Business

Upskill your employees to excel in the digital economy

Frequently asked questions