Skip to content
Loading
All projects

Meal Pilot: Office Lunch Ordering

Lunch ordering for an office canteen in Bangladesh, in English and Bangla: employees order before a cut-off or let a standing order do it, the kitchen sees how many to cook, the counter marks meals served, and HR closes each month into a payroll file. A NestJS API with a Next.js front end, on Vercel and Neon Postgres.

Live (opens in new tab)

Type
Client project (pitch build)
Role
Design, front end and back end
Apps
Web app · REST API · scheduled jobs
Front end
Next.js · React · TypeScript · Tailwind CSS · TanStack Query/Table · next-intl
Back end
NestJS · Fastify · Drizzle ORM · PostgreSQL · Redis · Zod
Delivery
Vercel (web + API) · Neon Postgres · Vercel Blob · GitHub Actions · k6 · Sentry
API routes
77
languages
2
automated tests
190+
failed requests at a 3,000-person rush
0
mealpilot-bd.vercel.app
Meal Pilot's order screen for Wednesday, November 18, already ordered with an order-by time of Tuesday 10:00 PM: a week strip of coloured day tiles, Option A “Chicken roast” on a red field with a CHOSEN stamp beside Option B “Egg korma” on a yellow one, each with its Bangla name, a meal counter at 1 of 10, and a price tag reading ৳120 total, ৳60 subsidized, ৳60 to pay.Open Meal Pilot (opens in new tab)
Try itlive demo
  • Sign in (opens in new tab)

    One-click demo accounts for an employee, an admin and the canteen counter. The admin demo is read-only, and anything it adds is removed after 10 minutes.

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.

Screens

Order lunch for a whole week, November 14 to 20: shortcuts for A every day, B every day and Repeat last week, Saturday still open with Option A or Skip, Sunday to Thursday already ordered, Friday with the canteen closed, and a Review orders panel.
A whole week in one go, with one review sheet.
The employee home: “Good evening, Nusrat” with Saturday's lunch not yet ordered, 25 meals this month, the next lunch with an order-by time of Friday 10:00 PM and ৳60 to pay, the week's orders, the month's ৳3,000 total split into ৳1,500 subsidized and ৳1,500 to pay, and the standing order switched on.
Home: what's next, the week ahead, the month's money and the standing order.
The employee home in Bangla, with Bengali digits throughout: the month's total shown as ৳৩,০০০ and the week's orders and standing order in Bangla.
Every screen in Bangla, with Bengali digits.
Admin overview: 36 meals for tomorrow with a link to the kitchen headcount, 382 orders and 26 days with lunch this month, 15 days to publish, November and December 2026 by published, closed and draft days, and charts of orders per day and orders by protein.
Admin overview: tomorrow's headcount, this month and next, orders per day.
The planner for December 2026: 17 draft, 12 published and 2 closed days on a Saturday-to-Friday calendar, each day with its Option A and Option B dishes and an order count, Fridays locked, and buttons to fill again from the template or review and publish 17 drafts.
The month planner: fill from the weekly template, edit a day, publish.
Monthly report for November 2026: 387 meals, ৳46,440 gross, ৳23,220 paid by the company and ৳23,220 deducted from salaries, 46 active employees at 8.4 meals each, Report CSV and Report Excel buttons, and a chart of meals per day by option.
Monthly report: KPIs, meals per day, per-employee totals, CSV/XLSX.
The canteen counter for Sunday, November 1 at HQ: 0 of 21 meals served, a search box for an employee ID or name (“1004” finds E01004), and today's orders with each person's ID, department, meals, a Waiting status and a Mark served button.
The counter: find anyone by part of their ID or name, serve in one tap.
The one-day order screen in dark mode, with the same coloured day tiles, the red dish field and the price tag.
Dark mode.
Three phone screens on a terracotta background: an employee's home with the next meal's two options at ৳60 each, the week ahead with Wednesday and Thursday ordered and Friday closed, and a tab bar at the bottom; the admin overview in Bengali, with tomorrow's ৩৭ meals and ৪০১ orders this month in Bengali digits; and the canteen counter in dark mode, 0 of 25 meals served, with a search box, rows waiting to be marked served and a Production and Counter tab bar.
On a phone it feels like an app: employees order from a tab bar, admins run the day in Bengali, and the counter marks meals served in the dark theme.

What's covered

Web app

What each role can do on mealpilot-bd.vercel.app. · 8 areas · 36 features

Ordering

  • One day or a whole week
  • Up to 10 meals a day
  • Review sheet
  • Idempotency-Key
  • Undo
  • Edit or cancel before the cut-off
  • Offline banner

Standing orders

  • One option per weekday
  • Pauses
  • Status on Home

Money

  • Month split on Home
  • Monthly statement (printable)
  • CSV of the month

Admin

  • Overview
  • Month planner from a weekly template (drag and drop)
  • Publish preview
  • Void a day
  • Holidays (the government list built in)
  • Dish and side library with photo crop and upload
  • Pricing rules
  • Settings and cut-off per location

People

  • Users with CSV import (preview, then commit)
  • Password resets
  • Roles

Reports

  • Monthly report with KPIs and charts
  • Per-employee statements
  • Month close
  • Payroll CSV/XLSX with a download log
  • Audit log

Canteen

  • Production sheet (printable)
  • Counter with search, serve and undo

Experience

  • English and Bangla
  • Light, dark and three looks
  • Notifications (bell and inbox)
  • Skeleton loading states
  • Role-aware 404 and error pages

API and infrastructure

What runs behind it. · 6 areas · 25 features

API

  • NestJS on Fastify
  • 77 routes under /v1, each with one @Route spec
  • OpenAPI at /docs
  • A typed client generated for the web

Auth

  • Server-side sessions in an HttpOnly cookie through the web proxy
  • argon2id
  • Forced password change on first sign-in
  • Role checks on every route
  • Super admin and sandboxed demo accounts

Data

  • PostgreSQL on Neon
  • Drizzle migrations, reviewed and committed
  • Constraints and atomic updates for correctness
  • Integer poisha
  • Asia/Dhaka business dates

Jobs

  • Idempotent cron routes (standing-order sweep, purge, retention), run from GitHub Actions and a daily Vercel Cron

Security

  • Nonce CSP
  • HSTS
  • Origin check on writes
  • Rate limits in Redis
  • Audit log for every admin write

Testing and delivery

  • 190+ automated tests
  • k6 rush test
  • CI with audit
  • Gated deploys that migrate first
  • Sentry wired in