https://github.com/snamiki1212/realworld-v1-rust-actix-web-diesel
RealWorld with Rust + ActixWeb + Diesel on Clean Architecture
https://github.com/snamiki1212/realworld-v1-rust-actix-web-diesel
actix-web clean clean-architecture diesel realworld realworld-backend rust
Last synced: 2 months ago
JSON representation
RealWorld with Rust + ActixWeb + Diesel on Clean Architecture
- Host: GitHub
- URL: https://github.com/snamiki1212/realworld-v1-rust-actix-web-diesel
- Owner: snamiki1212
- License: mit
- Created: 2021-10-19T07:18:31.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-30T04:08:45.000Z (almost 2 years ago)
- Last Synced: 2023-12-30T14:39:14.555Z (almost 2 years ago)
- Topics: actix-web, clean, clean-architecture, diesel, realworld, realworld-backend, rust
- Language: Rust
- Homepage:
- Size: 507 KB
- Stars: 74
- Watchers: 3
- Forks: 19
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Overview
Realworld App using `Rust`, `actix-web`, and `diesel`.
## Getting Started
```zsh
# ready
$ sh ./scripts/copy-env.sh# start
$ docker compose up -d# healthcheck
$ curl http://localhost:8080/api/healthcheck
# => OK
``````sh
# 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": "a@a.a", "username": "a", "password": "a" }}' -H "Content-Type: application/json"
```## E2E Test
Running E2E tests using [POSTMAN scripts](https://github.com/gothinkster/realworld/tree/main/api) on CI
```zsh
# run e2e
$ APIURL=http://localhost:8080/api zsh e2e/run-api-tests.sh
```## Tech Stacks
- Rust Edition 2021
- ActixWeb 4.x
- Diesel 2.x## Architecture
- Clean Architecture
- DI container using Constructor Injection with dynamic dispatch ([src/utils/di.rs](https://github.com/snamiki1212/realworld-v1-rust-actix-web-diesel/blob/main/src/utils/di.rs))```mermaid
flowchart TD
Client(("Client"))
Route["Middleware + Route
/src/app/drivers/{middlewares, route}"]
Controller["Controller
/src/app/features/[feature]/controllers.rs"]
Presenter["Presenter
/src/app/features/[feature]/presenters.rs"]
Usecase["Usecase
/src/app/features/[feature]/usecases.rs"]
Repository["Repository
/src/app/features/[feature]/repositories.rs"]
Entity["Entity
/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
```## LICENSE
MIT