How edo1z/rust-axum-sqlx-sample works
Project type and purpose
• This is a Rust‑based backend REST API service built with the Axum web framework and SQLx for Postgres access.
• Local development is orchestrated via Docker Compose (an “api” container and a “db” container), and the API exposes an OpenAPI (Swagger) interface.
File structure
• Top‑level:
• local/ – Dockerfiles (api, db), docker‑compose.yml, and DB‑init/migration scripts
• migrations/ – SQL migration files
• openapi/ – OpenAPI spec (schemas, paths) for docs / Swagger UI
• src/ – application code:
– bootstrap/
– router/ (routing)
– controllers/ (HTTP handlers + middleware)
– usecases/ (business logic)
– services/ (e.g. image uploads)
– repositories/ (DB abstraction)
– db/ (Postgres connection)
– models/ (domain entities)
– error/ (error types)
– main.rs
– tests/ (unit/integration fixtures)
README
• Shows how to spin up API + DB locally, run migrations, and view Swagger UI at http://localhost:8001.
• References SQLx CLI for adding/running/reverting migrations.
Detail is key—capture every layer and how data moves through it
• With ports (e.g. API:8001, Postgres:5432) and key environment variables from .env.example.
• CI/test workflow (src/tests) if relevant.