File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,29 @@ Payflow is a wallet transfer app with an Express API and a Vite/React frontend.
2626- ` .github/ ` issue templates, PR template, and CI
2727- ` docs/ ` maintainer notes and Wave issue ideas
2828
29+ ## Architecture
30+
31+ The backend is a small Express app where ` src/app.js ` wires middleware and mounts
32+ feature routes. A typical API request moves through this path:
33+
34+ ``` text
35+ route → controller → service → model → store
36+ ```
37+
38+ - Routes in ` src/routes/ ` define the HTTP endpoints and attach request
39+ middleware.
40+ - Controllers in ` src/controllers/ ` adapt request bodies, authenticated user
41+ data, and model responses to JSON API responses.
42+ - Services in ` src/services/ ` hold business operations such as transfers that
43+ need validation, balance updates, and transaction records.
44+ - Models in ` src/models/ ` expose user, wallet, and transaction operations.
45+ - The store layer in ` src/lib/store.js ` uses the local JSON file by default,
46+ while ` src/lib/db.js ` and the SQL-backed model paths are used when
47+ ` DATABASE_URL ` is present.
48+
49+ That dual storage mode keeps the same route/controller/service shape for quick
50+ local review and for Postgres-backed deployments.
51+
2952## Why this repo is easy to run
3053
3154- no database required to get started — falls back to a local JSON store
You can’t perform that action at this time.
0 commit comments