๐ rapid-rs
Zero-config, batteries-included web framework for Rust
FastAPI meets Spring Boot, powered by Axum
Why rapid-rs?
Building web APIs in Rust shouldn't require wiring together 10+ crates and writing hundreds of lines of boilerplate. rapid-rs gives you the productivity of FastAPI and Spring Boot, with Rust's performance and type safety.
โก Features
- ๐ฏ Zero Config - Database, migrations, CORS, logging work out of the box
- ๐ Type-Safe - Compile-time guarantees for routes, validation, and serialization
- ๐ Auto-Generated Docs - Swagger UI and OpenAPI specs from your code
- โ Built-in Validation - Request validation with helpful error messages
- ๐ฅ Hot Reload - Fast development cycle with
rapid dev - ๐จ Opinionated Structure - Convention over configuration
- ๐ Production Ready - Structured logging, error handling, health checks
Quick Start
Installation
Note: By default, rapid-rs includes Swagger UI for API documentation. If you encounter installation issues, you can install without it:
To enable Swagger UI later:
Create Your First API
# Create a new project
# Run it
Your API is now running at:
- ๐ http://localhost:8080 - API endpoints
- ๐ http://localhost:8080/docs - Swagger UI
- ๐ http://localhost:8080/health - Health check
Your First Endpoint
use *;
async
async
That's it! You get:
- โ Automatic request validation
- โ Type-safe JSON serialization
- โ Structured error responses
- โ OpenAPI documentation
- โ Request tracing and logging
Comparison
| Feature | FastAPI | Spring Boot | rapid-rs |
|---|---|---|---|
| Type Safety | โ Runtime | โ ๏ธ Runtime | โ Compile-time |
| Auto OpenAPI | โ | โ | โ |
| Hot Reload | โ | โ | โ |
| Zero Config | โ | โ | โ |
| Performance | โ ๏ธ Good | โ ๏ธ Good | โ Blazing Fast |
| Memory Safety | โ | โ | โ Guaranteed |
| Async by Default | โ ๏ธ Partial | โ | โ |
| Learning Curve | Easy | Medium | Easy |
What's Included?
๐ Out of the Box
- Configuration Management - TOML files + environment variables
- Database Integration - PostgreSQL with connection pooling (SQLx)
- Request Validation - Derive-based validation with helpful errors
- Error Handling - Centralized error handling with proper HTTP status codes
- CORS - Sensible defaults, fully configurable
- Logging & Tracing - Structured logging with request correlation
- Health Checks -
/healthendpoint for orchestration - OpenAPI/Swagger - Auto-generated docs at
/docs(withswagger-uifeature, enabled by default)
๐ Swagger UI Configuration
Enabled by default - Swagger UI is included with the default features:
[]
= "0.1" # Includes Swagger UI
Disable if needed (smaller binary, faster compile):
[]
= { = "0.1", = false }
Re-enable later:
[]
= { = "0.1", = ["swagger-ui"] }
๐ฆ CLI Tool
# Create new project with template
# Run with hot reload
# Coming soon:
# rapid generate resource User
# rapid db migrate
Configuration
Configuration is loaded from multiple sources (in order of priority):
config/default.toml- Base configurationconfig/local.toml- Local overrides (gitignored)- Environment variables - Prefixed with
APP__
# config/default.toml
[]
= "0.0.0.0"
= 3000
[]
= "postgres://localhost/mydb"
= 10
Override with environment variables:
APP__SERVER__PORT=8080
Examples
Check out the examples directory for:
- โ REST API - Full CRUD with validation
- ๐ GraphQL API - Coming soon
- ๐ gRPC Service - Coming soon
- ๐ WebSocket Chat - Coming soon
Roadmap
Phase 1 (Current)
- Core framework with auto-configuration
- Request validation
- OpenAPI generation
- CLI tool for project scaffolding
- Hot reload support
Phase 2 (Next)
- Authentication & Authorization (JWT, sessions)
- Database migrations management
- Testing utilities
- More templates (GraphQL, gRPC)
Phase 3 (Future)
- Background jobs
- Multi-tenancy support
- Feature flags
- Admin panel generation
Contributing
Contributions are welcome! This is an early-stage project with lots of opportunities to make an impact.
Development Setup
# Run the example
Philosophy
rapid-rs is built on these principles:
- Convention over Configuration - Sensible defaults, minimal boilerplate
- Type Safety First - Leverage Rust's type system to catch errors at compile time
- Developer Experience - Make the common case easy, the hard case possible
- Production Ready - Include observability, error handling, and best practices by default
- Composable - Built on Axum, use Axum patterns when you need them
Why Not Just Use Axum?
Axum is fantastic - it's the foundation of rapid-rs! But Axum is intentionally minimal and unopinionated. You need to wire up:
- Configuration loading
- Database connections
- Validation
- Error handling patterns
- OpenAPI generation
- Logging setup
- CORS
- Project structure
rapid-rs gives you all of this out of the box, while still giving you access to the full power of Axum when you need it.
License
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.
Credits
Built by Ashish Sharda
Standing on the shoulders of giants:
- Axum - The excellent web framework this is built on
- FastAPI - Inspiration for developer experience
- Spring Boot - Inspiration for conventions
Star โญ this repo if you find it useful!