Simple by design. Powerful by Rust.
A backend framework for Rust on Hyper, Tokio and Tower. Typed handlers, modules with scoped dependency injection, request validation, OpenAPI 3.1 and a TypeScript SDK generated from your routes, stable machine-readable error codes, and a manifest and MCP server that let coding agents inspect your project without running it.
Status: 0.1 developer preview. Experimental and not production-ready: the API can change between 0.x releases. The name has had a desk review only, not legal trademark clearance. The code was read by four independent AI review sessions (all findings fixed); no human or third-party security audit has taken place (SECURITY.md). What was verified, on which platform and against which real service, is listed in Verification.
- Explicit by design. Routes, modules, providers and hooks are declared, validated at
buildand frozen before the first request: no reflection, no global service locator, no hidden network calls. A missing dependency or a duplicate route fails at startup, not in production. - Typed handlers. Plain
async fns with extractors (Path,Query,Body,Json,Service,Context). - Modules and scoped services. A provider is visible to its module and children; siblings only see what a module exports.
- Validation and OpenAPI.
#[derive(Schema, Validate)]drives request validation, an OpenAPI 3.1 document and a generated TypeScript client from the same declarations. - Errors you can program against. RFC 9457
application/problem+jsonwith a stable code (SWK-E150), a request id and field-level issues. Codes are documented in the error reference and never renumbered. - Secure, bounded defaults. Body and header limits, timeouts, load shedding with
Retry-After, sanitised 5xx responses, HTTP/2 and TLS (rustls withring), authentication that denies by default routes without an access rule. - Adapters, opt-in. PostgreSQL, Redis, JWT/RBAC, WebSocket and SSE, telemetry, a durable job queue, S3-compatible storage, SMTP and OpenID Connect. The core depends on none of them.
- Agent-ready tooling.
steelwake manifestproduces a deterministic, secret-free description of the app;steelwake mcp serveexposes it over the Model Context Protocol, read-only unless you opt in. - Safe Rust.
unsafe_code = "forbid"in every first-party crate; MSRV 1.85 for the libraries.
Install the command-line tool (it needs Rust 1.88; the libraries need 1.85) and create a project:
cargo install steelwake-cli --locked # installs the `steelwake` binary
steelwake new my-api --template minimal
cd my-api && cargo runWorking on Steelwake itself? Build from a checkout and point generated projects at it:
cargo install --path crates/steelwake-cli --locked, then steelwake new my-api --steelwake-path "$PWD".
curl http://127.0.0.1:3000/
# Hello World--template modular scaffolds a layout with one module per feature (steelwake make module billing adds another).
All snippets below are compiled as documentation tests (cargo test --doc -p steelwake); the complete programs live in
examples/.
use steelwake::prelude::*;
#[tokio::main]
async fn main() -> Result<()> {
let mut app = App::new();
app.get("/", || async { "Hello World" })?;
app.get("/users/{id}", get_user)?;
app.listen(3000).await
}
async fn get_user(ctx: Context) -> Result<Response> {
let id = ctx.param::<u64>("id")?;
Response::json(&serde_json::json!({ "id": id }))
}use std::collections::BTreeMap;
use std::sync::{Mutex, PoisonError};
use steelwake::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Serialize, Schema)]
struct User {
id: u64,
name: String,
email: String,
}
#[derive(Deserialize, Schema, Validate)]
#[serde(deny_unknown_fields)]
struct NewUser {
#[validate(length(min = 1, max = 100))]
name: String,
#[validate(email, length(max = 254))]
email: String,
}
#[derive(Default)]
struct Users(Mutex<BTreeMap<u64, User>>);
async fn create(
Service(users): Service<Users>,
ValidatedBody(input): ValidatedBody<NewUser>,
) -> Result<(StatusCode, Json<User>)> {
let mut map = users.0.lock().unwrap_or_else(PoisonError::into_inner);
if map.values().any(|u| u.email == input.email) {
return Err(AppError::conflict("A user with this email already exists."));
}
let id = map.len() as u64 + 1;
let user = User { id, name: input.name, email: input.email };
map.insert(id, user.clone());
Ok((StatusCode::CREATED, Json(user)))
}
async fn fetch(Service(users): Service<Users>, Path(id): Path<u64>) -> Result<Json<User>> {
let map = users.0.lock().unwrap_or_else(PoisonError::into_inner);
map.get(&id).cloned().map(Json).ok_or_else(|| AppError::not_found("User not found."))
}
#[tokio::main]
async fn main() -> Result<()> {
let mut app = App::new();
app.provide(Users::default())?;
app.post("/users", create)?;
app.get("/users/{id}", fetch)?;
app.listen(3000).await
}An invalid request body is answered with 422 and a body you can parse:
POST /users {"name": "", "email": "not-an-email"}
HTTP/1.1 422 Unprocessable Entity
content-type: application/problem+json
x-request-id: c16244a56bf6e6d388d9877eefa71052
{
"code": "SWK-E150",
"detail": "The request body failed validation.",
"errors": [
{ "code": "length", "message": "must be between 1 and 100 characters", "path": "name" },
{ "code": "email", "message": "must be a valid email address", "path": "email" }
],
"instance": "urn:steelwake:request:c16244a56bf6e6d388d9877eefa71052",
"request_id": "c16244a56bf6e6d388d9877eefa71052",
"status": 422,
"title": "Unprocessable content",
"type": "urn:steelwake:error:SWK-E150"
}
The complete version with PUT, DELETE, pagination and OpenAPI route documentation is examples/crud.
use std::sync::Arc;
use steelwake::prelude::*;
struct Config {
greeting: &'static str,
}
struct Greeter {
config: Arc<Config>,
}
async fn greet(Service(greeter): Service<Greeter>) -> String {
greeter.config.greeting.to_owned()
}
/// Everything under /admin needs a header; the hook runs before any handler of the module.
fn admin_module(token: &'static str) -> Module {
Module::new("admin")
.prefix("/admin")
.on_request(move |req: HookRequest| {
let allowed = req.headers().get("x-admin-token").and_then(|v| v.to_str().ok()) == Some(token);
std::future::ready(if allowed {
req.proceed()
} else {
Err(AppError::forbidden("Admin token required."))
})
})
.get("/stats", || async { "ok" })
}
#[tokio::main]
async fn main() -> Result<()> {
// The factory's argument types are its dependencies: a missing one is reported by `build`, before the server listens.
let greetings = Module::new("greetings")
.prefix("/greetings")
.provide(Config { greeting: "hello" })
.provide_with(|config: Arc<Config>| async move { Ok(Greeter { config }) })
.get("/", greet);
let mut app = App::new();
app.register(greetings)?;
app.register(admin_module("s3cret"))?;
app.listen(3000).await
}examples/modular shows a users module that keeps its store private and exports only a narrow service,
a sibling admin module that can use that service but never the store, and a plugin that counts requests.
steelwake-testing calls the same Tower service the server uses, so an in-process test and a real request behave identically:
use steelwake::prelude::*;
use steelwake_testing::TestClient;
#[tokio::main]
async fn main() -> Result<()> {
let mut app = App::new();
app.get("/", || async { "Hello World" })?;
let client = TestClient::new(&app.build().await?);
let response = client.get("/").send().await.unwrap();
assert_eq!(response.status(), StatusCode::OK);
assert_eq!(response.text(), "Hello World");
Ok(())
}| Command | What it does |
|---|---|
steelwake new NAME [--template minimal|modular] |
Create a project; never overwrites files without --force, never follows symlinks. |
steelwake make module NAME |
Add a module and register it in the marked block of src/modules/mod.rs. |
steelwake routes, modules, check |
Inspect and validate the declared app without starting it. |
steelwake doctor |
Check the toolchain, the project and its configuration. |
steelwake generate openapi|typescript |
OpenAPI 3.1 document or TypeScript client. |
steelwake manifest generate|check|show |
Deterministic, secret-free description of the app for tools and agents. |
steelwake mcp serve |
Model Context Protocol server over stdio; read-only unless --allow-write / --allow-exec. |
steelwake dev, build, test |
Rebuild on change and cargo wrappers. |
Every command accepts --format json (a stable envelope and exit codes), --quiet, --dry-run and --project DIR.
| Crate | Purpose |
|---|---|
steelwake |
Facade and prelude (server and tls features). |
steelwake-core |
App, router, extractors, errors, modules, hooks, configuration, OpenAPI, manifest. |
steelwake-macros |
Schema and Validate derives. |
steelwake-cli |
The steelwake command. |
steelwake-testing |
In-process test client and a real-socket test server. |
steelwake-postgres / steelwake-redis |
PostgreSQL (sqlx) and Redis adapters with pools, readiness checks and TLS. |
steelwake-auth |
JWT, RBAC, passwords, CORS, CSRF, trusted proxies. |
steelwake-realtime |
WebSocket and Server-Sent Events with bounded queues. |
steelwake-telemetry |
Tracing spans, health endpoints, OTLP export. |
steelwake-queue |
Durable PostgreSQL job queue and cron scheduler. |
steelwake-storage / steelwake-email / steelwake-oidc |
S3-compatible storage, SMTP, OpenID Connect relying party. |
An SQLite adapter exists in plugins/steelwake-sqlite but is excluded from the workspace because of an open advisory in its bundled
SQLite (RUSTSEC-2026-0459, ADR 0020).
The benchmark results and methodology cover six HTTP routes, repeated Linux throughput races, p99 latency, and reproduction commands.
flowchart LR
A[TCP / TLS accept] --> B[Hyper HTTP/1.1 or HTTP/2]
B --> C[One Tower service]
C --> D[Request id and admission control]
D --> E[Route resolution]
E --> F[Hooks and extractors]
F --> G[Handler under deadline and panic guard]
G --> H[RFC 9457 error rendering]
H --> I[Response]
The in-process test client calls the same service. See Architecture and the decision records.
Run on macOS arm64 and, for the test gate, Linux aarch64 (Docker), Rust 1.99.1, loopback only:
- The quality gate (
./scripts/gate.sh:rustfmt,clippy -D warnings, the whole test suite with 534 tests, doc tests, minimal-feature builds,rustdoc, release build),cargo deny checkand a library check on the MSRV (1.85) all pass on both platforms. - Adapters were tested against real disposable services, not mocks: PostgreSQL 18 (also over TLS), Redis 8,
rclone serve s3,mailpitand, once, a real SMTP provider (message accepted); S3 conformance against RustFS, SeaweedFS and Garage; OpenID Connect against Dex. - Libraries were also fuzzed with libFuzzer for short smoke runs (HTTP pipeline, JWT verification, storage keys).
Not done: Windows is covered only by the CI job for the crates that need no external service; Amazon S3 and a production OpenID
provider were not tested; there is no independent security review; coverage-guided fuzzing was only run briefly.
The full list is in docs/verification-status.md and docs/feature-matrix.md.
The developer documentation is built with Sphinx and the Read the Docs theme from docs/ and
published to GitHub Pages (a .readthedocs.yaml is included for hosting on Read the Docs); the Rust API reference is
cargo doc --workspace --no-deps --open.
- Getting started, Modules and services, Schemas and OpenAPI, CLI and MCP
- Coming from Axum, Fastify or Fiber
- Error codes, threat model, feature matrix
- Türkçe dokümantasyon: the guide, migration guides, architecture, threat model, feature matrix and benchmarks are also available in Turkish under
docs/tr/(the site has an EN/TR switch).
./scripts/gate.sh # fmt, check, clippy -D warnings, tests, doc tests, minimal features, docs, release build
cargo deny check
cargo +1.85.0 check --workspace --lib --locked --exclude steelwake-cliSome adapter tests start real PostgreSQL 18, Redis, rclone and mailpit processes; see CONTRIBUTING.md
for how to provide them (or use the Docker recipe in scripts/linux/).
Contributions are welcome: read CONTRIBUTING.md and the code of conduct. Report vulnerabilities privately as described in SECURITY.md.
MIT.