Realworld App using Rust
, actix-web
, and diesel
.
# ready
$ sh ./scripts/copy-env.sh
# start
$ docker compose up -d
# healthcheck
$ curl http://localhost:8080/api/healthcheck
# => OK
# Check app can connect to DB
$ curl http://localhost:8080/api/tags
# => {"tags":[]}
# Check app can insert data into DB
curl -X POST http://localhost:8080/api/users -d '{"user": {"email": "[email protected]", "username": "a", "password": "a" }}' -H "Content-Type: application/json"
Running E2E tests using POSTMAN scripts on CI
# run e2e
$ APIURL=http://localhost:8080/api zsh e2e/run-api-tests.sh
- Rust Edition 2021
- ActixWeb 4.x
- Diesel 2.x
- Clean Architecture
- DI container using Constructor Injection with dynamic dispatch (src/utils/di.rs)
flowchart TD
Client(("Client"))
Route["Middleware + Route <br><br>/src/app/drivers/{middlewares, route}"]
Controller["Controller<br><br>/src/app/features/[feature]/controllers.rs"]
Presenter["Presenter<br><br>/src/app/features/[feature]/presenters.rs"]
Usecase["Usecase<br><br>/src/app/features/[feature]/usecases.rs"]
Repository["Repository<br><br>/src/app/features/[feature]/repositories.rs"]
Entity["Entity<br><br>/src/app/features/[feature]/entities.rs"]
DB[(Database)]
%% Top to Bottom
Client --Request--> Route
Route --> Controller
Controller --> Usecase
Usecase --> Repository
Repository --> Entity
Entity --> DB
%% Bottom to Top
DB -.-> Entity
Entity -.-> Repository
Repository -.-> Usecase
Usecase -.-> Presenter
Presenter -.Response.-> Client
MIT