Rustapi
A modern, high-performance REST API template built with Rust using Axum framework and clean architecture principles.
Install / Use
/learn @uuhnaut69/RustapiREADME
RustAPI
A modern, high-performance REST API template built with Rust using Axum framework and clean architecture principles.
🚀 Features
- High Performance: Rust + Axum for speed and memory efficiency
- Clean Architecture: Domain, application, and infrastructure layers
- OpenAPI Documentation: Auto-generated docs with Swagger UI and Scalar
- Observability: Health checks, structured logging, and tracing
- Production Ready: CORS, compression, timeouts, Docker support
- Development Tools: Pre-configured linting, formatting, and testing
🏗️ Architecture
src/
├── domain/ # Business logic and entities
├── application/ # Use cases and business rules
├── infrastructure/ # External concerns (HTTP, DB, etc.)
├── lib.rs
└── main.rs
🛠️ Quick Start
-
Clone and setup
git clone <repository-url> your-project-name cd your-project-name rm -rf .git && git init -
Update project details in
Cargo.toml -
Run the application
# Development cargo run # With Docker (includes Redis + PostgreSQL) docker-compose up -d
The API will be available at http://localhost:3000
📖 API Documentation
- Swagger UI: http://localhost:3000/swagger-ui
- Scalar UI: http://localhost:3000/scalar
- OpenAPI JSON: http://localhost:3000/api-docs/openapi.json
Endpoints
- GET
/health- Health check endpoint
🔧 Development
# Testing
cargo test
# Formatting & Linting
cargo fmt
cargo clippy
# Coverage
cargo install cargo-tarpaulin
cargo tarpaulin --out html
🐳 Docker Services
The compose.yaml includes:
- Redis: Port 6379 (UI: 8001)
- PostgreSQL: Port 5432 (postgres/postgres)
# Start services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop and cleanup
docker-compose down -v
⚙️ Configuration
| Variable | Description | Default |
|----------|-------------|---------|
| PORT | Server port | 3000 |
| RUST_LOG | Logging level | info |
🎯 Next Steps
- Add domain models in
src/domain/ - Implement business logic in
src/application/ - Create HTTP handlers in
src/infrastructure/http/ - Add database repositories and integrations
- Extend OpenAPI documentation
- Configure authentication and authorization
📝 License
Licensed under the Apache License 2.0 - see LICENSE file for details.
Related Skills
himalaya
346.8kCLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
node-connect
346.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
taskflow
346.8kname: taskflow description: Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layer
frontend-design
107.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
