A Clean Architecture template for a Rest API in rust
Motivations, explanations, requirements & more details in my article Practical Clean Architecture in Typescript, Rust & Python
cargo build
It's currently configured to run with PostgreSQL through Diesel (ORM), but this being clean architecture feel free to change it :)
I suggest
Then install diesel_cli
diesel setup --database-url postgresql://postgres:postgres@localhost/animal_fact_db
diesel migration run --database-url postgresql://postgres:postgres@localhost/animal_fact_db
define the environment on which we're running by adding ENV=<env>, which will use the .env.<env> file
ENV=dev cargo run
Used in CI/CD
cargo fmt --all -- --check
cargo clippy --all-targets
cargo audit
cargo outdated
Here's what done in order to mock the SPI
TestContextPostgreSQL with json fixtures in test/fixtures & spawns the app with this databasetest/fixturesENV=test cargo test
TODO: https://github.com/paperclip-rs/paperclip
$ claude mcp add clean-architecture-rust \
-- python -m otcore.mcp_server <graph>