Skip to content

marvin-hsu/zero_to_production

Repository files navigation

Zero to Production in Rust

This repository contains Rust code for practicing the concepts taught in the book "Zero To Production In Rust". The application is currently deployed on Fly.io, and you can access it at https://marvinhsu-zero-to-production.fly.dev/. Additionally, Swagger-UI is available.

Differences

The following table shows the differences between the book and this repository:

Item Book Repository
Framework Actix-web Axum
Platform DigitalOcean Fly.io
DB tool sqlx seaORM
Integration test rust build-in pytest
CI Accelerate Cargo-chief Github-action cache
Auth Session JWT
Frontend html Svelte

Frontend

Website fronted is under preparing. https://marvinhsu-zero-to-production-website.fly.dev/

SeaOEM migration

  1. Install sea-orm cli if haven't done
    cargo install sea-orm-cli
  2. Set up database connection string in .env file
  3. Use up command to apply all pending migrations
    sea-orm-cli migrate up
  4. Use generate command to generate model and entity files
    sea-orm-cli migrate generate NAME_OF_MIGRATION
  5. Generate entities from database
    sea-orm-cli generate entity -o src/entity