🚀 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. - 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). - 📝 Auto-Docs: Generates OpenAPI 3.0 specifications and serves Swagger UI automatically.
- ✅ Validation: Declarative validation using
#[derive(Validate)]. - 🔌 Batteries Included:
- Authentication: JWT support.
- Database: SQLx integration.
- WebSockets: Real-time communication.
- Templating: Tera view engine.
- Jobs: Background task processing (Redis/Postgres).
Feature taxonomy on the facade:
core-*: core runtime and HTTP behavior (core-openapi,core-tracing, etc.)protocol-*: optional protocol crates (protocol-toon,protocol-ws,protocol-view,protocol-grpc)extras-*: optional production middleware/integrations (extras-jwt,extras-cors, etc.)
📦 Quick Start
Önerilen kullanım (en temiz ve kısa makro isimleri için):
[]
= { = "rustapi-rs", = "0.1.478" }
Sonra kodunda:
use *;
async
async
Eğer istersen direkt uzun isimle de kullanabilirsin:
[]
= "0.1.478"
use *;
...
Add rustapi-rs to your Cargo.toml (kısa isim için alias önerilir):
[]
= { = "0.1", = ["full"] }
The "Hello World"
use *;
/// Define your response schema
/// Define an endpoint
async
async
Visit http://127.0.0.1:8080/docs to see your interactive API documentation!
🗺️ Architecture
RustAPI follows a Facade Architecture:
rustapi-rs: The public-facing entry point. Always import from here.rustapi-core: The internal engine (Hyper/Tower).rustapi-macros: Procedural macros (#[get],#[main]).cargo-rustapi: The CLI tool for scaffolding projects.
🤝 Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
📄 License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.