# lacoustre/food_delivery_app architecture

> Architecture diagram of the GitHub repository lacoustre/food_delivery_app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lacoustre/food_delivery_app
- Repository: https://github.com/lacoustre/food_delivery_app

## Overview

This repository contains a restaurant ordering and operations product: a Next.js customer storefront, an admin panel, and shared Supabase-backed order workflows. Customers browse meals, build a cart, check out, pay, and receive order updates; staff manage orders and dispatch delivery. Payment webhooks can recover order creation if the browser-side flow fails. Reviews, promotions, restaurant settings, and reporting are additional capabilities indicated by the tree. Source excerpts confirm several server-side integrations and persistence actions; links for unsampled UI and edge-function wiring are omitted where call ownership cannot be established.

Main entry points: [`cuisine-webapp/src/app/api/create-payment-intent/route.ts`](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/api/create-payment-intent/route.ts) (Payment intent), [`cuisine-webapp/src/app/api/create-order/route.ts`](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/api/create-order/route.ts) (Create order), [`cuisine-webapp/src/lib/supabase.ts`](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/lib/supabase.ts) (Supabase), [`cuisine-webapp/src/app/api/webhooks/stripe/route.ts`](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/api/webhooks/stripe/route.ts) (Payment webhook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Customer storefront"]
  node_storefront["Storefront pages"]
  node_dish["Dish details<br/>[page.tsx]"]
  node_cart["Cart<br/>[page.tsx]"]
  node_checkout["Checkout<br/>[page.tsx]"]
  node_reviews["Reviews<br/>[reviewsService.ts]"]
end

subgraph group_ordering["Ordering and fulfillment"]
  node_payment["Payment intent<br/>[route.ts]"]
  node_create_order["Create order<br/>[route.ts]"]
  node_stripe_webhook["Payment webhook<br/>[route.ts]"]
  node_delivery_quote["Delivery quote<br/>[route.ts]"]
  node_dispatch["Courier dispatch<br/>[route.ts]"]
end

subgraph group_operations["Restaurant operations"]
  node_admin["Admin panel<br/>[App.tsx]"]
  node_admin_orders["Order management<br/>[Orders.tsx]"]
  node_admin_analytics["Analytics<br/>[Analytics.tsx]"]
  node_admin_meals["Meal management<br/>[Meals.tsx]"]
  node_refund["Refund processing<br/>[route.ts]"]
  node_notify["Status notification<br/>[route.ts]"]
end

subgraph group_platform["Data and integrations"]
  node_supabase[("Supabase<br/>[supabase.ts]")]
  node_pricing["Pricing rules<br/>[pricing.ts]"]
  node_cart_pricing["Cart pricing<br/>[cartPricing.ts]"]
  node_stripe["Stripe"]
  node_clover["Clover POS<br/>[clover.ts]"]
  node_uber["Uber Direct<br/>[uberDirect.ts]"]
  node_email["Email service<br/>[emailService.ts]"]
end

node_customer(("Customer"))
node_staff(("Restaurant staff"))

node_customer -->|"browses"| node_storefront
node_customer -->|"views"| node_dish
node_customer -->|"builds"| node_cart
node_customer -->|"checks out"| node_checkout
node_checkout -->|"requests payment"| node_payment
node_payment -->|"prices items"| node_cart_pricing
node_payment -->|"calculates total"| node_pricing
node_payment -->|"quotes delivery"| node_uber
node_payment -->|"creates intent"| node_stripe
node_payment -->|"stores pending order"| node_supabase
node_checkout -->|"submits order"| node_create_order
node_create_order -->|"validates prices"| node_cart_pricing
node_create_order -->|"calculates total"| node_pricing
node_create_order -->|"quotes delivery"| node_uber
node_create_order -->|"writes order"| node_supabase
node_create_order -->|"pushes ticket"| node_clover
node_stripe -->|"sends event"| node_stripe_webhook
node_stripe_webhook -->|"reads and writes orders"| node_supabase
node_stripe_webhook -->|"pushes ticket"| node_clover
node_stripe_webhook -->|"sends alert"| node_email
node_delivery_quote -->|"requests quote"| node_uber
node_staff -->|"manages restaurant"| node_admin
node_admin_orders -->|"requests refund"| node_refund
node_refund -->|"issues refund"| node_stripe
node_refund -->|"reads and updates order"| node_supabase
node_admin_orders -->|"requests dispatch"| node_dispatch
node_dispatch -->|"creates delivery"| node_uber
node_dispatch -->|"reads and updates order"| node_supabase
node_admin_orders -->|"requests update email"| node_notify
node_notify -->|"reads order"| node_supabase
node_notify -->|"sends update"| node_email
node_reviews -->|"reads and writes reviews"| node_supabase

click node_storefront "https://github.com/lacoustre/food_delivery_app/tree/main/cuisine-webapp/src/app"
click node_dish "https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/meal/page.tsx"
click node_cart "https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/cart/page.tsx"
click node_checkout "https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/checkout/page.tsx"
click node_reviews "https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/lib/reviewsService.ts"
click node_payment "https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/api/create-payment-intent/route.ts"
click node_create_order "https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/api/create-order/route.ts"
click node_stripe_webhook "https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/api/webhooks/stripe/route.ts"
click node_delivery_quote "https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/api/quote-delivery/route.ts"
click node_dispatch "https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/api/dispatch-delivery/route.ts"
click node_admin "https://github.com/lacoustre/food_delivery_app/blob/main/admin-panel/src/App.tsx"
click node_admin_orders "https://github.com/lacoustre/food_delivery_app/blob/main/admin-panel/src/pages/Orders.tsx"
click node_admin_analytics "https://github.com/lacoustre/food_delivery_app/blob/main/admin-panel/src/pages/Analytics.tsx"
click node_admin_meals "https://github.com/lacoustre/food_delivery_app/blob/main/admin-panel/src/pages/Meals.tsx"
click node_refund "https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/api/refund/route.ts"
click node_notify "https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/api/notify-order-status/route.ts"
click node_supabase "https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/lib/supabase.ts"
click node_pricing "https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/lib/pricing.ts"
click node_cart_pricing "https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/lib/cartPricing.ts"
click node_clover "https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/lib/clover.ts"
click node_uber "https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/lib/uberDirect.ts"
click node_email "https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/lib/emailService.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_storefront,node_dish,node_cart,node_checkout,node_reviews toneBlue
class node_payment,node_create_order,node_stripe_webhook,node_delivery_quote,node_dispatch toneAmber
class node_admin,node_admin_orders,node_admin_analytics,node_admin_meals,node_refund,node_notify toneMint
class node_supabase,node_pricing,node_cart_pricing,node_stripe,node_clover,node_uber,node_email toneRose
class node_customer,node_staff toneIndigo
```

## Components

### Customer storefront

- [Storefront pages](https://github.com/lacoustre/food_delivery_app/tree/main/cuisine-webapp/src/app): `cuisine-webapp/src/app`
- [Dish details](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/meal/page.tsx): `cuisine-webapp/src/app/meal/page.tsx`
- [Cart](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/cart/page.tsx): `cuisine-webapp/src/app/cart/page.tsx`
- [Checkout](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/checkout/page.tsx): `cuisine-webapp/src/app/checkout/page.tsx`
- [Reviews](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/lib/reviewsService.ts): `cuisine-webapp/src/lib/reviewsService.ts`

### Ordering and fulfillment

- [Payment intent](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/api/create-payment-intent/route.ts): `cuisine-webapp/src/app/api/create-payment-intent/route.ts`
- [Create order](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/api/create-order/route.ts): `cuisine-webapp/src/app/api/create-order/route.ts`
- [Payment webhook](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/api/webhooks/stripe/route.ts): `cuisine-webapp/src/app/api/webhooks/stripe/route.ts`
- [Delivery quote](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/api/quote-delivery/route.ts): `cuisine-webapp/src/app/api/quote-delivery/route.ts`
- [Courier dispatch](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/api/dispatch-delivery/route.ts): `cuisine-webapp/src/app/api/dispatch-delivery/route.ts`

### Restaurant operations

- [Admin panel](https://github.com/lacoustre/food_delivery_app/blob/main/admin-panel/src/App.tsx): `admin-panel/src/App.tsx`
- [Order management](https://github.com/lacoustre/food_delivery_app/blob/main/admin-panel/src/pages/Orders.tsx): `admin-panel/src/pages/Orders.tsx`
- [Analytics](https://github.com/lacoustre/food_delivery_app/blob/main/admin-panel/src/pages/Analytics.tsx): `admin-panel/src/pages/Analytics.tsx`
- [Meal management](https://github.com/lacoustre/food_delivery_app/blob/main/admin-panel/src/pages/Meals.tsx): `admin-panel/src/pages/Meals.tsx`
- [Refund processing](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/api/refund/route.ts): `cuisine-webapp/src/app/api/refund/route.ts`
- [Status notification](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/app/api/notify-order-status/route.ts): `cuisine-webapp/src/app/api/notify-order-status/route.ts`

### Data and integrations

- [Supabase](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/lib/supabase.ts): `cuisine-webapp/src/lib/supabase.ts`
- [Pricing rules](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/lib/pricing.ts): `cuisine-webapp/src/lib/pricing.ts`
- [Cart pricing](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/lib/cartPricing.ts): `cuisine-webapp/src/lib/cartPricing.ts`
- **Stripe**
- [Clover POS](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/lib/clover.ts): `cuisine-webapp/src/lib/clover.ts`
- [Uber Direct](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/lib/uberDirect.ts): `cuisine-webapp/src/lib/uberDirect.ts`
- [Email service](https://github.com/lacoustre/food_delivery_app/blob/main/cuisine-webapp/src/lib/emailService.ts): `cuisine-webapp/src/lib/emailService.ts`

### Other components

- **Customer**
- **Restaurant staff**

## Connections

- Customer → Storefront pages: browses
- Customer → Dish details: views
- Customer → Cart: builds
- Customer → Checkout: checks out
- Checkout → Payment intent: requests payment
- Payment intent → Cart pricing: prices items
- Payment intent → Pricing rules: calculates total
- Payment intent → Uber Direct: quotes delivery
- Payment intent → Stripe: creates intent
- Payment intent → Supabase: stores pending order
- Checkout → Create order: submits order
- Create order → Cart pricing: validates prices
- Create order → Pricing rules: calculates total
- Create order → Uber Direct: quotes delivery
- Create order → Supabase: writes order
- Create order → Clover POS: pushes ticket
- Stripe → Payment webhook: sends event
- Payment webhook → Supabase: reads and writes orders
- Payment webhook → Clover POS: pushes ticket
- Payment webhook → Email service: sends alert
- Delivery quote → Uber Direct: requests quote
- Restaurant staff → Admin panel: manages restaurant
- Order management → Refund processing: requests refund
- Refund processing → Stripe: issues refund
- Refund processing → Supabase: reads and updates order
- Order management → Courier dispatch: requests dispatch
- Courier dispatch → Uber Direct: creates delivery
- Courier dispatch → Supabase: reads and updates order
- Order management → Status notification: requests update email
- Status notification → Supabase: reads order
- Status notification → Email service: sends update
- Reviews → Supabase: reads and writes reviews
