The application framework for building Rust apps with Axum.
Rustwing is a batteries-included framework for developers who want to build production-ready Rust backends and APIs quickly—especially SaaS and AI-enabled applications. Built on top of Axum and SQLx, it provides strong conventions and structure so you can focus on your product instead of boilerplate. Its explicit patterns also make your codebase easy for coding agents to understand and extend.
- Auth — Argon2 password hashing + JWT tokens out of the box
- Service-first CRUD scaffolding — Generate REST endpoints, services, repositories, and migrations
- Scoped resources — Opt into SaaS-style or parent-child routes and SQLx helpers with
--tenantor--scope - Migrations — Automatic database migrations on run
- Background workers — Wired worker binary with DB pool, LLM client, and tick loop
- LLM hooks — Pluggable AI integrations (DeepSeek, OpenAI, Gemini, Anthropic, local stubs)
- Scaffolding CLI — Generate resources, models, services, repositories, handlers, and routes instantly
- Error handling — Clean mapping of database and application errors
cargo install rustwing-cli
rustwing new my_app
cd my_app
rustwing runRustwing is not a replacement for Axum — it builds on top of it.
- Axum handles HTTP
- Rustwing handles your application
- SQLx keeps SQL explicit
It provides a structured, batteries-included starting point for building real-world Rust apps, especially SaaS-style backends.
Rustwing is an application framework, not a low-level web framework.
It sits above Axum and gives you:
- a consistent project structure
- built-in features like auth and CRUD
- tooling to generate and scale your app quickly
Think less boilerplate, more building.
rustwing g resource product \
--fields 'title:string:required:length(1,255)' \
--fields 'price:f64:required:range(0.0,9999.0)'This generates:
- Domain model (
Product) - Request/response DTOs with validation
- Service functions that own validation, pagination limits, and business logic
- SQLx-native repository glue and explicit CRUD behavior
- Route handlers with offset and cursor pagination
- Router registration
- Database migration
For SaaS and parent-child resources, keep single-tenant CRUD as the default and opt into scoped generation explicitly:
rustwing g resource ticket \
--tenant org_id \
--fields 'org_id:uuid:required' \
--fields 'subject:string:required:length(1,255)' \
--fields 'assigned_member_id:uuid:optional'This generates nested routes like /orgs/{org_id}/tickets, plus scoped repository helpers such as find_by_org_id, update_by_org_id_and_id, and delete_by_org_id_and_id.
Scopes are not limited to tenants:
rustwing g resource comment \
--scope ticket_id \
--fields 'ticket_id:uuid:required' \
--fields 'body:string:required'This generates routes like /tickets/{ticket_id}/comments. You can combine scopes, for example --tenant org_id --scope ticket_id, to generate routes like /orgs/{org_id}/tickets/{ticket_id}/comments.
my_app/
├── api/ # Web server (Axum)
│ ├── src/
│ │ ├── domain/ # Your data models
│ │ ├── http/ # Routes, handlers, DTOs
│ │ │ ├── dtos/ # Request/response types
│ │ │ └── handlers/ # Route handlers
│ │ ├── repository/ # SQLx-native database access
│ │ └── services/ # Business logic and orchestration
│ └── migrations/ # SQL migrations (auto-run)
├── worker/ # DB/LLM-backed worker tick loop
└── frontend/ # (coming soon)
| Env var | Required | Default | Description |
|---|---|---|---|
DATABASE_URL |
Yes | — | Postgres connection string |
JWT_SECRET |
No | dev-only fallback | Secret key for JWT tokens |
LLM_PROVIDER |
No | stub |
AI provider (stub, deepseek, openai, gemini, anthropic) |
LLM_MODEL |
No | provider default | Model name for the selected provider |
DEEPSEEK_API_KEY |
For DeepSeek | — | API key for DeepSeek |
OPENAI_API_KEY |
For OpenAI | — | API key for OpenAI |
GEMINI_API_KEY |
For Gemini | — | API key for Google Gemini |
ANTHROPIC_API_KEY |
For Anthropic | — | API key for Anthropic |
LLM_MAX_TOKENS |
No | — | Default max output tokens; override per-request in code |
RUST_LOG |
No | info,api=debug |
Log level |
WORKER_TICK_SECONDS |
No | 10 |
Worker polling interval |
See ROADMAP.md for what's coming — job queues, frontend SDK generation, billing integration, and more.
See CONTRIBUTING.md for setup, workflow, and publishing instructions.
Rustwing is built on Axum, SQLx, Rig, and the Tokio ecosystem. None of this would exist without those projects.
MIT