agent-ready Rust server + CLI template
Key Features β’ Architecture β’ Quick Start β’ Configuration β’ Agent Skills β’ Credits
A Rust application-server template: write your business logic once as a typed
Command, and expose it over multiple transports - a CLI, an HTTP API, and
(later) MCP - all from one shared core. An optional React/Vite frontend talks to
the API over fetch.
| Feature | Tech Stack |
|---|---|
| Core | engine crate - typed async Command registry (no transport deps) |
| CLI + API | appctl binary - call / serve / doctor / probe / run-scenario |
| HTTP API | axum + tower (CORS, tracing, timeout, request-id) |
| Contract | schemars JSON Schema shared across CLI, API, and future MCP |
| Config | app-config crate (YAML + APP__ env overrides + sanitizer) |
| Frontend (optional) | React + TypeScript + Vite, fetch-based API client |
| Logging | tracing + redaction layer |
| Packaging | cargo-dist (binaries + installers) and a server Dockerfile |
| Package Manager | Bun |
| Formatting | Biome + cargo fmt |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β TRANSPORTS (crates/cli - one binary `appctl`, subcommands) β
β β
β appctl call <cmd> --args '{...}' one-shot JSON I/O β
β appctl serve --port 8080 axum HTTP API β
β appctl doctor | probe | run-scenario β
β appctl mcp (stub - see docs/mcp.md)β
βββββββββββββββββ¬ββββββββββββββββββββββββββ¬ββββββββββββββββββββ
β β
optional bun/React frontend β same registry
ββββββββββ HTTP/fetch ββββββββββΆ serve βββββ€ + typed contract
β
ββββββββββββββββββββββββββββββββββββββββββββΌββββββββββββββββββββ
β crates/engine - the service core (no transport deps) β
β Command trait: Input: JsonSchema + Deserialize β
β Output: JsonSchema + Serialize β
β CommandRegistry (inventory self-registration) + schema() β
β Ctx (per-request): fs / network capabilities, request_id β
βββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ
β crates/config (app-config) - AppConfig / FrontendConfig β
β YAML + APP__ env overrides + secret sanitizer β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
crates/engine/- all real logic; a typed, asyncCommandregistry with self-registration (inventory). No CLI/HTTP dependency.crates/cli/- theappctlbinary. Thecliandhttp-apisurfaces are cargo features (both on by default) soappctl initcan prune one.crates/config/-AppConfig(with secrets) vs the sanitizedFrontendConfigserved over HTTP. The sanitizer is a security boundary.crates/assetgen/-asset-genbinary formake banner/make logo.frontend/- optional React/Vite visualization app (fetchAPI client).docs/- Next.js docs site.
# 1. Onboard the template into a real project (dry-run first, then apply)
make init PROFILE=cli+server DRY_RUN=1
make init PROFILE=cli+server
# 2. Build + test the workspace
cargo build --workspace
cargo test --workspace
# 3. Run the HTTP API
make run # = appctl serve (GET /healthz, /api/v1/commands)
# 4. Call a command headlessly
cargo run -p appctl -- call ping --json
cargo run -p appctl -- call read_file --args '{"path": "/etc/hostname"}' --json
# 5. (optional) Run the frontend against the API
bun install
make dev # Vite dev server; /api is proxied to appctl serveScaffold a new command with make new name=fetch_url (or appctl new fetch_url) - it self-registers, so it's immediately callable over the CLI and
the API.
make logo/make bannerregenerate branding assets via the Rustasset-genCLI (requiresAPP__GEMINI_API_KEY, set via.env).- Logos/icons land under
docs/public/, the banner undermedia/banner.png.
Configuration is handled in Rust and exposed to the frontend over HTTP.
- Rust:
app_config::get_config()(full) /app_config::get_frontend_config()(sanitized). - Frontend:
useConfig()hook βGET /api/v1/config(never carries secrets).
Prefix variables with APP__ to override YAML settings (e.g.,
APP__MODEL_NAME=gpt-4, APP__SERVER__PORT=9090). Point a deployed binary at
its config file with APP_CONFIG_PATH.
Claude Code skills live in .claude/skills/. Invoke them with /skill-name.
| Skill | Description |
|---|---|
/update-backend |
Guide for Rust backend changes - engine commands, traits, CLI/API, testing |
/onboarding |
Turn this template into a real project (interview β dry-run β prune) |
/code-quality |
Run formatting and linting checks (Biome + Clippy) |
/prd |
Generate a Product Requirements Document for a new feature |
/ralph |
Convert a PRD to prd.json for the Ralph autonomous agent |
/cleanup |
Git branch hygiene - delete merged branches, prune stale refs, sync deps |
This software uses the following tools:
Made with contrib.rocks.
