Foodie
Three Flutter apps on one Hono and Neon Postgres backend — a customer ordering flow, an admin console, and a live kitchen board.
| Role | Product design, Flutter apps, API, database schema, realtime plumbing, and the showcase site |
| Product | Foodie — customer, admin, and kitchen apps on one shared backend |
| Stack | Flutter 3.50, Dart 3.14, Material 3, Hono on Node, TypeScript, Drizzle ORM, Zod, Neon Postgres, Neon Realtime, Neon Object Storage, SSE, Next.js (showcase) |
| Scope | 3 Flutter apps, a shared Dart package, 28 REST routes, one SSE stream, 12 Postgres tables, seed data, and a live product tour |
| Live showcase | foodie-restaurant-platform.vercel.app |
| Source | github.com/avesh-pathak/foodie |
Overview
A restaurant does not have one interface. A customer browses a menu and waits for an order. An admin edits prices and reads the day's numbers. A kitchen works a board of tickets and needs to know what is sold out. Treating all three as one responsive application with roles usually means the kitchen gets a cramped admin table and the customer inherits controls they should never see.
Foodie splits the product into three Flutter apps that share one Hono API and one Neon Postgres database. The apps never touch the database. A price edit in admin, a sold-out toggle in kitchen, and a new order from the customer app all become writes to the same records; Neon Realtime publishes those changes, and the API fans them out over one Server-Sent Events stream.
The live URL is the showcase site, not a hosted build of the Flutter apps. The apps run locally against the API; the showcase presents the screens, the architecture, and a 30-second tour captured from the build.
The problem
The hard part is not rendering a menu. It is keeping three different operational views honest when the underlying facts change:
| Surface | What it needs | What must not happen |
|---|---|---|
| Customer | The current menu, prices, availability, cart totals, and order status | Seeing a price or a sold-out dish the kitchen already changed |
| Admin | Restaurant and menu editing, photo uploads, order oversight, analytics | Becoming a second database with its own copy of the menu |
| Kitchen | A live board of confirmed, preparing, and ready orders, with prep timers | Refreshing a page to discover a new ticket |
If each app ships its own baked-in catalogue, the menu drifts immediately. If the kitchen and admin share a generic CRUD screen, neither gets the interaction it needs. The design decision that carries the build is separate clients, shared facts: three focused Flutter surfaces on one API and one Postgres schema.
System architecture
The API lives in server/, the three Flutter targets in the repo root, admin/, and kitchen/, and the shared Dart models and client in packages/foodie_core/. The showcase site in web/showcase/ is a separate Next.js application; it calls no private APIs and is not part of the ordering runtime.
The three apps
Customer app (repo root). Six restaurants and 28 dishes, search across both, favourites, add-ons, a cart with quantity controls, coupon validation, GST and delivery fees, saved addresses, and a simulated COD / UPI / card checkout. An order gets a six-step delivery timeline and a hand-painted demo map. The app keeps cart, favourites, addresses, and session in memory; when the API is unreachable it offers Try again or Continue with saved menu rather than showing an empty catalogue.
Admin app (admin/). Restaurant and menu management, price and category edits, dish photo uploads through presigned URLs, order review and status changes, and analytics: revenue, orders, AOV, returns, peak hours, weekdays, monthly revenue, restaurant revenue, and orders by area. It is deliberately a separate Flutter target, not an admin tab inside the customer app.
Kitchen app (kitchen/). A restaurant-bound account sees a live Kanban board of confirmed, preparing, and ready orders. Each ticket carries a prep timer with green, amber, and red thresholds; the board can move an order forward, toggle item availability, and sound or vibrate on a new ticket. The board listens to the SSE stream, so it does not need a manual refresh.




