A modern Rust backend starter template using:
- Axum for HTTP/WebSocket server
- Async-GraphQL for GraphQL APIs
- PostgreSQL via
tokio-postgres
andbb8
async connection pool - Redis via
bb8-redis
async connection pool - Firebase Auth integration
- WebSocket support
- Jemalloc for improved memory performance
- Rust 1.85+ (2024 edition)
- PostgreSQL server
- Redis server
git clone https://github.com/rust-dd/rust-axum-async-graphql-postgres-redis-starter.git
cd rust-axum-async-graphql-postgres-redis-starter
Create a .env
file in the project root:
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
POSTGRES_DB=postgres
REDIS_HOST=redis://localhost:6379
FIREBASE_PROJECT_ID=firebase_project
ADMIN_SECRET=admin1234
cargo run
Once running, open: http://localhost:8000/graphql
This project uses jemallocator
as the global allocator for improved memory allocation performance in high-throughput environments and simd-json for fast JSON operations.
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
MIT