Getting started
Clamp is not on crates.io yet, so you run it from source. Hello Clamp takes one clone and one command.
Why not cargo add? Publishing is disabled until licensing, registry ownership and the prototype API are reviewed. The package versions are 0.1.0 with publish = false.
Requirements#
- Rust 1.96.1 or newer — the tested minimum. Edition 2024, resolver 3.
- git; python3 is needed for the check and measurement tools.
- Nothing else for examples 00–05. The facade, Core and Kernel have zero third-party dependencies, so those build with
--offline. Integration examples fetch their crates (Axum, SQLx, Serde, NATS) once.
Install the Clamp command#
On Linux or macOS, install the developer command globally. The installer detects your platform, installs Rust and Linux build tools when needed, then downloads the prebuilt, checksum-verified clamp, or builds it from source when no binary fits your machine. On macOS, it opens Apple’s Command Line Tools installer if needed; finish that setup and rerun this command.
curl -fsSL https://rustclamp.com/install.sh | bash
Then open the menu with clamp, or create and run an app directly:
clamp init hello-clamp
cd hello-clamp
cargo run
For a web app with routes, a Vite+ and Tailwind 4 frontend and tests, add --web and start it with clamp dev (needs Node.js and npm):
clamp init my-site --web
cd my-site
clamp dev
The generated app fetches the small RustClamp facade from its public Git repository, so it works before crates.io publication. Clamp CLI lists every template and command. Windows users can use WSL.
1. Hello Clamp#
The facade needs no other repository:
git clone https://github.com/rustclamp/rustclamp
cd rustclamp
cargo run --offline --example 00-pico
# Hello Clamp
This is the whole program:
use rustclamp::prelude::*;
fn main() {
Clamp::run(|| {
println!("Hello Clamp");
});
}
Clamp::run calls the closure once on the current thread and returns its result unchanged. Captures may borrow local data or consume owned values; errors and panics behave like ordinary Rust. No Core, Kernel or Runtime is compiled in.
2. The full checkout#
The examples use the other packages through path dependencies, so the repositories sit side by side:
mkdir clamp && cd clamp
for repo in rustclamp core kernel runtime http postgres messaging worker scheduler; do
git clone https://github.com/rustclamp/$repo
done
clamp/
├── rustclamp/ # facade, examples, ADRs, evidence, tools
├── core/ # rustclamp-core
├── kernel/ # rustclamp-kernel
├── runtime/ # rustclamp-runtime
├── http/ # rustclamp-http (optional, Axum)
├── postgres/ # rustclamp-postgres (optional, SQLx)
├── messaging/ # rustclamp-messaging (optional, Serde)
├── worker/ # rustclamp-worker (optional)
└── scheduler/ # rustclamp-scheduler (optional)
The default main branch contains every example, 00–13, and the clamp CLI in rustclamp/tooling.
Each stays its own Git repository. For a combined Cargo workspace (shared target directory, one cargo test), generate one locally; it is never committed:
python3 rustclamp/tools/workspace.py
3. Run the examples#
From clamp/rustclamp:
# Direct capability injection, no Kernel
cargo run --offline --locked --manifest-path examples/a1-capability/Cargo.toml --example a1-capability
# Module requirement resolved through Kernel
cargo run --offline --locked --manifest-path examples/a2-module/Cargo.toml --example a2-module
# Contributions assembled into a CLI command target
cargo run --offline --locked --manifest-path examples/a3-contribution/Cargo.toml --example a3-contribution
# One blueprint, two processes
cargo run --offline --locked --manifest-path examples/a4-process/Cargo.toml --example a4-process -- cli
WORKER_CONCURRENCY=4 cargo run --offline --locked --manifest-path examples/a4-process/Cargo.toml --example a4-process -- worker
cargo run --offline --locked --manifest-path examples/a4-process/Cargo.toml --example a4-process -- inspect cli
# Ordered start, readiness, drain and stop against fake resources
cargo run --offline --locked --manifest-path examples/a5-lifecycle/Cargo.toml --example a5-lifecycle
Example 05's Tokio feature and examples 06–07 use crates.io packages; download them once:
cargo fetch --manifest-path examples/a5-lifecycle/Cargo.toml
cargo fetch --manifest-path examples/01-users/Cargo.toml
cargo fetch --manifest-path examples/05-messaging/Cargo.toml
# One Users operation from the console, then over HTTP on 127.0.0.1:3000
cargo run --offline --locked --manifest-path examples/01-users/Cargo.toml --bin users-console -- create Ada
cargo run --offline --locked --manifest-path examples/01-users/Cargo.toml --features http --example 01-users-http
# A local event mapped to a versioned message envelope
cargo run --offline --locked --manifest-path examples/05-messaging/Cargo.toml --example 05-messaging
Examples explains what each one proves.
4. Run every check#
The coordinated runner formats, lints, tests, builds docs, checks dependency boundaries and runs every example across the packages:
python3 rustclamp/tools/check.py
Hosted CI is not running yet; this runner is the source of truth for “it passes”.