rkt is an async web framework for Rust with a focus on usability, security, extensibility, and speed.
#[macro_use] extern crate rkt;
#[get("/<name>/<age>")]
fn hello(name: &str, age: u8) -> String {
format!("Hello, {} year old named {}!", age, name)
}
#[launch]
fn rocket() -> _ {
rkt::build().mount("/hello", routes![hello])
}Visiting localhost:8000/hello/John/58 will trigger the hello route, returning
Hello, 58 year old named John!. If <age> can't be parsed as a u8, the route
won't be called and a 404 is returned automatically.
rkt is a community-maintained continuation of Rocket, the Rust web framework originally created by Sergio Benitez and the Rocket contributors. We are deeply grateful for their foundational work — rkt would not exist without it. The original project remains available at github.com/rwf2/Rocket.
Add rkt to your Cargo.toml:
[dependencies]
rkt = "1.2.0"| Crate | Description | Docs |
|---|---|---|
rkt |
Core framework | |
rkt_dyn_templates |
Dynamic template rendering (Tera, Handlebars, MiniJinja) | |
rkt_ws |
WebSocket support |
- HTTP/1.1 & HTTP/2 — built on Hyper
- HTTP/3 preview — via s2n-quic (enable with
http3-preview) - TLS & mTLS — via Rustls (enable with
tls/mtls) - Secret cookies — signed and encrypted cookie support (enable with
secrets) - WebSockets — first-class support via
rkt_ws - Dynamic templates — Tera, Handlebars, and MiniJinja via
rkt_dyn_templates - Tracing — structured logging via the
tracingecosystem - Type-safe routing — compile-time checked routes, guards, and responders
- Extensible — fairings, request guards, and custom responders
- Guide — detailed reference covering all features
- API Docs — full rustdoc reference
- Examples — runnable example projects in this repo
Each subdirectory under examples/ is a self-contained Cargo crate.
To run one:
cd examples/hello
cargo run- Open a GitHub Discussion for questions
- File a bug report or feature request
Contributions are welcome! Please read CONTRIBUTING.md before submitting a pull request. You can also help by:
- Reporting bugs or requesting features via issues
- Improving documentation
- Sharing projects built with rkt in Show & Tell
rkt is built on the shoulders of the Rocket project. Sincere thanks to Sergio Benitez for creating Rocket and to all past and present Rocket contributors for the work that makes this framework possible.
rkt is dual-licensed under your choice of:
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or https://opensource.org/licenses/MIT)
Any contribution you submit will be dual-licensed under the same terms, unless you explicitly state otherwise.