| Crates.io | rust-saas-boilerplate |
| lib.rs | rust-saas-boilerplate |
| version | 0.1.0 |
| created_at | 2026-01-22 18:58:38.752947+00 |
| updated_at | 2026-01-22 18:58:38.752947+00 |
| description | Production-grade Rust SaaS boilerplate - A complete starter template for building SaaS applications with authentication, user management, and more |
| homepage | |
| repository | https://github.com/HardikKSavaliya/rust-saas-backend |
| max_upload_size | |
| id | 2062379 |
| size | 68,981 |
A production-grade, modular Rust SaaS boilerplate - A complete starter template for building SaaS applications using Axum, PostgreSQL, SeaORM, JWT authentication, and Stripe billing.
This boilerplate is designed to:
src/
โโโ app.rs
โโโ main.rs
โโโ config/
โโโ db/
โโโ middleware/
โโโ modules/
โ โโโ auth/
โ โโโ users/
โ โโโ billing/
โ โโโ orgs/
โ โโโ health/
โโโ error.rs
Each module follows:
handler.rs โ HTTP layerservice.rs โ Business logicmodel.rs โ DB/domain modelsroutes.rs โ Router wiring| Layer | Tech |
|---|---|
| Language | Rust |
| Web | Axum |
| Runtime | Tokio |
| Database | PostgreSQL |
| ORM | SeaORM |
| Auth | JWT + Argon2 |
| Billing | Stripe |
| Logging | tracing |
| Deployment | Docker |
This boilerplate can be used as a library dependency in other Rust projects or as a starting point for your SaaS application.
[dependencies]
rust-saas-boilerplate = { path = "../rust-saas-boilerplate" }
# Or from git:
# rust-saas-boilerplate = { git = "https://github.com/HardikKSavaliya/rust-saas-backend.git" }
use rust_saas_boilerplate::create_app;
let app = create_app();
// Use in your Axum router
See USAGE.md for detailed usage examples.
git clone https://github.com/HardikKSavaliya/rust-saas-backend.git
cd rust-saas-boilerplate
cp .env.example .env
docker-compose up -d db
# Using sea-orm-cli (install with: cargo install sea-orm-cli)
sea-orm-cli migrate up
cargo run
Server runs at:
http://localhost:3000
POST /auth/register
POST /auth/login
GET /users/me
GET /health
# Server Configuration
HOST=0.0.0.0
PORT=3000
ENVIRONMENT=development # or "production"
# Database
DATABASE_URL=postgres://postgres:postgres@localhost:5432/saas
# Authentication
JWT_SECRET=supersecretkey
# Billing (optional)
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
# Logging (optional - overrides default)
# RUST_LOG=info,rust_saas_boilerplate=debug
ENVIRONMENT=production): Only ERROR level logs are shownENVIRONMENT=development): All logs (INFO, DEBUG, etc.) are shownRUST_LOG environment variable to override default behaviorcargo test
docker build -t rust-saas-boilerplate .
docker run -p 3000:3000 rust-saas-boilerplate
See TODO.md
This repo demonstrates:
Perfect for:
MIT
PRs welcome. Fork, branch, commit, and submit.
Give the repo a โญ and feel free to fork it for your own SaaS ideas!