How gichukikelvin67/qr-code-bckend works
This is a restaurant operations API: staff and public clients make HTTP requests for restaurant setup, menus, orders, kitchen preparation, billing, payments, and related operations. The principal order workflow is exposed through public-order and order-management routes, with separate kitchen and bar preparation queues; billing and M-Pesa payment processing are distinct stages. Other major capabilities include inventory and recipes, discounts, refunds, loyalty, and analytics. The graph follows documented route wiring and sampled calls; several service internals and route handlers were not excerpted, so their internal links are omitted.
Main entry points: app.js HTTP application · mpesa.service.js M-Pesa payments · server.js Server startup · order-management.service.js Order management
Components 23
API and access
- HTTP application
src/app.js - Authentication
src/modules/auth/auth.middleware.js
Restaurant operations
- Restaurant setup
src/modules/restaurants/restaurant.service.js - Tables and sessions
src/modules/tables/table.service.js - Menus
src/modules/menu/menu.service.js - Order management
src/modules/orders/order-management.service.js - Public ordering
src/modules/orders/public-order.routes.js - Kitchen preparation
src/modules/preparation/preparation.service.js - Inventory
src/modules/inventory/inventory.service.js - Recipes
src/modules/recipes/recipe.service.js - Discounts
src/modules/discounts/discount.service.js
Billing and payments
- Billing
src/modules/billing/billing.service.js - M-Pesa payments
src/modules/payments/mpesa.service.js - Daraja integration
src/modules/payments/daraja.service.js - Refunds
src/modules/refunds/refund.service.js
Customer and insights
- Loyalty
src/modules/loyalty/loyalty.service.js - Analytics and exports
src/modules/analytics/analytics.controller.js
Runtime infrastructure
- Prisma database
src/config/database.js - Server startup
src/server.js - Socket events
src/sockets/socket-instance.js - Payment reconciliation job
src/jobs/mpesa-reconciliation.job.js - Environment config
src/config/env.js
Other components
- API clients
Connections 27
- API clients → HTTP application: sends requests
src/app.js - HTTP application → Authentication: routes through
- HTTP application → Restaurant setup: routes to
src/app.js - HTTP application → Tables and sessions: routes to
src/app.js - HTTP application → Menus: routes to
src/app.js - HTTP application → Order management: routes to
src/app.js - HTTP application → Public ordering: routes to
src/app.js - HTTP application → Kitchen preparation: routes to
src/app.js - HTTP application → Billing: routes to
src/app.js - HTTP application → M-Pesa payments: routes to
src/app.js - HTTP application → Inventory: routes to
src/app.js - HTTP application → Recipes: routes to
src/app.js - HTTP application → Discounts: routes to
src/app.js - HTTP application → Refunds: routes to
src/app.js - HTTP application → Loyalty: routes to
src/app.js - HTTP application → Analytics and exports: routes to
src/app.js - Order management → Socket events: sets instance
src/modules/orders/order-management.controller.js - Kitchen preparation → Order management: updates status
- M-Pesa payments → Daraja integration: uses gateway
src/modules/payments/mpesa.service.js - M-Pesa payments → Prisma database: reads and writes
src/modules/payments/mpesa.callback.controller.js - M-Pesa payments → Payment reconciliation job: reconciled by
src/jobs/mpesa-reconciliation.job.js - Payment reconciliation job → M-Pesa payments: checks payments
src/jobs/mpesa-reconciliation.job.js - Server startup → HTTP application: serves
src/server.js - Server startup → Prisma database: connects
src/server.js - Server startup → Socket events: configures
src/server.js - Server startup → Payment reconciliation job: starts job
src/server.js - Prisma database → Environment config: loads config
src/config/database.js