How akramiot/orderbuddy works
1. Repo shape
- This is a monorepo with three main TypeScript applications under orderbuddy/src/ and one Python migration service under orderbuddy/checkout-api/.
- The architectural center is the NestJS backend API; the two frontend apps split by audience: customer ordering vs restaurant staff/admin management.
2. Backend API core
- src/api is the primary application server, built with NestJS + TypeScript.
- It exposes domain modules for restaurants, menus, orders, stations, printers, campaigns, reports, payments, origins, locations/settings, users, storage, web push, email, and POS.
- This layer is the main boundary for business logic and persistence access.
3. Persistent domain model
- The backend is wired to MongoDB through explicit model files and collection definitions in src/api/src/db.
- The model set includes restaurants, locations, menus, orders, campaigns, origins, and stations, which indicates the system is organized around restaurant/location-specific data rather than a single global catalog.
- mongo-index-initializer.ts suggests startup-time schema/index management.
4. Customer-facing order app
- src/order is the guest ordering app, built with React/Vite/Ionic/Capacitor.
- Its flow is: entry/menu browsing → cart → checkout → status tracking, with separate pages for privacy/terms and error handling.
- It talks to the backend through query/service wrappers for menu fetch, order creation, payment, and order-status reads.
5. Checkout and payment boundary
- The order app contains payment-specific components for Apple Pay, Google Pay, and a Gravity payment form.
- The checkout boundary is intentionally split: the UI collects cart and customer data, then delegates payment/order submission to backend APIs and payment-specific query hooks.
- The separate checkout-api folder is a Python FastAPI service used for migration/testing around checkout concerns.
6. FastAPI checkout migration service
- orderbuddy/checkout-api is a standalone FastAPI service with its own schemas, services, dependency wiring, tests, and OpenAPI tooling.
- It includes checkout-specific logic such as pricing, payment gateway integration, and OpenAPI comparison/export scripts, indicating it is used to validate API compatibility during migration.
- This service is intentionally isolated from the NestJS backend and operates as a smaller, focused checkout boundary.
7. Manage/admin app
- src/manage is the operator-facing app, also built with React/Vite/Ionic/Capacitor, and includes Android packaging plus custom native plugins.
- Its pages cover live orders, order history, menu management, restaurant/location settings, stations, origins, printers, POS, campaigns, and reporting.
- This app is the operational control plane for restaurant staff, not just a CRUD UI.
8. Real-time operations and hardware
- The manage app has hooks and query modules for sockets, dashboard updates, printer services, and notification sound playback.
- The Android code includes a custom star-printer integration and notification/audio/native monitoring components, showing the app is designed for kiosk-like or tablet-based operational use.
- The backend also has an events module, which likely feeds real-time order updates into the manage app.
9. Notifications, email, and external integrations
- The backend contains dedicated modules for email, web push, payments, and AI-related utilities.
- Email templates cover order confirmation, QR-code links, and welcome messages; web push and Firebase artifacts in the manage app indicate push notifications are part of the operational loop.
- The AI module suggests auxiliary services such as translation and working-hours handling rather than core ordering logic.
10. Auth, session, and tenant boundaries
- Authentication in the API is handled through a custom auth layer with Supertokens, guards, middleware, and restaurant/session decorators.
- This implies authorization is scoped by restaurant/session context, which is important for multi-location or multi-tenant access control.
- The frontend apps both consume this API boundary rather than embedding business rules locally.
11. Observability and error handling
- Both frontend apps and the backend include Application Insights / logging support, plus structured error boundary utilities.
- The manage app has explicit observability documentation and test utilities; the API has middleware and logger transport code.
- This makes observability a first-class cross-cutting concern across deployment targets.
12. Docs and deployment workflow
- The docs/ tree acts as the architectural/specification layer: order flow, menu schema, infra naming, Azure infrastructure, and page specs are documented separately from code.
- Deployment is pipeline-driven: there are Azure DevOps YAMLs for API/manage/order variants and a GitHub Actions workflow for the checkout API.
- Static web app configs, Android Gradle files, and Capacitor configs show the repo targets both web and mobile-native deployment surfaces.
Main entry points: app.module.ts API app · src Domain modules · checkout-api-ci.yml Pipelines · App.tsx Manage app
Components 19
Backend API
NestJS business API, auth, data access, and integrations
- API app · Main business API entrypoint and module composition
orderbuddy/src/api/src/app.module.ts - Auth · Guards, middleware, decorators, and session scoping
orderbuddy/src/api/src/auth - Domain modules · Restaurants, menus, orders, stations, printers, campaigns, reports, payments, origins, locations, users, storage, web push, email, POS
orderbuddy/src/api/src - Mongo models · Collections, models, and index initialization for restaurant-scoped data
orderbuddy/src/api/src/db - Events · Socket and event delivery for operational updates
orderbuddy/src/api/src/events - Integrations · Email templates, web push, payments, and AI utilities
orderbuddy/src/api/src
Customer Order App
Guest-facing ordering client and checkout flow
- Order app · Guest-facing ordering application shell
orderbuddy/src/order/src/App.tsx - Order flow · Entry, menu, cart, checkout, status, privacy, terms, and error pages
orderbuddy/src/order/src/pages - Payments UI · Apple Pay, Google Pay, and Gravity payment form boundary
orderbuddy/src/order/src/components - Order queries · Menu fetch, order creation, payment submission, and order-status reads
orderbuddy/src/order/src/queries
Manage App
Restaurant staff control plane for operations and administration
- Manage app · Restaurant staff control plane shell
orderbuddy/src/manage/src/App.tsx - Ops pages · Live orders, history, menu, restaurant, location, station, origin, printer, POS, campaign, and reports pages
orderbuddy/src/manage/src/pages - Realtime tools · Socket hooks, dashboard updates, notification sound, and printer services
orderbuddy/src/manage/src/queries - Android bridge · Custom Android monitor, printer, and notification components
orderbuddy/src/manage/android/app/src/main/java/com/orderbuddy
Checkout Migration Service
Standalone FastAPI checkout boundary used for migration and compatibility checks
- Checkout API · Standalone Python checkout service for migration and compatibility validation
orderbuddy/checkout-api/app/main.py - Checkout logic · Checkout schemas, pricing, payment gateway integration, and service orchestration
orderbuddy/checkout-api/app/services - OpenAPI tools · Export, fetch, and compare OpenAPI specs during migration
orderbuddy/checkout-api/scripts
Connections 24
- API app → Auth: uses · Application wiring depends on auth and session boundaries
- API app → Domain modules: composes · Main server is assembled from domain modules
- Domain modules → Mongo models: persists · Domain modules read and write Mongo-backed models
- Domain modules → Events: publishes · Operational changes flow through realtime events
- Domain modules → Integrations: integrates · Business logic triggers messaging, push, payment, and AI helpers
- Order app → Order flow: renders · Guest app is organized around the ordering journey
- Order flow → Order queries: fetches · Pages call API hooks for menu, checkout, and status data
- Order flow → Payments UI: collects · Checkout page embeds payment-specific UI controls
- Order queries → API app: calls · Guest app communicates with the backend API
- Manage app → Ops pages: renders · Staff app centers on operational screens
- Manage app → Realtime tools: uses · App consumes sockets, printer, and sound hooks
- Manage app → Android bridge: bridges · Android packaging exposes custom native capabilities
- Ops pages → API app: calls · Operator workflows are backed by the API
- Realtime tools → Events: subscribes · Dashboard and order views rely on event-driven updates
- Checkout API → Checkout logic: implements · FastAPI service is built from checkout services and schemas
- Checkout logic → OpenAPI tools: validated by · Migration workflow compares exported and fetched API specs
- Checkout API → API app: mirrors · Standalone service tracks compatibility with the main backend boundary
- Docs → Domain modules: describes · Docs capture API, menu, order flow, and infrastructure contracts
- Docs → Order flow: specs · Order app page specs define the guest experience
- Docs → Ops pages: guides · Manage app documentation covers logging and observability
- Pipelines → API app: deploys · Pipeline variants target the API environment slices
- Pipelines → Manage app: deploys · Pipeline variants target the manage application
- Pipelines → Order app: deploys · Pipeline variants target the order application
- Pipelines → Checkout API: tests · GitHub Actions workflow validates the checkout service