Examples
Runnable Rank programs organized by theme. Each example lives in the examples/ directory of the repository.
Use this page when you want runnable reference programs for typed configuration, provider-backed reads and writes, external inputs, manifests, and HTTP workflows.
If you want the fastest language tour, start with Hello Config, then Functions and Lifting, then Pipes and Collections, and then Env Inputs.
Language features
| Example | What it shows |
|---|---|
| Hello Config | Type aliases, literal unions, @constraint, with, pub main |
| Types and Generics | Type aliases, constrained/defaulted generics, utility types, field annotations, match exhaustiveness |
| Functions and Lifting | Named functions, object lifting, zipped list lifting, with patch |
| Pipes and Collections | map, filter, reduce, groupBy, sortBy, pipe operator ` |
Platform manifests and CI/CD
| Example | What it shows |
|---|---|
| Kubernetes App | One typed app definition emitting Deployment, Service, ConfigMap, Ingress, and HPA YAML |
| Service Catalog | One typed service list emitting service summary, CI matrix, public endpoints, Compose, and deployment metadata |
| Static Site Deploy Plan | Typed pages and redirects emitting upload metadata, redirect rules, and deploy planning artifacts |
| Docker Compose | Typed service definitions, Env inputs, dev/prod overrides, Emit::manifest(...) |
| GitHub Actions | Workflow YAML generation, lifting over a node version matrix, Emit::manifest(...) |
| GitLab CI | Pipeline YAML, reusable job templates as functions, rule-based conditions |
Data generation and multi-environment
| Example | What it shows |
|---|---|
| Test Fixtures | Faker provider, range + map to generate N records, deterministic seeds |
| Faker Dataset | Correlated Person/Location projections, all generator kinds, refDate anchoring |
| Multi-env App | Env input, base + environment-specific with overrides, multi-file modules |
| Feature Flag Matrix | Typed environment and plan combinations emitting a matrix plus per-plan flag bundles |
| Tenant Config Generator | One tenant list emitting per-tenant runtime configs and a shared tenant index |
External data sources
| Example | What it shows |
|---|---|
| Env Inputs | std::Env typed schema, field-level @sensitive, Decode<T> at the env boundary, defaults, with |
| Dotenv Config | File::Read with format: dotenv, boundary Decode<T>, typed defaults, and explicit file provenance |
| File-driven Config | File::Read YAML loading, typed schema, reshaping with stdlib |
| HTTP Fetch | HTTP::Fetch with cacheKey, typed response schema, transform to manifest |
| HTTP Plus Files Bundle | Combine a local YAML file and an HTTP fetch into one bundled JSON and YAML output |
| Secrets-Backed Config | aws::SecretsManager::Secret<T>, RANK_ENV, base + secret merge, LocalStack-backed provider flow |
| LocalStack Bootstrap | Mutation::plan, aws::DynamoDB::Put, aws::S3::Put, and LocalStack-backed resource seeding |
| DynamoDB Report | Typed DynamoDB item reads, collection reductions, and a static JSON report artifact |
| Provider Comparison | Normalize environment, file, HTTP, and S3 inputs into one shared output schema |
HTTP server
| Example | What it shows |
|---|---|
| S3 Logs | rank serve, aws::S3::Object<T>, parse string patterns, LocalStack-backed log inspection |
| Serve — Docker | rank serve, HTTP::Route, pub config, containerized deployment |
| Serve — Lambda | Lambda Web Adapter, READINESS_CHECK_PATH, same app code locally and on Lambda |