# laksanac61-oss/village-food-app architecture

> Architecture diagram of the GitHub repository laksanac61-oss/village-food-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/laksanac61-oss/village-food-app
- Repository: https://github.com/laksanac61-oss/village-food-app

## Overview

Village Food is a Flutter food-ordering app for Android, web, and iOS, backed by Supabase. Its main workflow spans customer shop discovery and checkout, shop order acceptance and payment-slip review, and rider delivery; admin approval and delivery-zone configuration support operations. The README documents real-time updates, direct PromptPay transfers, and role-specific database rules. Most Flutter implementation files are listed in the tree but were not excerpted, so feature-level relationships below rely on README statements rather than inspected call sites.

Main entry points: [`lib/core/api.dart`](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/core/api.dart) (Supabase client), [`lib/main.dart`](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/main.dart) (App entry), [`supabase/migrations/0001_init.sql`](https://github.com/laksanac61-oss/village-food-app/blob/main/supabase/migrations/0001_init.sql) (Supabase data and policies), [`lib/screens/customer/customer_home.dart`](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/customer/customer_home.dart) (Shop discovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Flutter app"]
  node_app_entry["App entry<br/>[main.dart]"]
  node_home_router["Home routing<br/>[home_router.dart]"]
  node_auth["Sign-in<br/>[auth_screen.dart]"]
end

subgraph group_customer["Customer ordering"]
  node_customer_home["Shop discovery<br/>[customer_home.dart]"]
  node_shop_menu["Shop menu"]
  node_checkout["Checkout"]
  node_order_detail["Order tracking"]
end

subgraph group_fulfillment["Shop and delivery"]
  node_shop_home["Shop operations<br/>[shop_home.dart]"]
  node_shop_orders["Order handling<br/>[shop_orders.dart]"]
  node_shop_menu_admin["Menu management"]
  node_shop_settings["Shop settings<br/>[shop_settings.dart]"]
  node_shop_income["Shop income<br/>[shop_income.dart]"]
  node_rider["Rider delivery<br/>[rider_screen.dart]"]
  node_admin["Admin controls<br/>[admin_screen.dart]"]
  node_shop_review["Shop review<br/>[shop_review.dart]"]
end

subgraph group_backend["Backend and integrations"]
  node_api["Supabase client<br/>[api.dart]"]
  node_database[("Supabase data and policies<br/>[0001_init.sql]")]
  node_realtime["Order updates<br/>[order_watch.dart]"]
  node_promptpay["PromptPay QR<br/>[promptpay.dart]"]
  node_line_bot["LINE alerts<br/>[index.ts]"]
  node_notify_shop["Push notifications<br/>[index.ts]"]
end

node_customer_actor(("Customer"))
node_shop_actor(("Shop owner"))
node_rider_actor(("Rider"))
node_admin_actor(("Administrator"))
node_line_service{{"LINE Messaging API"}}
node_fcm{{"Firebase Cloud Messaging"}}

node_customer_actor -->|"uses app"| node_app_entry
node_shop_actor -->|"uses app"| node_app_entry
node_rider_actor -->|"uses app"| node_app_entry
node_admin_actor -->|"uses app"| node_app_entry
node_app_entry -.->|"routes through"| node_home_router
node_customer_actor -->|"browses shops"| node_customer_home
node_customer_home -->|"opens menu"| node_shop_menu
node_customer_actor -->|"places order"| node_checkout
node_checkout -->|"creates payment QR"| node_promptpay
node_customer_actor -->|"tracks order"| node_order_detail
node_shop_actor -->|"manages shop"| node_shop_home
node_shop_actor -->|"manages menu"| node_shop_menu_admin
node_shop_actor -->|"handles orders"| node_shop_orders
node_shop_actor -->|"sets availability"| node_shop_settings
node_shop_actor -.->|"views income"| node_shop_income
node_rider_actor -->|"accepts delivery"| node_rider
node_admin_actor -->|"configures service"| node_admin
node_admin_actor -->|"reviews shops"| node_shop_review
node_customer_home -.->|"loads shop data"| node_api
node_checkout -.->|"submits order"| node_api
node_shop_orders -.->|"updates status"| node_api
node_rider -.->|"updates delivery"| node_api
node_admin -.->|"sets delivery zones"| node_api
node_api -->|"accesses data"| node_database
node_database -.->|"streams changes"| node_realtime
node_line_bot -->|"claims alert work"| node_database
node_line_bot -->|"sends messages"| node_line_service
node_notify_shop -->|"claims push events"| node_database
node_notify_shop -->|"sends notifications"| node_fcm

click node_app_entry "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/main.dart"
click node_home_router "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/home_router.dart"
click node_auth "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/auth_screen.dart"
click node_customer_home "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/customer/customer_home.dart"
click node_shop_menu "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/customer/shop_menu_screen.dart"
click node_checkout "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/customer/checkout_screen.dart"
click node_order_detail "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/customer/order_detail_screen.dart"
click node_shop_home "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/shop/shop_home.dart"
click node_shop_orders "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/shop/shop_orders.dart"
click node_shop_menu_admin "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/shop/shop_menu_admin.dart"
click node_shop_settings "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/shop/shop_settings.dart"
click node_shop_income "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/shop/shop_income.dart"
click node_rider "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/rider/rider_screen.dart"
click node_admin "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/admin/admin_screen.dart"
click node_shop_review "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/admin/shop_review.dart"
click node_api "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/core/api.dart"
click node_database "https://github.com/laksanac61-oss/village-food-app/blob/main/supabase/migrations/0001_init.sql"
click node_realtime "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/core/order_watch.dart"
click node_promptpay "https://github.com/laksanac61-oss/village-food-app/blob/main/lib/core/promptpay.dart"
click node_line_bot "https://github.com/laksanac61-oss/village-food-app/blob/main/supabase/functions/line-bot/index.ts"
click node_notify_shop "https://github.com/laksanac61-oss/village-food-app/blob/main/supabase/functions/notify-shop/index.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_app_entry,node_home_router,node_auth toneBlue
class node_customer_home,node_shop_menu,node_checkout,node_order_detail toneAmber
class node_shop_home,node_shop_orders,node_shop_menu_admin,node_shop_settings,node_shop_income,node_rider,node_admin,node_shop_review,node_line_service toneMint
class node_api,node_database,node_realtime,node_promptpay,node_line_bot,node_notify_shop toneRose
class node_customer_actor,node_shop_actor,node_rider_actor,node_admin_actor,node_fcm toneIndigo
```

## Components

### Flutter app

- [App entry](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/main.dart): `lib/main.dart`
- [Home routing](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/home_router.dart): `lib/screens/home_router.dart`
- [Sign-in](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/auth_screen.dart): `lib/screens/auth_screen.dart`

### Customer ordering

- [Shop discovery](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/customer/customer_home.dart): `lib/screens/customer/customer_home.dart`
- [Shop menu](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/customer/shop_menu_screen.dart): `lib/screens/customer/shop_menu_screen.dart`
- [Checkout](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/customer/checkout_screen.dart): `lib/screens/customer/checkout_screen.dart`
- [Order tracking](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/customer/order_detail_screen.dart): `lib/screens/customer/order_detail_screen.dart`

### Shop and delivery

- [Shop operations](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/shop/shop_home.dart): `lib/screens/shop/shop_home.dart`
- [Order handling](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/shop/shop_orders.dart): `lib/screens/shop/shop_orders.dart`
- [Menu management](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/shop/shop_menu_admin.dart): `lib/screens/shop/shop_menu_admin.dart`
- [Shop settings](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/shop/shop_settings.dart): `lib/screens/shop/shop_settings.dart`
- [Shop income](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/shop/shop_income.dart): `lib/screens/shop/shop_income.dart`
- [Rider delivery](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/rider/rider_screen.dart): `lib/screens/rider/rider_screen.dart`
- [Admin controls](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/admin/admin_screen.dart): `lib/screens/admin/admin_screen.dart`
- [Shop review](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/screens/admin/shop_review.dart): `lib/screens/admin/shop_review.dart`

### Backend and integrations

- [Supabase client](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/core/api.dart): `lib/core/api.dart`
- [Supabase data and policies](https://github.com/laksanac61-oss/village-food-app/blob/main/supabase/migrations/0001_init.sql): `supabase/migrations/0001_init.sql`
- [Order updates](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/core/order_watch.dart): `lib/core/order_watch.dart`
- [PromptPay QR](https://github.com/laksanac61-oss/village-food-app/blob/main/lib/core/promptpay.dart): `lib/core/promptpay.dart`
- [LINE alerts](https://github.com/laksanac61-oss/village-food-app/blob/main/supabase/functions/line-bot/index.ts): `supabase/functions/line-bot/index.ts`
- [Push notifications](https://github.com/laksanac61-oss/village-food-app/blob/main/supabase/functions/notify-shop/index.ts): `supabase/functions/notify-shop/index.ts`

### Other components

- **Customer**
- **Shop owner**
- **Rider**
- **Administrator**
- **LINE Messaging API**
- **Firebase Cloud Messaging**

## Connections

- Customer → App entry: uses app (evidence: `README.md`)
- Shop owner → App entry: uses app (evidence: `README.md`)
- Rider → App entry: uses app (evidence: `README.md`)
- Administrator → App entry: uses app (evidence: `README.md`)
- App entry → Home routing: routes through
- Customer → Shop discovery: browses shops (evidence: `README.md`)
- Shop discovery → Shop menu: opens menu (evidence: `README.md`)
- Customer → Checkout: places order (evidence: `README.md`)
- Checkout → PromptPay QR: creates payment QR (evidence: `README.md`)
- Customer → Order tracking: tracks order (evidence: `README.md`)
- Shop owner → Shop operations: manages shop (evidence: `README.md`)
- Shop owner → Menu management: manages menu (evidence: `README.md`)
- Shop owner → Order handling: handles orders (evidence: `README.md`)
- Shop owner → Shop settings: sets availability (evidence: `README.md`)
- Shop owner → Shop income: views income
- Rider → Rider delivery: accepts delivery (evidence: `README.md`)
- Administrator → Admin controls: configures service (evidence: `README.md`)
- Administrator → Shop review: reviews shops (evidence: `README.md`)
- Shop discovery → Supabase client: loads shop data
- Checkout → Supabase client: submits order
- Order handling → Supabase client: updates status
- Rider delivery → Supabase client: updates delivery
- Admin controls → Supabase client: sets delivery zones
- Supabase client → Supabase data and policies: accesses data (evidence: `README.md`)
- Supabase data and policies → Order updates: streams changes
- LINE alerts → Supabase data and policies: claims alert work (evidence: `supabase/functions/line-bot/index.ts`)
- LINE alerts → LINE Messaging API: sends messages (evidence: `supabase/functions/line-bot/index.ts`)
- Push notifications → Supabase data and policies: claims push events (evidence: `supabase/functions/notify-shop/index.ts`)
- Push notifications → Firebase Cloud Messaging: sends notifications (evidence: `supabase/functions/notify-shop/index.ts`)
