# fithcmus/awad-price-migration-starter architecture

> Architecture diagram of the GitHub repository fithcmus/awad-price-migration-starter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fithcmus/awad-price-migration-starter
- Repository: https://github.com/fithcmus/awad-price-migration-starter

## Overview

This repository is a teaching starter for a menu service whose price column must evolve without interrupting live traffic. The principal workflow serves menu reads/writes and order placement through an HTTP API backed by shared SQLite storage. Alongside it, migration commands apply or revert schema steps, a consistency checker validates price columns, and a traffic client probes old/new API contracts across instances. The source excerpts show the current API and database setup; migration-file behavior and some utility relationships are documented but their implementations are not sampled.

Main entry points: [`src/db.js`](https://github.com/fithcmus/awad-price-migration-starter/blob/main/src/db.js) (SQLite connection), [`src/app.js`](https://github.com/fithcmus/awad-price-migration-starter/blob/main/src/app.js) (Menu API), [`src/server.js`](https://github.com/fithcmus/awad-price-migration-starter/blob/main/src/server.js) (Server bootstrap), [`scripts/migrate.js`](https://github.com/fithcmus/awad-price-migration-starter/blob/main/scripts/migrate.js) (Migration runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_service["Menu service"]
  node_server["Server bootstrap<br/>[server.js]"]
  node_menu_api["Menu API<br/>[app.js]"]
  node_order_api["Order API<br/>[app.js]"]
end

subgraph group_data["Shared data"]
  node_sqlite[("SQLite connection<br/>[db.js]")]
end

subgraph group_ops["Migration operations"]
  node_migration_runner["Migration runner<br/>[migrate.js]"]
  node_schema_steps["Schema steps"]
  node_seed_data["Menu seeder<br/>[seed.js]"]
end

subgraph group_verification["Live verification"]
  node_data_check["Consistency checker<br/>[check.js]"]
  node_traffic["Traffic client<br/>[traffic.js]"]
end

node_clients(("API clients"))

node_clients -->|"requests menu"| node_menu_api
node_clients -->|"places orders"| node_order_api
node_server -->|"opens database"| node_sqlite
node_server -->|"starts app"| node_menu_api
node_menu_api -->|"queries menu"| node_sqlite
node_order_api -->|"writes orders"| node_sqlite
node_migration_runner -->|"opens database"| node_sqlite
node_migration_runner -->|"applies or reverts"| node_schema_steps
node_seed_data -->|"inserts dishes"| node_sqlite
node_data_check -->|"checks columns"| node_sqlite
node_traffic -->|"probes endpoints"| node_menu_api
node_traffic -->|"probes orders"| node_order_api

click node_server "https://github.com/fithcmus/awad-price-migration-starter/blob/main/src/server.js"
click node_menu_api "https://github.com/fithcmus/awad-price-migration-starter/blob/main/src/app.js"
click node_order_api "https://github.com/fithcmus/awad-price-migration-starter/blob/main/src/app.js"
click node_sqlite "https://github.com/fithcmus/awad-price-migration-starter/blob/main/src/db.js"
click node_migration_runner "https://github.com/fithcmus/awad-price-migration-starter/blob/main/scripts/migrate.js"
click node_schema_steps "https://github.com/fithcmus/awad-price-migration-starter/tree/main/migrations"
click node_seed_data "https://github.com/fithcmus/awad-price-migration-starter/blob/main/scripts/seed.js"
click node_data_check "https://github.com/fithcmus/awad-price-migration-starter/blob/main/scripts/check.js"
click node_traffic "https://github.com/fithcmus/awad-price-migration-starter/blob/main/scripts/traffic.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_menu_api,node_order_api,node_clients toneBlue
class node_sqlite toneAmber
class node_migration_runner,node_schema_steps,node_seed_data toneMint
class node_data_check,node_traffic toneRose
```

## Components

### Menu service

- [Server bootstrap](https://github.com/fithcmus/awad-price-migration-starter/blob/main/src/server.js): `src/server.js`
- [Menu API](https://github.com/fithcmus/awad-price-migration-starter/blob/main/src/app.js): `src/app.js`
- [Order API](https://github.com/fithcmus/awad-price-migration-starter/blob/main/src/app.js): `src/app.js`

### Shared data

- [SQLite connection](https://github.com/fithcmus/awad-price-migration-starter/blob/main/src/db.js): `src/db.js`

### Migration operations

- [Migration runner](https://github.com/fithcmus/awad-price-migration-starter/blob/main/scripts/migrate.js): `scripts/migrate.js`
- [Schema steps](https://github.com/fithcmus/awad-price-migration-starter/tree/main/migrations): `migrations`
- [Menu seeder](https://github.com/fithcmus/awad-price-migration-starter/blob/main/scripts/seed.js): `scripts/seed.js`

### Live verification

- [Consistency checker](https://github.com/fithcmus/awad-price-migration-starter/blob/main/scripts/check.js): `scripts/check.js`
- [Traffic client](https://github.com/fithcmus/awad-price-migration-starter/blob/main/scripts/traffic.js): `scripts/traffic.js`

### Other components

- **API clients**

## Connections

- API clients → Menu API: requests menu (evidence: `src/app.js`)
- API clients → Order API: places orders (evidence: `src/app.js`)
- Server bootstrap → SQLite connection: opens database (evidence: `src/server.js`)
- Server bootstrap → Menu API: starts app (evidence: `src/server.js`)
- Menu API → SQLite connection: queries menu (evidence: `src/app.js`)
- Order API → SQLite connection: writes orders (evidence: `src/app.js`)
- Migration runner → SQLite connection: opens database (evidence: `scripts/migrate.js`)
- Migration runner → Schema steps: applies or reverts (evidence: `README.md`)
- Menu seeder → SQLite connection: inserts dishes (evidence: `scripts/seed.js`)
- Consistency checker → SQLite connection: checks columns (evidence: `scripts/check.js`)
- Traffic client → Menu API: probes endpoints (evidence: `scripts/traffic.js`)
- Traffic client → Order API: probes orders (evidence: `scripts/traffic.js`)
