# fewxxt/healthy-food architecture

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

- Interactive diagram: https://gitdiagram.com/fewxxt/healthy-food
- Repository: https://github.com/fewxxt/healthy-food

## Overview

HealthyFood is a Thai-language healthy-food ordering site. Customers browse a locally defined menu, add items to a browser-persisted cart, apply coupons, choose a payment method, and reach a confirmation page with simulated delivery progress. Google sign-in gates ordering and profile access; reviews have a separate authenticated submission and admin deletion flow. The README documents these capabilities, while sampled source confirms the cart/order and review API behavior. Payment processing and order persistence are demo-level; unsampled page details are represented only where documented.

Main entry points: [`src/app/cart/page.tsx`](https://github.com/fewxxt/healthy-food/blob/main/src/app/cart/page.tsx) (Cart and checkout), [`src/auth.ts`](https://github.com/fewxxt/healthy-food/blob/main/src/auth.ts) (Google authentication), [`src/app/page.tsx`](https://github.com/fewxxt/healthy-food/blob/main/src/app/page.tsx) (Home page), [`src/app/reviews/page.tsx`](https://github.com/fewxxt/healthy-food/blob/main/src/app/reviews/page.tsx) (Review page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront and catalog"]
  node_home["Home page<br/>[page.tsx]"]
  node_menu["Menu browsing<br/>[page.tsx]"]
  node_fooddata["Food catalog<br/>[foods.ts]"]
  node_foodtypes["Food types<br/>[types.ts]"]
  node_popular["Popular menu<br/>[PopularMenu.tsx]"]
  node_navbar["Navigation<br/>[Navbar.tsx]"]
  node_footer["Footer<br/>[Footer.tsx]"]
end

subgraph group_ordering["Cart and ordering"]
  node_cart["Cart and checkout<br/>[page.tsx]"]
  node_cartstate["Cart state<br/>[Providers.tsx]"]
  node_coupons["Coupon collection<br/>[page.tsx]"]
  node_ordersapi["Order API<br/>[route.ts]"]
  node_success["Order confirmation<br/>[page.tsx]"]
  node_dialog["Popup dialogs<br/>[Dialog.tsx]"]
end

subgraph group_identity["Identity and profile"]
  node_profile["Customer profile<br/>[page.tsx]"]
  node_login["Login page<br/>[page.tsx]"]
  node_auth["Google authentication<br/>[auth.ts]"]
  node_authroute["Auth route<br/>[route.ts]"]
  node_middleware["Access control<br/>[middleware.ts]"]
end

subgraph group_reviews["Customer reviews"]
  node_reviewpage["Review page<br/>[page.tsx]"]
  node_reviewdisplay["Review displays<br/>[HomeReviews.tsx]"]
  node_stars["Star ratings<br/>[Stars.tsx]"]
  node_reviewsapi["Reviews API<br/>[route.ts]"]
  node_reviewstore[("Review storage<br/>[route.ts]")]
end

node_customer(("Customer"))
node_redis[("Upstash Redis")]
node_google(("Google OAuth"))

node_customer -->|"browses"| node_home
node_home -->|"renders"| node_popular
node_home -->|"renders"| node_reviewdisplay
node_home -->|"renders"| node_footer
node_home -->|"links to"| node_menu
node_menu -->|"reads"| node_fooddata
node_fooddata -->|"uses type"| node_foodtypes
node_popular -->|"reads"| node_fooddata
node_customer -->|"selects dishes"| node_menu
node_customer -->|"checks out"| node_cart
node_menu -->|"adds dishes"| node_cartstate
node_cart -->|"reads and updates"| node_cartstate
node_coupons -->|"collects codes"| node_cartstate
node_cart -->|"requests details"| node_profile
node_cart -->|"submits order"| node_ordersapi
node_ordersapi -->|"checks session"| node_auth
node_cart -->|"routes after order"| node_success
node_success -->|"shows progress"| node_customer
node_customer -->|"signs in"| node_login
node_login -.->|"starts sign-in"| node_auth
node_authroute -->|"uses handlers"| node_auth
node_auth -->|"authenticates with"| node_google
node_middleware -->|"checks access"| node_auth
node_customer -->|"updates delivery details"| node_profile
node_customer -->|"writes reviews"| node_reviewpage
node_reviewpage -->|"submits and deletes"| node_reviewsapi
node_reviewdisplay -->|"fetches reviews"| node_reviewsapi
node_reviewsapi -->|"checks session"| node_auth
node_reviewsapi -->|"loads and saves"| node_reviewstore
node_reviewstore -.->|"uses when configured"| node_redis
node_reviewdisplay -->|"renders ratings"| node_stars
node_reviewpage -->|"renders ratings"| node_stars
node_cart -->|"prompts customer"| node_dialog
node_reviewpage -->|"prompts customer"| node_dialog
node_navbar -->|"provides navigation"| node_customer

click node_home "https://github.com/fewxxt/healthy-food/blob/main/src/app/page.tsx"
click node_menu "https://github.com/fewxxt/healthy-food/blob/main/src/app/order/page.tsx"
click node_fooddata "https://github.com/fewxxt/healthy-food/blob/main/src/lib/foods.ts"
click node_foodtypes "https://github.com/fewxxt/healthy-food/blob/main/src/lib/types.ts"
click node_popular "https://github.com/fewxxt/healthy-food/blob/main/src/components/PopularMenu.tsx"
click node_navbar "https://github.com/fewxxt/healthy-food/blob/main/src/components/Navbar.tsx"
click node_footer "https://github.com/fewxxt/healthy-food/blob/main/src/components/Footer.tsx"
click node_cart "https://github.com/fewxxt/healthy-food/blob/main/src/app/cart/page.tsx"
click node_cartstate "https://github.com/fewxxt/healthy-food/blob/main/src/components/Providers.tsx"
click node_coupons "https://github.com/fewxxt/healthy-food/blob/main/src/app/coupons/page.tsx"
click node_ordersapi "https://github.com/fewxxt/healthy-food/blob/main/src/app/api/orders/route.ts"
click node_success "https://github.com/fewxxt/healthy-food/blob/main/src/app/success/page.tsx"
click node_profile "https://github.com/fewxxt/healthy-food/blob/main/src/app/profile/page.tsx"
click node_login "https://github.com/fewxxt/healthy-food/blob/main/src/app/login/page.tsx"
click node_auth "https://github.com/fewxxt/healthy-food/blob/main/src/auth.ts"
click node_authroute "https://github.com/fewxxt/healthy-food/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts"
click node_middleware "https://github.com/fewxxt/healthy-food/blob/main/src/middleware.ts"
click node_reviewpage "https://github.com/fewxxt/healthy-food/blob/main/src/app/reviews/page.tsx"
click node_reviewdisplay "https://github.com/fewxxt/healthy-food/blob/main/src/components/HomeReviews.tsx"
click node_stars "https://github.com/fewxxt/healthy-food/blob/main/src/components/Stars.tsx"
click node_dialog "https://github.com/fewxxt/healthy-food/blob/main/src/components/Dialog.tsx"
click node_reviewsapi "https://github.com/fewxxt/healthy-food/blob/main/src/app/api/reviews/route.ts"
click node_reviewstore "https://github.com/fewxxt/healthy-food/blob/main/src/app/api/reviews/route.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_home,node_menu,node_fooddata,node_foodtypes,node_popular,node_navbar,node_footer toneBlue
class node_cart,node_cartstate,node_coupons,node_ordersapi,node_success,node_dialog,node_redis toneAmber
class node_profile,node_login,node_auth,node_authroute,node_middleware toneMint
class node_reviewpage,node_reviewdisplay,node_stars,node_reviewsapi,node_reviewstore toneRose
class node_customer,node_google toneIndigo
```

## Components

### Storefront and catalog

- [Home page](https://github.com/fewxxt/healthy-food/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Menu browsing](https://github.com/fewxxt/healthy-food/blob/main/src/app/order/page.tsx): `src/app/order/page.tsx`
- [Food catalog](https://github.com/fewxxt/healthy-food/blob/main/src/lib/foods.ts): `src/lib/foods.ts`
- [Food types](https://github.com/fewxxt/healthy-food/blob/main/src/lib/types.ts): `src/lib/types.ts`
- [Popular menu](https://github.com/fewxxt/healthy-food/blob/main/src/components/PopularMenu.tsx): `src/components/PopularMenu.tsx`
- [Navigation](https://github.com/fewxxt/healthy-food/blob/main/src/components/Navbar.tsx): `src/components/Navbar.tsx`
- [Footer](https://github.com/fewxxt/healthy-food/blob/main/src/components/Footer.tsx): `src/components/Footer.tsx`

### Cart and ordering

- [Cart and checkout](https://github.com/fewxxt/healthy-food/blob/main/src/app/cart/page.tsx): `src/app/cart/page.tsx`
- [Cart state](https://github.com/fewxxt/healthy-food/blob/main/src/components/Providers.tsx): `src/components/Providers.tsx`
- [Coupon collection](https://github.com/fewxxt/healthy-food/blob/main/src/app/coupons/page.tsx): `src/app/coupons/page.tsx`
- [Order API](https://github.com/fewxxt/healthy-food/blob/main/src/app/api/orders/route.ts): `src/app/api/orders/route.ts`
- [Order confirmation](https://github.com/fewxxt/healthy-food/blob/main/src/app/success/page.tsx): `src/app/success/page.tsx`
- [Popup dialogs](https://github.com/fewxxt/healthy-food/blob/main/src/components/Dialog.tsx): `src/components/Dialog.tsx`

### Identity and profile

- [Customer profile](https://github.com/fewxxt/healthy-food/blob/main/src/app/profile/page.tsx): `src/app/profile/page.tsx`
- [Login page](https://github.com/fewxxt/healthy-food/blob/main/src/app/login/page.tsx): `src/app/login/page.tsx`
- [Google authentication](https://github.com/fewxxt/healthy-food/blob/main/src/auth.ts): `src/auth.ts`
- [Auth route](https://github.com/fewxxt/healthy-food/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts): `src/app/api/auth/[...nextauth]/route.ts`
- [Access control](https://github.com/fewxxt/healthy-food/blob/main/src/middleware.ts): `src/middleware.ts`

### Customer reviews

- [Review page](https://github.com/fewxxt/healthy-food/blob/main/src/app/reviews/page.tsx): `src/app/reviews/page.tsx`
- [Review displays](https://github.com/fewxxt/healthy-food/blob/main/src/components/HomeReviews.tsx): `src/components/HomeReviews.tsx`
- [Star ratings](https://github.com/fewxxt/healthy-food/blob/main/src/components/Stars.tsx): `src/components/Stars.tsx`
- [Reviews API](https://github.com/fewxxt/healthy-food/blob/main/src/app/api/reviews/route.ts): `src/app/api/reviews/route.ts`
- [Review storage](https://github.com/fewxxt/healthy-food/blob/main/src/app/api/reviews/route.ts): `src/app/api/reviews/route.ts`

### Other components

- **Customer**
- **Upstash Redis**
- **Google OAuth**

## Connections

- Customer → Home page: browses (evidence: `README.md`)
- Home page → Popular menu: renders (evidence: `src/app/page.tsx`)
- Home page → Review displays: renders (evidence: `src/app/page.tsx`)
- Home page → Footer: renders (evidence: `src/app/page.tsx`)
- Home page → Menu browsing: links to (evidence: `src/app/page.tsx`)
- Menu browsing → Food catalog: reads (evidence: `src/app/order/page.tsx`)
- Food catalog → Food types: uses type (evidence: `src/lib/foods.ts`)
- Popular menu → Food catalog: reads (evidence: `src/components/PopularMenu.tsx`)
- Customer → Menu browsing: selects dishes (evidence: `README.md`)
- Customer → Cart and checkout: checks out (evidence: `README.md`)
- Menu browsing → Cart state: adds dishes (evidence: `README.md`)
- Cart and checkout → Cart state: reads and updates (evidence: `src/app/cart/page.tsx`)
- Coupon collection → Cart state: collects codes (evidence: `README.md`)
- Cart and checkout → Customer profile: requests details (evidence: `src/app/cart/page.tsx`)
- Cart and checkout → Order API: submits order (evidence: `src/app/cart/page.tsx`)
- Order API → Google authentication: checks session (evidence: `src/app/api/orders/route.ts`)
- Cart and checkout → Order confirmation: routes after order (evidence: `src/app/cart/page.tsx`)
- Order confirmation → Customer: shows progress (evidence: `README.md`)
- Customer → Login page: signs in (evidence: `README.md`)
- Login page → Google authentication: starts sign-in
- Auth route → Google authentication: uses handlers (evidence: `src/app/api/auth/[...nextauth]/route.ts`)
- Google authentication → Google OAuth: authenticates with (evidence: `src/auth.ts`)
- Access control → Google authentication: checks access (evidence: `src/middleware.ts`)
- Customer → Customer profile: updates delivery details (evidence: `README.md`)
- Customer → Review page: writes reviews (evidence: `README.md`)
- Review page → Reviews API: submits and deletes (evidence: `src/app/reviews/page.tsx`)
- Review displays → Reviews API: fetches reviews (evidence: `src/components/HomeReviews.tsx`)
- Reviews API → Google authentication: checks session (evidence: `src/app/api/reviews/route.ts`)
- Reviews API → Review storage: loads and saves (evidence: `src/app/api/reviews/route.ts`)
- Review storage → Upstash Redis: uses when configured (evidence: `src/app/api/reviews/route.ts`)
- Review displays → Star ratings: renders ratings (evidence: `src/components/HomeReviews.tsx`)
- Review page → Star ratings: renders ratings (evidence: `src/app/reviews/page.tsx`)
- Cart and checkout → Popup dialogs: prompts customer (evidence: `src/app/cart/page.tsx`)
- Review page → Popup dialogs: prompts customer (evidence: `src/app/reviews/page.tsx`)
- Navigation → Customer: provides navigation (evidence: `README.md`)
