Raw is a Rust-native web server framework focused on ergonomic routing, middleware, and extensibility while keeping the core small and explicit.
Raw addresses a common infrastructure gap in Rust services: predictable latency under load for multi-tenant workloads. Instead of pushing admission control into external proxies, Raw makes capacity explicit and fair at the framework level.
Mohist principles in practice:
- Universal benefit through fair admission control.
- Frugality via minimal overhead primitives.
- Clarity by exposing explicit route policies.
- Non-aggression by shedding load early.
- Async HTTP server built on Tokio + Hyper
- Declarative routing with params and wildcards
- Middleware chain (request ID, logging, static files)
- Response helpers for JSON, HTML, and text
- Admission control with route policies and global limits
- CLI scaffolding for new projects
use raw::{App, Text};
#[tokio::main]
async fn main() {
let mut app = App::new();
app.get("/", |_req| async { Text::new("Hello from Raw") });
app.listen("127.0.0.1:3000").await.unwrap();
}use raw::{App, RoutePolicy, Text};
#[tokio::main]
async fn main() {
let mut app = App::new();
let policy = RoutePolicy {
max_in_flight: Some(16),
cost: 1,
};
app.get_with("/reports/:id", policy, |_req| async {
Text::new("report")
});
app.listen("127.0.0.1:3000").await.unwrap();
}cargo run -p raw-cli -- new my-raw-appcargo run -p raw --example basiccrates/raw- framework corecrates/raw-cli- CLI toolsdocs/- documentation and engineering notes
spec.mdcodex.mddocs/ARCHITECTURE.mddocs/DEVELOPMENT.mddocs/CONTRIBUTING.mddocs/CONFIGURATION.mddocs/CLI.md
Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International.