Reusable template for building REST Web Services in Rust. Uses Axum HTTP web framework and SeaORM ORM and PostgreSQL.
To use this template as your project starting point, click "Use this template" at the top of this page, or click here.
- Authentication. Based on jsonwebtoken
- Layered configuration. Based on config-rs
- Logs. Based on tracing
- OpenAPI documentation utoipa
- Error handling
- Pagination
- Profile base
- E2E Tests
- Postgres admin pgAdmin
- CI based on Github actions
- Sentry error tracking
- Nginx as reverse proxy and secure connections with SSL certificates Nginx
- Dependabot configuration
./run
# open swagger panel
xdg-open http://127.0.0.1:8080/swagger-ui/
# manually testing your API routes with curl commands
curl -X GET http://127.0.0.1:8080/api/v1/server/health_check
cd ./docker/dev/ && ./up.sh
Some of the integration tests use Docker to spin up dependencies on demand (e.g., a postgres db),so please ensure Docker is installed before running the tests.
./test.sh
This project uses config-rs to manage configuration.
settings
βββ base.toml # default config file
βββ dev.toml # development config file
βββ prod.toml # production config file
βββ test.toml # test config file
export APP_SERVER__PORT=8080
export APP_SERVER__ADDR=127.0.0.1
Before running the application, export this variable:
export APP_PROFILE=prod # Switch to production profile
cp ./scripts/git-hooks/* ./.git/hooks/
cargo run --bin migration -- up -u $DATABASE_URL
Update ERD (Entity-Relationship Diagram) use planter
planter postgres://username:password@localhost:5432/database_name\?sslmode=disable -o docs/schema.puml
# Execute all test projects.
./test
Licensed under either of
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
Contributors are welcome! please fork and send pull requests, If you find a bug or have any ideas on how to improve this project please submit an issue.
See CONTRIBUTING.md.