Example projects
Explore complete programs with code and compiled explanations side by side. Choose Indentation or Braces for the code view, follow links to dependencies, or download a project to run it. Native examples list their supported platforms.
Start with Hello world with dependencies to trace a greeting through two folder boundaries. Then review a change to the tested calculator. For a larger application, the OpenID Connect example combines pages, provider and client endpoints, and a session JWT. It is a development demonstration with documented limits.
For step-by-step lessons, start with the book.
Native libraries (LLVM preview)
| Project | What it demonstrates |
|---|---|
| CPU tensors with PyTorch | Add two CPU tensors with LibTorch and check the elements and sum. Owned tensors are released at scope exit. |
| A database with SQLite | Create an in-memory SQLite database, insert a bound value, and query it. Borrow the database for updates; scope exit closes it. |
| Compression with zlib | Compress a buffer with zlib and verify the restored bytes. A fixed output limit bounds decompression. |
| Hashing with Rust BLAKE3 | Hash a buffer with the Rust BLAKE3 crate and compare a known digest. |
Start here
| Project | What it demonstrates |
|---|---|
| Hello world with dependencies | Print a greeting through an injected logger. Startup selects the providers, and export files choose what each folder makes public. |
| Labeled calls and injection | Construct an object with an injected dependency, call functions with labeled inputs, and run same-file tests. |
| A small tested application | A calculator logs each addition. Its nearby tests replace the logger and verify both labeled inputs and fresh setup. |
| Command-line arguments | Read arguments, inspect collections, and return a process exit status. |
Web applications
| Project | What it demonstrates |
|---|---|
| Weather API | Serve five simulated forecasts as typed JSON. The record, endpoint, and tests share a file; main.aug starts the listener and main.yaml enables OpenAPI. |
| OpenID Connect login application | One executable hosts a login page, an OpenID Connect provider and client, session JWTs, and logout. Accounts, keys, and sessions are held in memory for this development demonstration. |
Values and errors
| Project | What it demonstrates |
|---|---|
| Lists, tuples, sets, and maps | Create typed collections and update them through checked mutable access. |
| Generic types and functions | Write reusable records, interfaces, classes, and functions with type parameters. |
| Generic dependency injection | Bind a generic interface and resolve a class that uses it. |
| Checked failures | Declare errors with unless, catch them, and run cleanup. |
State and lifetime
| Project | What it demonstrates |
|---|---|
| Read access and mutable borrows | Share a reference for reading and grant explicit access for mutation. |
| Move ownership | Transfer an owned resource between labeled calls. |
| Resource cleanup | Release an owned resource when its lifetime ends. |
| Private state and helpers | Keep underscore-prefixed implementation details inside their scope. |
Modules and packages
| Project | What it demonstrates |
|---|---|
| Modules and composition | Supply a scoped counter and call a doubling function that rejects negative inputs. |
| Function and constructor middleware | Layer interceptors, map inputs, and keep logging dependencies explicit. |
| Create a package | Export an arithmetic function from a library and test it. |
| Use a package | Install the neighboring arithmetic package and import it through a local alias. |
Native applications
| Project | What it demonstrates |
|---|---|
| A native C boundary | Declare a C operation and call it inside an unsafe block. |
| A finite benchmark | Measure a deterministic arithmetic workload with aug bench. |
Measured programs
| Project | What it demonstrates |
|---|---|
| A million greetings | Print one million UTF-8 greetings and flush each line, matching the C reference. |
| Startup benchmark | Print one integer and exit to measure process startup. |
| Floating-point benchmark | Accumulate exact binary fractions and check the final value. |
| Function-call benchmark | Call a labeled function repeatedly with a dependent integer result. |
| List traversal benchmark | Grow a list and sum its snapshot values. |
| String processing benchmark | Split text into parts and sum their byte lengths. |
| Map deletion benchmark | Delete, replace and reinsert entries, then check values and insertion order. |
| Checked-error benchmark | Interleave successful calls and caught checked failures. |
| Record allocation benchmark | Retain immutable records and sum their fields. |
| Task scheduling benchmark | Start and join two tasks in each bounded scope. |
| CPU benchmark | Two million dependent integer steps with a checked result. |
| Map and Set benchmark | Insert, find, and iterate over 20,000 collection entries. |
| JSON benchmark | Parse, decode, and serialize a typed record 5,000 times. |
| HTTP benchmark | Serve the typed JSON endpoint used in the throughput measurements. |
Native libraries
| Project | What it demonstrates |
|---|---|
| GPU workers | Create Metal buffers inside isolated workers, add vectors on the GPU, and return copied results. Requires the August 0.23.0 preview, Apple Silicon, and macOS 14 or later with an available Metal GPU. |