A production-ready backend template featuring GraphQL API, PostgreSQL database, and JWKS authentication. Built with clean architecture principles and modern Rust practices.
- GraphQL API using async-graphql with playground support
- PostgreSQL Database with both embedded (for fast development or testing) and external options
- JWKS Authentication compatible with Auth0 and other OpenID Connect providers
- Axum Web Framework for flexible and performant HTTP handling
- Fast compilation times and responsive IDE support
- Embedded database option for rapid development
- Authentication-free mode for testing
- Comprehensive integration tests with isolated database support
- Cross-platform support (Linux/MacOS/Windows)
- Docker containerization with optimized caching
- CI/CD pipeline configuration
- Structured logging with
tracing
- Type-safe error handling using
thiserror
- Database migrations and entity patterns using
sqlx
- Rust toolchain (latest stable)
- PostgreSQL (optional if using embedded database)
- Auth0 account or other OIDC provider
- Copy
.env.example
to.env
and update the variables with your own values. - Refer to the Auth0 documentation for more information on how to configure the authentication system.
- Refer to Database Setup for more information on how to configure the database.
cargo run --features embedded-database
cargo run --database-url "postgresql://user:pass@localhost/dbname"
# or with .env configuration
cargo run
- Access GraphQL playground:
http://<listen_address>/graphql
- Try a sample query:
query { getCurrentUserFeed(category: HOME, limit: 10) { offset posts { content } } }
# Run integration tests (uses isolated database)
cargo test --features embedded-database
# Run specific test suite
cargo test user_tests --features embedded-database
Refer to the Project Structure for more information on the project structure.