A Proof of Concept (PoC) for a To-Do App using Axum, htmx, and SeaORM.
-
Modify the
DATABASE_URLvar in.envto point to your chosen database -
Turn on the appropriate database feature for your chosen db in
app/Cargo.toml(the"sqlx-postgres",line) -
Execute
cargo runto start the server -
Visit localhost:8000 in browser
Run tests:
# Run all tests (Unit + Integration)
cargo test -p axum-example-app
# Run specific integration tests
cargo test -p axum-example-app --test auth_tests
cargo test -p axum-example-app --test users_testsRun migration:
cargo run -p migration -- upRegenerate entity: Auto-generated, do not modify the entity folder.
sea-orm-cli generate entity --output-dir ./entity/src --lib --entity-format dense --with-serde both| Variable | Description | Default |
|---|---|---|
ENABLE_FILE_LOGGING |
Enable rolling file logging in logs/*.log |
false |
SQLX_LOGGING |
Enable SQLx query logging | false |
SQLX_LOG_LEVEL |
Level for SQLx logs (info, debug, error, etc) |
info |
- Docker and Docker Compose installed
| Service | Image | Port | Description |
|---|---|---|---|
| database | postgres:latest |
5432 |
PostgreSQL database |
| redis | redis:latest |
6379 |
Redis cache with AOF persistence |
| pgadmin | dpage/pgadmin4:latest |
5050 |
Database management UI |
| minio | minio/minio:latest |
9000 / 9001 |
Object storage (API / Console) |
| axum | bci-base:16.0 |
8000 |
Application server (release binary) |
Start only the infrastructure services (database, redis, pgadmin, minio) and run the app locally:
# Start infrastructure services
docker compose up -d database redis pgadmin minio
# Run migrations
cargo run -p migration -- up
# Start the app locally
cargo run -p axum-example-appRun everything inside Docker, including the application:
# Build the release binary first
cargo build --release
# Start all services
docker compose up -dThe
axumservice uses.envand expects the release binary at./target/release/axum-example-brittos.
| Service | User | Password |
|---|---|---|
| PostgreSQL | root |
root |
| pgAdmin | admin@admin.com |
admin123 |
| MinIO | minioadmin |
minioadmin |
# Stop all services
docker compose down
# Stop and remove volumes (reset all data)
docker compose down -v
# View logs
docker compose logs -f
# View logs for a specific service
docker compose logs -f database
# Restart a specific service
docker compose restart redis