How agustasvj/ayotd works
AYOTD is a campus food-ordering and delivery platform. Customers browse the storefront, build a basket, check out as guests or account holders, pay by M-Pesa or cash, and track fulfilment; staff also capture orders from offline channels. Orders proceed through kitchen preparation, dispatch, delivery or pickup, and payment reconciliation. The README documents the broader admin, rider, CRM, analytics and WhatsApp capabilities; their routes are present in the tree, but most were not sampled, so those connections rely on the README rather than inspected implementations.
Main entry points: orders/route.ts Order creation · app/page.tsx Storefront · checkout/page.tsx Checkout · stk-push/route.ts M-Pesa payments
Components 34
Customer ordering
- Storefront
app/page.tsx - Menu browsing
components/food-card.tsx - Food details
components/food-modal.tsx - Basket
components/cart-drawer.tsx - Checkout
app/checkout/page.tsx - Order tracking
app/track/page.tsx
Order and payment
- Order creation
app/api/orders/route.ts - Tracking API
app/api/orders/track/route.ts - WhatsApp intake
app/api/webhooks/whatsapp/route.ts - M-Pesa payments
app/api/payments/stk-push/route.ts
Staff operations
- Order management
app/admin/orders/page.tsx - Manual orders
app/api/admin/orders/manual/route.ts - Kitchen display
app/admin/kitchen/page.tsx - Delivery dispatch
app/admin/deliveries/page.tsx - Rider portal
app/rider/page.tsx - Admin insights
app/admin/analytics/page.tsx - WhatsApp inbox
app/admin/whatsapp/page.tsx - Payment reconciliation
app/admin/payments/page.tsx - Menu management
app/admin/menu/page.tsx
Shared services
- Supabase database
- Menu API
app/api/menu/route.ts - Menu cache
lib/menu-cache.ts - In-memory cache
lib/fast-cache.ts - Supabase client
lib/supabase/server.ts - Notifications
lib/notifications.ts - WhatsApp messaging
lib/whatsapp.ts - Customer auth
lib/customer-auth.ts - Admin auth
lib/admin-auth.ts - Input validation
lib/validation.ts - Money helpers
lib/money.ts - Demo catalog
lib/demo-menu.ts
Other components
- Customer
- Safaricom Daraja
- WhatsApp Cloud API
Connections 39
- Customer → Storefront: browses
- Storefront → Menu browsing: renders
app/page.tsx - Storefront → Food details: opens
app/page.tsx - Storefront → Basket: opens
app/page.tsx - Basket → Checkout: proceeds to
- Checkout → Order creation: submits order
- Order creation → Input validation: validates with
app/api/orders/route.ts - Order creation → Supabase client: writes through
app/api/orders/route.ts - Supabase client → Supabase database: accesses
lib/supabase/server.ts - Order creation → Notifications: dispatches
app/api/orders/route.ts - Order creation → In-memory cache: invalidates
app/api/orders/route.ts - Notifications → WhatsApp messaging: uses
lib/notifications.ts - M-Pesa payments → Safaricom Daraja: requests STK push
- Safaricom Daraja → M-Pesa payments: sends callback
- Checkout → M-Pesa payments: initiates payment
- Customer → Order tracking: tracks order
- Order tracking → Tracking API: fetches status
- Tracking API → Supabase client: reads through
app/api/orders/track/route.ts - Manual orders → Supabase database: records order
- Order management → Order creation: manages orders
- Order management → Kitchen display: routes tickets
- Kitchen display → Delivery dispatch: marks ready
- Delivery dispatch → Rider portal: assigns runs
- Rider portal → M-Pesa payments: collects at doorstep
- Admin insights → Supabase database: reports on
- WhatsApp Cloud API → WhatsApp intake: sends messages
- WhatsApp intake → Supabase database: stores inbox
- WhatsApp inbox → Manual orders: converts to order
- Menu management → Supabase database: updates catalog
- Storefront → Menu API: loads menu
- Menu API → Supabase client: reads through
app/api/menu/route.ts - Menu API → Menu cache: checks and sets
app/api/menu/route.ts - Menu cache → In-memory cache: uses
lib/menu-cache.ts - Menu API → Demo catalog: falls back to
app/api/menu/route.ts - M-Pesa payments → Supabase client: records payment
- Payment reconciliation → Supabase database: reconciles payments
- Order management → Admin auth: requires staff access
- Checkout → Customer auth: supports accounts
- Checkout → Money helpers: calculates totals
app/checkout/page.tsx