# arafat-shaikh/food-app-nextjs architecture

> Architecture diagram of the GitHub repository arafat-shaikh/food-app-nextjs, 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/arafat-shaikh/food-app-nextjs
- Repository: https://github.com/arafat-shaikh/food-app-nextjs

## Overview

NextEat is a food-ordering application: customers browse and filter food listings, open an item, add it to a cart, choose a delivery address, pay through Stripe, and view order history. The graph separates browsing, cart and address management, checkout, and account/order capabilities, with Prisma as the shared persistence layer. API and client excerpts support the shown request and payment paths; several page loaders and API routes are unsampled, so their internal wiring is not inferred.

Main entry points: [`app/libs/prismadb.ts`](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/libs/prismadb.ts) (Prisma database), [`app/cart/CartClientPage.tsx`](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/cart/CartClientPage.tsx) (Cart page), [`app/api/user/checkout/route.ts`](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/api/user/checkout/route.ts) (Checkout API), [`app/api/cart/route.ts`](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/api/cart/route.ts) (Cart API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browse["Food browsing"]
  node_home["Home page<br/>[page.tsx]"]
  node_catalog["Catalog filters<br/>[HomeClient.tsx]"]
  node_listing_actions["Listing queries<br/>[getFoodListings.ts]"]
  node_item_page["Item page<br/>[ItemPageClient.tsx]"]
  node_item_query["Item lookup<br/>[getItemById.ts]"]
end

subgraph group_cart["Cart and delivery"]
  node_cart_page["Cart page<br/>[CartClientPage.tsx]"]
  node_cart_api["Cart API<br/>[route.ts]"]
  node_cart_query["Cart query<br/>[getCartItems.ts]"]
  node_address_api["Address API<br/>[route.ts]"]
  node_address_query["Address query<br/>[getUserAddress.ts]"]
  node_address_modal["Address dialog"]
end

subgraph group_checkout["Checkout and payment"]
  node_checkout_api["Checkout API<br/>[route.ts]"]
  node_stripe_lib["Stripe client<br/>[stripe.ts]"]
  node_stripe["Stripe"]
  node_webhook["Payment webhook<br/>[route.ts]"]
end

subgraph group_account["Accounts and orders"]
  node_orders_page["Order history"]
  node_orders_query["Order query<br/>[getAllOrders.ts]"]
  node_order_api["Order API<br/>[route.ts]"]
  node_register_api["Registration API<br/>[route.ts]"]
  node_auth_api["Authentication<br/>[&#91;...nextauth&#93;.ts]"]
end

subgraph group_runtime["Application runtime"]
  node_current_user["Current user<br/>[getCurrentUser.ts]"]
  node_database[("Prisma database<br/>[prismadb.ts]")]
end

node_customer(("Customer"))

node_customer -->|"opens"| node_home
node_home -->|"renders"| node_catalog
node_catalog -->|"displays listings"| node_listing_actions
node_customer -->|"opens item"| node_item_page
node_item_page -->|"adds item"| node_cart_api
node_customer -->|"opens cart"| node_cart_page
node_cart_page -->|"updates cart"| node_cart_api
node_cart_page -->|"selects address"| node_address_api
node_cart_page -->|"starts checkout"| node_checkout_api
node_cart_page -->|"deletes canceled order"| node_order_api
node_address_modal -->|"submits address"| node_address_api
node_customer -->|"views orders"| node_orders_page
node_customer -->|"registers"| node_register_api
node_customer -->|"authenticates"| node_auth_api
node_cart_api -->|"gets user"| node_current_user
node_address_api -->|"gets user"| node_current_user
node_checkout_api -->|"gets user"| node_current_user
node_order_api -->|"gets user"| node_current_user
node_cart_api -->|"reads and writes cart"| node_database
node_address_api -->|"reads and writes addresses"| node_database
node_register_api -->|"creates user"| node_database
node_checkout_api -->|"creates order"| node_database
node_checkout_api -->|"creates session"| node_stripe_lib
node_stripe_lib -->|"calls API"| node_stripe
node_stripe -->|"sends event"| node_webhook
node_webhook -->|"verifies event"| node_stripe_lib
node_webhook -->|"marks order paid"| node_database
node_order_api -->|"deletes order"| node_database

click node_home "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/page.tsx"
click node_catalog "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/components/HomeClient.tsx"
click node_listing_actions "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/actions/getFoodListings.ts"
click node_item_page "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/item/%5BitemId%5D/ItemPageClient.tsx"
click node_item_query "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/actions/getItemById.ts"
click node_cart_page "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/cart/CartClientPage.tsx"
click node_cart_api "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/api/cart/route.ts"
click node_cart_query "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/actions/getCartItems.ts"
click node_address_api "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/api/user/address/route.ts"
click node_address_query "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/actions/getUserAddress.ts"
click node_address_modal "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/components/UserAddressModal.tsx"
click node_checkout_api "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/api/user/checkout/route.ts"
click node_stripe_lib "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/libs/stripe.ts"
click node_webhook "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/api/webhook/route.ts"
click node_orders_page "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/order/OrdersClientPage.tsx"
click node_orders_query "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/actions/getAllOrders.ts"
click node_order_api "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/api/user/order/%5BorderId%5D/route.ts"
click node_register_api "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/api/register/route.ts"
click node_auth_api "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/pages/api/auth/%5B...nextauth%5D.ts"
click node_current_user "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/actions/getCurrentUser.ts"
click node_database "https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/libs/prismadb.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_catalog,node_listing_actions,node_item_page,node_item_query toneBlue
class node_cart_page,node_cart_api,node_cart_query,node_address_api,node_address_query,node_address_modal toneAmber
class node_checkout_api,node_stripe_lib,node_stripe,node_webhook toneMint
class node_orders_page,node_orders_query,node_order_api,node_register_api,node_auth_api toneRose
class node_current_user,node_database,node_customer toneIndigo
```

## Components

### Food browsing

- [Home page](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/page.tsx): `app/page.tsx`
- [Catalog filters](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/components/HomeClient.tsx): `app/components/HomeClient.tsx`
- [Listing queries](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/actions/getFoodListings.ts): `app/actions/getFoodListings.ts`
- [Item page](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/item/%5BitemId%5D/ItemPageClient.tsx): `app/item/[itemId]/ItemPageClient.tsx`
- [Item lookup](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/actions/getItemById.ts): `app/actions/getItemById.ts`

### Cart and delivery

- [Cart page](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/cart/CartClientPage.tsx): `app/cart/CartClientPage.tsx`
- [Cart API](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/api/cart/route.ts): `app/api/cart/route.ts`
- [Cart query](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/actions/getCartItems.ts): `app/actions/getCartItems.ts`
- [Address API](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/api/user/address/route.ts): `app/api/user/address/route.ts`
- [Address query](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/actions/getUserAddress.ts): `app/actions/getUserAddress.ts`
- [Address dialog](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/components/UserAddressModal.tsx): `app/components/UserAddressModal.tsx`

### Checkout and payment

- [Checkout API](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/api/user/checkout/route.ts): `app/api/user/checkout/route.ts`
- [Stripe client](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/libs/stripe.ts): `app/libs/stripe.ts`
- **Stripe**
- [Payment webhook](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/api/webhook/route.ts): `app/api/webhook/route.ts`

### Accounts and orders

- [Order history](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/order/OrdersClientPage.tsx): `app/order/OrdersClientPage.tsx`
- [Order query](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/actions/getAllOrders.ts): `app/actions/getAllOrders.ts`
- [Order API](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/api/user/order/%5BorderId%5D/route.ts): `app/api/user/order/[orderId]/route.ts`
- [Registration API](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/api/register/route.ts): `app/api/register/route.ts`
- [Authentication](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/pages/api/auth/%5B...nextauth%5D.ts): `pages/api/auth/[...nextauth].ts`

### Application runtime

- [Current user](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/actions/getCurrentUser.ts): `app/actions/getCurrentUser.ts`
- [Prisma database](https://github.com/arafat-shaikh/food-app-nextjs/blob/main/app/libs/prismadb.ts): `app/libs/prismadb.ts`

### Other components

- **Customer**

## Connections

- Customer → Home page: opens
- Home page → Catalog filters: renders
- Catalog filters → Listing queries: displays listings
- Customer → Item page: opens item
- Item page → Cart API: adds item
- Customer → Cart page: opens cart
- Cart page → Cart API: updates cart
- Cart page → Address API: selects address
- Cart page → Checkout API: starts checkout
- Cart page → Order API: deletes canceled order
- Address dialog → Address API: submits address
- Customer → Order history: views orders
- Customer → Registration API: registers
- Customer → Authentication: authenticates
- Cart API → Current user: gets user
- Address API → Current user: gets user
- Checkout API → Current user: gets user
- Order API → Current user: gets user
- Cart API → Prisma database: reads and writes cart
- Address API → Prisma database: reads and writes addresses
- Registration API → Prisma database: creates user
- Checkout API → Prisma database: creates order
- Checkout API → Stripe client: creates session
- Stripe client → Stripe: calls API
- Stripe → Payment webhook: sends event
- Payment webhook → Stripe client: verifies event
- Payment webhook → Prisma database: marks order paid
- Order API → Prisma database: deletes order
