/realworld-v1-rust-actix-web-diesel

RealWorld written in Rust and using ActixWeb+Diesel

Primary LanguageRust

logo

CI

Overview

Realworld App using Rust, actix-web, and diesel.

Getting Started

Docker
# ready
$ sh ./scripts/copy-env.sh
$ docker compose up -d
$ curl http://localhost:8080/api/healthcheck
# => OK
Local
# ready
$ sh ./scripts/copy-env.sh
# start postgres
$ brew services start postgres

# start app
$ diesel setup
$ cargo watch
$ curl http://localhost:8080/api/healthcheck
# => OK

E2E Test

Running E2E tests using POSTMAN scripts on CI

# run e2e
$ APIURL=http://localhost:8080/api zsh e2e/run-api-tests.sh

Tech Stacks

  • Rust Edition 2021
  • ActixWeb 4.x
  • Diesel 1.4.x

Architecture

Flow from Request to Response

sequenceDiagram
  actor Client
  participant Middleware as Middleware<br>/middleware/*
  participant Controller as Controller<br>/[feature]/api.rs
  participant Service as Service<br>/[feature]/service.rs
  participant DB

  Client ->> Middleware: request
  Middleware ->> Controller: -
  Controller ->> Controller: Assign to Request Object<br>(/[feature]/request.rs)
  Controller ->> Service: -
  Service ->> DB: -

  DB ->> Service: -
  Service ->> Controller: -
  Controller ->> Controller: Convert into Response Object<br>(/[feature]/response.rs)
  Controller ->> Client: response
Loading

LICENSE

MIT