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

RealWorld written in Rust and using ActixWeb+Diesel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

LICENSE

MIT

About

RealWorld written in Rust and using ActixWeb+Diesel


Languages

Language:Rust 91.4%Language:Shell 7.1%Language:PLpgSQL 1.3%Language:Dockerfile 0.2%