RAVE Template

Rust + Axum + Vite + Everything (else you donβt need)
A monorepo template for building full-stack applications with a type-safe Rust backend and a modern TypeScript frontend. Built as a learning project to explore Rust while keeping the TypeScript developer experience I love.
π― The Idea
I wanted to learn Rust. Everyone says itβs the future, especially for backend development. But most Rust web frameworks felt overwhelming for someone coming from TypeScript.
So I built RAVEβa simple stack that lets me:
- Learn Rust practically by building something real
- Keep my TypeScript frontend (SPA architecture, clear separation of concerns)
- Get type-safe APIs without manual type syncing
- Deploy from a single binary (same-origin, no CORS headaches)
Axum is the simplest way Iβve found to build APIs with Rust. Pair it with serde for serialization and ts-rs for TypeScript generation, and the frontend doesnβt even know Rust is involvedβit just gets typed APIs.
Plus, it makes a good acronym. So letβs go for a ride.
π Key Features
- π¦ Type-Safe APIs: Rust structs β TypeScript types automatically via
ts-rs - β‘ Blazingly Fast Backend: Axum 0.8 + SQLite with WAL mode
- π₯ Hot Reloading:
cargo-watchincluded for instant server restarts - π¦ Zero Config:
devbox shell&& youβre coding - π― Actually Simple: No Kubernetes degree required
ποΈ Architecture Highlights
Backend
- Axum 0.8: Fastest async web framework in Rust with new route syntax
- SQLite (sqlx): 99% of apps donβt need PostgreSQL. WAL mode enables concurrent reads
- ts-rs 10: Automatic TypeScript type generation from Rust structs
- tower-sessions: Session management (see AUTH.md for complete auth guide)
- Argon2: Secure password hashing when you need authentication
Frontend
- Vite + React: Fastest DX with zero config (swap for Vue/Svelte/Solid)
- TypeScript: Full type safety from auto-generated bindings
- Proxy Setup: Pre-configured for local development with backend
Development Experience
- cargo-watch: Edit
.rsfile β server automatically restarts - devbox: Reproducible dev environments across machines
- Minimal Config: No Prettier/ESLint/module system fragmentation
π‘ Perfect For
- Learning Rust: Best way to learn is by building something real
- Side Projects: Simple stack that doesnβt require a Rust PhD
- MVPs: Type-safe APIs without the complexity
- Same-Origin Deployment: One binary serves API + static files
π€· What Itβs Not
- Production-hardened: Iβm still learning Rust, use at your own risk
- Enterprise-ready: No Kubernetes, no microservices, no complexity
- The βchosen oneβ: Rust might be the future, but this is just a template
π§ Tech Stack
| Layer | Technology | Why |
|---|---|---|
| Backend | Axum 0.8 | Fastest async Rust web framework |
| Database | SQLite + sqlx | Compile-time checked queries, no over-engineering |
| Frontend | Vite + React | Fast HMR, zero config |
| Type Safety | ts-rs | Rust β TypeScript, automatically |
| Dev Env | devbox | Reproducible environments |
| Hot Reload | cargo-watch | Edit β restart, automatically |
πͺ Example: Todo App
The template includes a complete working todo app:
// Define your model (backend/src/models.rs)
#[derive(TS, Serialize, Deserialize, sqlx::FromRow)]
#[ts(export, export_to = "../../frontend/src/bindings/")]
pub struct Todo {
pub id: i64,
pub title: String,
pub completed: bool,
}Run cargo test to generate TypeScript types:
// frontend/src/bindings/models.ts
export interface Todo {
id: number;
title: string;
completed: boolean;
}Use in your frontend with full type safety:
async function getTodos(): Promise<Todo[]> {
const res = await fetch('/api/todos');
return res.json(); // β Fully typed, no `any`
}π Quick Start
# Clone
git clone https://github.com/yourusername/rave-template.git
cd rave-template
# Enter dev environment
devbox shell
# Start backend (with hot reloading)
devbox run dev:examples:todo:backend:watch
# In another terminal: start frontend
devbox run dev:examples:todo:frontendYour app is now running at:
- Frontend: http://localhost:5173
- Backend API: http://localhost:3000/api/todos
ποΈ Deployment
# Build frontend
cd frontend && npm run build
# Build backend
cd backend && cargo build --release
# Deploy anywhere
scp target/release/rave-backend your-server:/app/
scp -r frontend/dist your-server:/app/
# Run
DATABASE_URL=sqlite:./app.db ./rave-backendNo Docker required. No Nginx config. Axum serves the dist/ folder as static files.
π Authentication
Need auth? See AUTH.md for a complete guide:
- User registration & login
- Session management with
tower-sessions - Password hashing with Argon2
- Protected routes
- Frontend integration
π¦ Whatβs Inside
rave-template/
βββ backend/ # Rust backend
β βββ src/
β β βββ main.rs # Axum server
β β βββ models.rs # Define types β auto TS generation
β β βββ db.rs # SQLite pool (WAL mode)
β β βββ api/ # Your API routes
β βββ migrations/ # SQL migrations
β
βββ frontend/ # TypeScript frontend
β βββ src/
β β βββ App.tsx # Starter component
β β βββ lib/api.ts # Typed fetch wrapper
β β βββ bindings/ # Auto-generated TypeScript
β βββ vite.config.ts # Proxy setup
β
βββ examples/
βββ todo-app/ # Complete working example
βββ backend/ # Full CRUD with hot reloading
βββ frontend/ # React UIπ Philosophy
Learn by building. Keep it simple. Add complexity when needed.
What we left out (on purpose):
- β Kubernetes (you donβt need it)
- β Message queues (you donβt need it)
- β Microservices (you definitely donβt need it)
- β GraphQL (REST for CRUD works fine)
- β Complex config (Prettier, ESLint, etc.)
This is a learning project. Iβm exploring Rust while building something useful. If it helps you learn too, great. If not, no worriesβthere are more mature Rust stacks out there.
π Links
Made with π¦ Rust (learning in progress), β‘ Vite, and β Coffee