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 buildIt'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_dbdefine the environment on which we're running by adding ENV=<env>, which will use the .env.<env> file
ENV=dev cargo runUsed in CI/CD
cargo fmt --all -- --check
cargo clippy --all-targets
cargo audit
cargo outdatedHere's what done in order to mock the SPI
- db: every test is creating a new database from
TestContextPostgreSQLwith json fixtures intest/fixtures& spawns the app with this database - http: every test also spins up another rust api (if not already up) with the expected routes but test data in
test/fixtures
ENV=test cargo testTODO: https://github.com/paperclip-rs/paperclip