Starter template for a web application written in Rust, leveraging the "default" stack of tokio, axum, and sqlx.
If you're looking to quickly spin up a solid, production-ready foundation of a scalable web application, this template is for you.
The template provides the necessary building blocks for a proper Rust web application, such as:
- Database connection pool provided via Axum state
- Database migrations using sqlx-cli
- Basic request tracing
- Crate set up as both lib and bin to facilitate e2e testing
Make sure you have installed all the prerequisites.
Spin up the database:
just db
docker run -d --rm --name web-starter-db -p 5432:5432 --env-file .env postgres:17-alpineRun the migrations:
just mig-up
sqlx migrate runRun the server:
just watch
cargo watch -x runRun tests:
just watch test
cargo watch -x test- just runner to run project-specific commands
cargo install just- cargo-watch to run the dev server in watch mode
cargo install cargo-watch --locked- sqlx-cli to run migrations
cargo install sqlx-cli- docker to run the database