π Vision
RustAPI brings the developer experience (DX) of modern frameworks like FastAPI to the Rust ecosystem.
We believe that writing high-performance, type-safe web APIs in Rust shouldn't require fighting with complex trait bounds or massive boilerplate. RustAPI provides a polished, battery-included experience where:
- API Design is First-Class: Define your schema, and let the framework handle Validation and OpenAPI documentation automatically.
- The Engine is Abstracted: We rely on industry standards like
tokio,hyper, andmatchitinternally, but we expose a stable, user-centric API. This means we can upgrade the engine without breaking your code. - Zero Boilerplate: Extractors and macros do the heavy lifting.
β¨ Features
- β‘ Fast & Async: Built on top of
tokioandhyper1.0. - π‘οΈ Type-Safe: Request/Response bodies are strictly typed using generic extractors (
Json,Query,Path). - π Automatic OpenAPI: Your code is your documentation. Swagger UI is served at
/docsout of the box. - β
Built-in Validation: Add
#[validate(email)]to your structs and get automatic 422 error handling. - π§© Intuitive Routing: Radix-tree based routing with simple macros
#[rustapi::get],#[rustapi::post]. - π Batteries Included: Tracing, graceful shutdown, state management, and error handling are pre-configured.
π¦ Quick Start
Add rustapi-rs to your Cargo.toml.
use *;
/// Define your response schema
/// Define an endpoint
async
/// Run the server
async
Visit http://127.0.0.1:8080/docs to see your interactive API documentation!
ποΈ Architecture
RustAPI follows a Facade Architecture to ensure long-term stability:
rustapi-rs: The public-facing crate. It re-exports carefully selected types and traits to provide a clean surface.rustapi-core: The internal engine. Handles the HTTP protocol, routing logic, and glue code.rustapi-macros: Powers the ergonomic attributes like#[rustapi::main]and#[rustapi::get].rustapi-openapi/rustapi-validate: Specialized crates that wrap external ecosystems (utoipa,validator) into our consistent API.
πΊοΈ Roadmap
- Phase 1: MVP: Core routing, extractors, and server.
- Phase 2: Validation & OpenAPI: Auto-docs, strict validation, and metadata.
- Phase 3: Batteries Included: Authentication (JWT), CORS, Rate Limiting, and Middleware.
- Phase 4: v1.0 Polish: Advanced ergonomics, CLI tool, and production hardening.
π License
This project is licensed under either of
- Apache License, Version 2.0
- MIT license
at your option.