Skip to content

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) ​

ProjectWhat it demonstrates
CPU tensors with PyTorchAdd two CPU tensors with LibTorch and check the elements and sum. Owned tensors are released at scope exit.
A database with SQLiteCreate an in-memory SQLite database, insert a bound value, and query it. Borrow the database for updates; scope exit closes it.
Compression with zlibCompress a buffer with zlib and verify the restored bytes. A fixed output limit bounds decompression.
Hashing with Rust BLAKE3Hash a buffer with the Rust BLAKE3 crate and compare a known digest.

Start here ​

ProjectWhat it demonstrates
Hello world with dependenciesPrint a greeting through an injected logger. Startup selects the providers, and export files choose what each folder makes public.
Labeled calls and injectionConstruct an object with an injected dependency, call functions with labeled inputs, and run same-file tests.
A small tested applicationA calculator logs each addition. Its nearby tests replace the logger and verify both labeled inputs and fresh setup.
Command-line argumentsRead arguments, inspect collections, and return a process exit status.

Web applications ​

ProjectWhat it demonstrates
Weather APIServe 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 applicationOne 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 ​

ProjectWhat it demonstrates
Lists, tuples, sets, and mapsCreate typed collections and update them through checked mutable access.
Generic types and functionsWrite reusable records, interfaces, classes, and functions with type parameters.
Generic dependency injectionBind a generic interface and resolve a class that uses it.
Checked failuresDeclare errors with unless, catch them, and run cleanup.

State and lifetime ​

ProjectWhat it demonstrates
Read access and mutable borrowsShare a reference for reading and grant explicit access for mutation.
Move ownershipTransfer an owned resource between labeled calls.
Resource cleanupRelease an owned resource when its lifetime ends.
Private state and helpersKeep underscore-prefixed implementation details inside their scope.

Modules and packages ​

ProjectWhat it demonstrates
Modules and compositionSupply a scoped counter and call a doubling function that rejects negative inputs.
Function and constructor middlewareLayer interceptors, map inputs, and keep logging dependencies explicit.
Create a packageExport an arithmetic function from a library and test it.
Use a packageInstall the neighboring arithmetic package and import it through a local alias.

Native applications ​

ProjectWhat it demonstrates
A native C boundaryDeclare a C operation and call it inside an unsafe block.
A finite benchmarkMeasure a deterministic arithmetic workload with aug bench.

Measured programs ​

ProjectWhat it demonstrates
A million greetingsPrint one million UTF-8 greetings and flush each line, matching the C reference.
Startup benchmarkPrint one integer and exit to measure process startup.
Floating-point benchmarkAccumulate exact binary fractions and check the final value.
Function-call benchmarkCall a labeled function repeatedly with a dependent integer result.
List traversal benchmarkGrow a list and sum its snapshot values.
String processing benchmarkSplit text into parts and sum their byte lengths.
Map deletion benchmarkDelete, replace and reinsert entries, then check values and insertion order.
Checked-error benchmarkInterleave successful calls and caught checked failures.
Record allocation benchmarkRetain immutable records and sum their fields.
Task scheduling benchmarkStart and join two tasks in each bounded scope.
CPU benchmarkTwo million dependent integer steps with a checked result.
Map and Set benchmarkInsert, find, and iterate over 20,000 collection entries.
JSON benchmarkParse, decode, and serialize a typed record 5,000 times.
HTTP benchmarkServe the typed JSON endpoint used in the throughput measurements.

Native libraries ​

ProjectWhat it demonstrates
GPU workersCreate 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.

Last updated:

The world runs on language