Context
Meal Pilot is lunch ordering for a company in Bangladesh with 2,000 to 5,000 employees across two office locations that share one menu. Every meal has three figures (৳120 gross, ৳60 paid by the company, ৳60 by the employee), and the employee's half goes to payroll each month.
Employees order for any published day before their location's cut-off, up to 10 meals a day for themselves and anyone they treat. Admins plan and publish the menu, void days that weren't served and close each month for payroll. The kitchen sees how many portions to cook, and the counter marks meals served.
What I built
A NestJS REST API under /v1 and a Next.js app that uses it. The browser only ever talks to the web origin: a proxy forwards /api/* to the API with a shared secret, so the session cookie stays first-party.
Every handler is declared with one @Route decorator that sets routing, Zod validation, the response shape, the roles allowed and the rate limit, and the OpenAPI document is generated from the same data. The web's typed API client is generated from that document, so the front end and the API can't drift apart. Contracts, money and date utilities, error codes and the English/Bangla messages live in one shared package.
Ordering and the cut-off
Correctness lives in Postgres: unique, partial-unique, check and exclusion constraints and atomic conditional updates. The cut-off is checked with the database's own clock inside the order transaction, and each order snapshots its price. Ordering a whole week takes one review sheet, and undo is one tap.
Standing orders (one option per weekday, with pauses) are placed by a sweep that runs after each publish, on a 10-minute schedule and whenever the person changes their pattern. Running it twice never orders twice.
Money and payroll
Money is integer poisha everywhere, formatted only on screen. When an admin closes a month, per-employee statements are frozen. The payroll file (CSV or XLSX) has a fixed column contract, and every download is logged. Employees get a monthly statement they can print.
Canteen
The production sheet shows portions per day, location and option. The counter finds a person by any part of their ID or name (“1004” finds E01004); a full ID plus Enter serves that order at once. Serving is one tap for the whole order, with a 5-minute undo.
Roles and the demo
Four roles: an Employee orders, Canteen staff run the production sheet and the counter, an Admin runs the admin side, and the Super Admin sees everything. Authorization runs in the API on every route, and every admin write is audited.
The public demo's admin account is a sandbox. Its writes are refused by default except adding dishes and sides, which a purge job deletes after 10 minutes. The purge also runs when admins are active, since the free scheduler fires hours apart. The demo's screen polls and shows a toast when an addition goes.
Details that matter
Bengali digits are set in their own font, and every number and date is localised. Light, dark and three chrome colours, chosen per person and rendered on the server, so there's no flash on load. WCAG 2.2 AA: colour is never the only signal, and motion respects reduced-motion settings. Data tables have server-side sorting, column choices and a numbered pager with 10/20/50 rows per page, remembered per table. Shared links show a branded preview card.
Quality and delivery
There are 111 API end-to-end tests that rebuild a database from the migrations on every run, about 60 unit tests across the packages, and Playwright suites for the order, admin and ops flows plus an accessibility check. A k6 suite replays the evening rush: 3,000 people arriving over 2 minutes, 2,000 ordering the same option within 20 seconds, and four counters racing to serve the same orders. The local baseline served about 17,500 requests with 0 failed, and every order was served exactly once.
Security work includes a nonce-based Content Security Policy, HSTS, an Origin check on every write, argon2id passwords and per-user rate limits. CI runs lint, typecheck, tests and pnpm audit, and deploys run migrations before the new API goes live.









