32 lines
1.3 KiB
Markdown
32 lines
1.3 KiB
Markdown
# srs-api
|
|
|
|
Backend for SRS: the order parser, the WhatsApp conversation flow, and the API for the Flutter PWA.
|
|
One Node/TypeScript service (Fastify) with a SQLite database. It runs on the server under pm2, behind Caddy.
|
|
|
|
```
|
|
Flutter PWA ──HTTPS──▶ Caddy ──/api/*──▶ ┐
|
|
├─▶ srs-api (127.0.0.1:8080) ──▶ SQLite file
|
|
Hermes plugin ──localhost + secret──────▶ ┘ │
|
|
└─▶ WhatsApp bridge (127.0.0.1:3000): replies, 3 PM summary
|
|
```
|
|
|
|
## Run it on your computer
|
|
|
|
Needs Node 22 or newer.
|
|
|
|
```bash
|
|
npm install
|
|
cp .env.example .env
|
|
npm run migrate # creates ./data/srs.db
|
|
npm run user manage # one menu for all of the below
|
|
npm run user create # a short wizard: choose Admin or User, then set a password
|
|
npm run user password # set a new password for an admin or a user
|
|
npm run user results # turn WhatsApp result messages on or off (admins start on, users off)
|
|
npm run user list # show every account
|
|
npm run shop create # add a shop (name + unique code)
|
|
npm run shop list # show every shop
|
|
npm run dev # http://127.0.0.1:8080
|
|
npm test
|
|
npm run typecheck
|
|
```
|