https://github.com/thangchung/northwind-rs
The northwind application with the clean architecture approach powered by Rust
https://github.com/thangchung/northwind-rs
actix-web async boilerplate buildpack clean-architecture modular northwind postgresql rust sqlx web web-development
Last synced: about 1 month ago
JSON representation
The northwind application with the clean architecture approach powered by Rust
- Host: GitHub
- URL: https://github.com/thangchung/northwind-rs
- Owner: thangchung
- License: mit
- Created: 2020-05-10T12:28:15.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-25T00:34:49.000Z (about 2 years ago)
- Last Synced: 2025-03-31T21:28:25.146Z (2 months ago)
- Topics: actix-web, async, boilerplate, buildpack, clean-architecture, modular, northwind, postgresql, rust, sqlx, web, web-development
- Language: Rust
- Homepage:
- Size: 1.18 MB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# northwind-rs
The Northwind application powered by Rust (actix-web, sqlx, jwt...)
Generated from [`actix-sqlx-boilerplate`](https://github.com/fabienbellanger/actix-sqlx-boilerplate)
## Give a star ⭐
If you're using this repository for your samples, workshop, your project or whatever, please give a star ⭐. Thank you very much :+1:
# Up and running
## Run server
```bash
$ docker-compose up
$ cargo run --bin northwind-actix
```Then play around with `restclient.http`
# SQLx
sqlx repository: [Github](https://github.com/launchbadge/sqlx)
## sqlx-clisqlx-cli repository: [Github](https://github.com/launchbadge/sqlx/tree/master/sqlx-cli)
```bash
$ cargo install sqlx-cli --no-default-features --features postgres
```### Offline mode
On windows 10
Make sure that you have `docker-compose up` running with at least `postgresdb`
```bash
$ cargo clean
$ cmd /c "set SQLX_OFFLINE=true && cargo sqlx prepare -- --manifest-path apps/actix/Cargo.toml --bin northwind-actix"
```Make sure, we have `sqlx-data.json` updated. Then, we can build the buildpack below
The issue couldn't run `cargo sqlx` cli successfully at https://github.com/launchbadge/sqlx/issues/788
## Migrations
To create a migration:
```bash
$ sqlx migrate add -r
```Run migrations:
```bash
$ sqlx migrate run
```Revet migrations:
```bash
$ sqlx migrate revert
```# Cargo watch
Usage:
```bash
$ cargo watch -x 'run --bin api'
```# Benchmark
Use [Drill](https://github.com/fcsonline/drill)
```bash
$ drill --benchmark drill.yml --stats --quiet
```# Documentation
Run:
```bash
$ cargo doc --open --no-deps
```Run with private items:
```bash
$ cargo doc --open --no-deps --document-private-items
```# Build Docker image with CNCF Buildpacks
```bash
$ pack build vietnamdevsgroup/northwind-rs -e SQLX_OFFLINE=true -e BP_CARGO_INSTALL_ARGS="--path=./apps/actix"
-b docker.io/paketocommunity/rust
```Un-comment section `northwindrs` in `docker-compose.yaml` file, then run:
```bash
$ docker-compose up
```# Troubleshooting
## Inspect docker image
```bash
$ docker run -it --entrypoint /bin/bash vietnamdevsgroup/northwind-rs
```## Dive to see what inside docker image
```bash
$ docker pull wagoodman/dive:latest
$ docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock wagoodman/dive:latest vietnamdevsgroup/northwind-rs
```