Shared models and clients
Admin and kitchen use packages/foodie_core, a small Dart package with the shared models and an http client. The customer app has its own ApiSync and OrdersApi because its read path is different: it refreshes the catalogue, subscribes to /events, and posts an order at checkout.
The customer app uses FoodieAppState, a ChangeNotifier exposed through an InheritedNotifier. It owns the session, addresses, cart, favourites, coupon, payment choice, orders, and theme. Screens depend on it directly, so cart badges, totals, favourites, and order status update without a second state layer. Runtime dependencies stay deliberately small: http, fl_chart in admin, image_picker where needed, and no state-management, routing, or UI-kit package.
The API
The API is a TypeScript Hono application served by Node. Drizzle ORM defines the Postgres schema and Zod validates request payloads. It exposes 28 REST routes plus one SSE endpoint:
| Area | Routes | Job |
|---|---|---|
| Restaurants | /restaurants, /restaurants/:id |
Catalogue reads and writes |
| Menu | /menu, /menu/:id |
Dish, price, category, add-ons, and availability |
| Orders | /orders, /orders/:id/status |
Placement, kitchen board, status timestamps |
| Analytics | /analytics/* |
Overview, area, restaurant, top dishes, peak hours, weekdays, month, prep time |
| Images | /images/presign, /images/upload, /images/object |
Presigned upload, relay fallback, read-through proxy |
| Auth | /auth/login, /auth/me |
Demo admin and kitchen sessions |
| Realtime | /events |
SSE stream of Neon Realtime changes |
| Health | /health |
Liveness check that does not touch the database |
Writes use bearer tokens and CORS is explicit. The admin and kitchen credentials are demo-only plaintext users seeded with the database; the customer app accepts any non-empty name, phone number, or email. That is a deliberate boundary for a portfolio build, not an authentication design to carry into production.
Order placement totals the cart in the customer app, then POST /orders stores the order, its line items, and a pending status. A status write stamps the relevant timestamp and upserts the daily summary used by analytics. The kitchen board re-reads the order list when the API broadcasts a change.
Data, realtime, and storage
Postgres is the system of record: 12 tables cover restaurants, menu items, add-ons, orders, order items, coupons, demo users, and daily summaries. npm run db:push applies the Drizzle schema; npm run db:seed and npm run db:seed:orders create the demo catalogue and enough orders for the analytics screens to have shape.
Realtime is one subscription layer, not a second database. server/src/realtime.ts subscribes to restaurants, menu_items, and orders through @neon/realtime/server, then emits table-tagged events to an in-process listener set. The /events route turns those events into SSE frames; a dead stream is removed without stopping the others. The customer app and kitchen board refresh on the events they care about. Admin writes publish into the same path, so a menu edit reaches the customer app without a rebuild.
Dish photos go to Neon Object Storage. Admin asks POST /images/presign for a URL, uploads directly, then saves the resulting key through PUT /menu/:id. The base64 relay exists for networks that cannot resolve the storage host; the read-through proxy keeps the stored object addressable from the apps.
Design and accessibility
The visual system is one stylesheet in lib/theme/app_theme.dart, expressed as Flutter ThemeExtension tokens: surface, ink, primary, on-primary, success ink, gold, dark panels, and a themed type scale. Light and dark are composed independently — the dark scheme is a red-on-black night palette, not a mechanical inversion.
Material 3 supplies the components: NavigationBar, a tablet NavigationRail, SegmentedButton, cards, chips, dialogs, bottom sheets, and switches. The typeface is Plus Jakarta Sans across the apps and the showcase. Tap targets are 44 px; forms are keyboard-aware; image failures fall back rather than leaving holes. Colour is never the only signal: order states also carry a label and an icon.
The contrast rules are written down because they are easy to lose in a theme file. White labels sit on a deepened #DC2B3B fill (4.72:1), red text uses #C4202F (5.84:1) rather than the fill red, and rating green is a badge, never body text. Both palettes were checked against the WCAG 2.2 contrast formula.
Verification
# Customer app
flutter analyze
flutter test
flutter build apk --release --split-per-abi --target-platform android-arm,android-arm64
# Admin and kitchen
(cd admin && flutter analyze)
(cd kitchen && flutter analyze)
# API
cd server && npm run build
The tests cover cart maths, coupons, favourites, orders, and addresses; a cart regression test asserts the lines actually paint; and a screen smoke test paints every screen in both themes and fails on layout errors. On Windows, tool/test.ps1 pins TMP and TEMP to a project-local folder so flutter test can finish its cleanup deterministically. The API has a GET /health check that returns { "ok": true } without touching the database.
The Android deliverable is a release-mode, debug-signed APK split per ABI. That is fine for sideloading and honest about what it is; it is not a Play Store signing setup, and the repository's dist/ APKs are not part of every checkout.
What is real, and what is simulated
| Real in this build | Simulated on purpose |
|---|---|
| Postgres rows for restaurants, menu items, prices, orders, and availability | Customer login (a name field) |
28 REST routes and one /events SSE stream |
Payments, coupons, and the rider map |
| Neon Realtime change fan-out and Neon Object Storage uploads | Support chat |
| Drizzle schema, seed scripts, and daily summary tables | The customer timeline and client-side order totals |
| Three Flutter apps with a shared Dart package | Push notifications (new-order alerts are in-app) |
| Admin analytics derived from seeded and placed orders | Production authentication and per-restaurant authorization |
The showcase site is a designed tour, not a hosted app demo. Its 30-second video was composed in HTML, captured frame by frame with Playwright, and encoded with ffmpeg — no screen recording.
Trade-offs and next steps
| Decision | Value | Remaining work |
|---|---|---|
| Three apps instead of one role-aware app | Each surface fits its device and job | Share more UI primitives and keep the package boundaries honest |
| One API and one Postgres schema | A price, availability, or status change has one meaning | Add real auth, tenant scoping, and audit trails |
| Neon Realtime → one SSE stream | Kitchen and customer refresh without polling | Add reconnect/backoff tests and event replay semantics |
| Presigned object storage | Admin uploads do not pass through the API | Add image validation, size limits, and cleanup |
| Demo-sized simulated flows | The build stays reviewable without payment or map providers | Replace with real payment, GPS, and notification integrations |
The interesting part is not that three Flutter apps exist. It is that a price edit, a sold-out toggle, and an order status write converge on the same records and the same event stream, so each surface sees the same restaurant a moment later. The next engineering gains are in making the auth, payment, and location boundaries as honest as the menu boundary already is.