Sample full‑stack Rust web service demonstrating clean architecture, trait-based design, SQLx/PostgreSQL, Redis, Docker, and automated CI.
Layer | Tech | Purpose |
---|---|---|
HTTP | Rocket 0.5 | Async web framework |
DB | SQLx + PostgreSQL | Async SQL with runtime verification |
Cache | Redis | Session / ephemeral storage |
Admin | CLI binary (cargo run --bin cli ) |
User management, DB setup, and admin utilities |
Tests | tokio , reqwest |
CLI & HTTP API integration tests with authentication |
Dev | Docker Compose | One‑command reproducible stack |
CI | GitHub Actions | Lint → migrate → build → test |
- Domain-Driven Design - Business logic separated from infrastructure
- Trait-Based Abstractions - Clean boundaries between layers
- Repository Pattern - Database access abstracted behind traits
- Dependency Injection - Components use trait objects, not concrete types
- Multi-layered Testing - Unit tests + integration tests for CLI & HTTP API
Docker ≥ 24.x # Engine
Docker Compose v2 # Already bundled with modern Docker
docker compose up -d postgres redis
cargo run # backend starts on :8000
See docs/CR8S - Database Schema.md for database setup instructions.
See the cr8s-fe repository for full-stack development instructions.
# Set up development environment
source scripts/dev-test-setup.sh
# Start services and run all tests
start-services && run-tests
run-cli-tests # Test CLI commands
run-server-tests # Test HTTP API endpoints
See docs/development.md for detailed testing workflows.
cr8s/
├── Cargo.toml # workspace + crate metadata
├── Rocket.toml.template # config template with env substitution
├── Dockerfile # backend container (tests & prod)
├── docker-compose.yml # Postgres + Redis + Rocket
│
├── src/ # application code
│ ├── bin/ # cli.rs, server.rs entry-points
│ ├── domain/ # business logic traits & models
│ ├── repository/ # SQLx implementations & database layer
│ ├── rocket_routes/ # HTTP handlers & REST API
│ ├── auth.rs # authentication & password handling
│ ├── mail/ # email service implementation
│ └── tests/ # unit tests & architectural validation
│
├── tests/ # integration tests
│ ├── cli_integration.rs # CLI command testing
│ └── server_integration.rs # HTTP API testing
│
├── templates/email/ # Tera email templates
├── scripts/ # development & deployment scripts
│ ├── quickstart-dev.sh # one-shot dev bootstrap
└── docs/ # Docker tips & native workflow
See docs/development.md for detailed information about:
- CLI argument testing (with/without database)
- Route state analysis
- Local development setup
GitHub Actions runs the CI pipeline inside the cr8s-dev
container, ensuring full parity with local development.
Non-gating advisory checks (e.g., cargo audit
, cargo outdated
) are also included for visibility.
MIT © 2025 John Basrai