# omiguelwnl/b7-delivery architecture

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

- Interactive diagram: https://gitdiagram.com/omiguelwnl/b7-delivery
- Repository: https://github.com/omiguelwnl/b7-delivery

## Overview

B7Delivery is a multi-tenant restaurant storefront. The customer journey spans browsing products, building a cart, signing in, managing delivery addresses, checking out, and viewing orders. Pages use a tenant-scoped API helper, while app and auth contexts hold shared state. The API excerpt returns temporary sample data rather than showing a persistent store or external payment integration. Connections among unsampled routes and services are limited to README descriptions and SOURCE INDEX references.

Main entry points: [`libs/useApi.ts`](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/libs/useApi.ts) (Tenant API Helper), [`pages/[tenant]/checkout.tsx`](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/checkout.tsx) (Checkout), [`pages/[tenant]/index.tsx`](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/index.tsx) (Promotions & Products), [`pages/[tenant]/product/[id].tsx`](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/product/%5Bid%5D.tsx) (Product Details)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_home["Promotions &amp; Products<br/>[index.tsx]"]
  node_product["Product Details<br/>[&#91;id&#93;.tsx]"]
  node_product_model["Product Model<br/>[Product.ts]"]
end

subgraph group_purchase["Purchase Flow"]
  node_cart["Shopping Cart<br/>[cart.tsx]"]
  node_cart_item["Cart Items<br/>[CartItem.ts]"]
  node_checkout["Checkout<br/>[checkout.tsx]"]
  node_order_model["Order Model<br/>[Order.ts]"]
  node_order_list["Order History<br/>[pedidos.tsx]"]
  node_order_detail["Order Details<br/>[&#91;orderid&#93;.tsx]"]
end

subgraph group_identity["Account &amp; Addresses"]
  node_login["Login<br/>[login.tsx]"]
  node_signup["Sign Up<br/>[signup.tsx]"]
  node_forgot_password["Password Recovery<br/>[forget.tsx]"]
  node_recovery_success["Recovery Confirmation<br/>[forget-success.tsx]"]
  node_address_list["Saved Addresses<br/>[myaddresses.tsx]"]
  node_address_new["Add Address<br/>[new.tsx]"]
  node_address_edit["Edit Address<br/>[&#91;addressid&#93;.tsx]"]
  node_address_model["Address Model<br/>[Address.ts]"]
end

subgraph group_shared["Shared Runtime"]
  node_api["Tenant API Helper<br/>[useApi.ts]"]
  node_app_state["Tenant &amp; Delivery State"]
  node_auth_state["Authentication State"]
  node_user_model["User Model<br/>[User.ts]"]
  node_cart_cookie["Cart Cookie Format<br/>[CartCookie.ts]"]
  node_formatter["Display Formatting<br/>[useFormatter.ts]"]
  node_app_shell["Application Providers<br/>[_app.tsx]"]
end

node_customer(("Customer"))

node_customer -->|"browses"| node_home
node_customer -->|"views"| node_product
node_customer -->|"manages"| node_cart
node_customer -->|"checks out"| node_checkout
node_customer -->|"signs in"| node_login
node_customer -->|"registers"| node_signup
node_customer -->|"manages"| node_address_list
node_customer -->|"adds"| node_address_new
node_customer -->|"views history"| node_order_list
node_customer -->|"views order"| node_order_detail
node_home -->|"loads products"| node_api
node_home -->|"uses tenant state"| node_app_state
node_home -->|"uses product data"| node_product_model
node_product -->|"loads product"| node_api
node_product -->|"uses cart format"| node_cart_cookie
node_product -->|"uses product data"| node_product_model
node_cart -.->|"loads cart"| node_api
node_checkout -->|"submits order"| node_api
node_checkout -->|"uses user state"| node_auth_state
node_checkout -->|"uses delivery state"| node_app_state
node_checkout -->|"uses cart items"| node_cart_item
node_checkout -->|"uses cart format"| node_cart_cookie
node_checkout -->|"uses address data"| node_address_model
node_order_detail -->|"loads order"| node_api
node_order_detail -->|"uses order data"| node_order_model
node_address_list -.->|"loads addresses"| node_api
node_address_new -->|"saves address"| node_api
node_address_new -->|"uses address data"| node_address_model
node_address_edit -->|"edits address"| node_api
node_address_edit -->|"uses address data"| node_address_model
node_api -->|"returns user"| node_user_model
node_api -->|"returns products"| node_product_model
node_api -->|"returns addresses"| node_address_model
node_api -->|"returns cart items"| node_cart_item
node_api -->|"returns orders"| node_order_model
node_app_shell -->|"provides state"| node_app_state
node_app_shell -->|"provides state"| node_auth_state
node_login -.->|"uses auth state"| node_auth_state
node_signup -.->|"uses auth state"| node_auth_state
node_order_detail -->|"formats display"| node_formatter

click node_home "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/index.tsx"
click node_product "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/product/%5Bid%5D.tsx"
click node_product_model "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/types/Product.ts"
click node_cart "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/cart.tsx"
click node_cart_item "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/types/CartItem.ts"
click node_checkout "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/checkout.tsx"
click node_order_model "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/types/Order.ts"
click node_order_list "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/pedidos.tsx"
click node_order_detail "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/order/%5Borderid%5D.tsx"
click node_login "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/login.tsx"
click node_signup "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/signup.tsx"
click node_forgot_password "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/forget.tsx"
click node_recovery_success "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/forget-success.tsx"
click node_address_list "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/myaddresses.tsx"
click node_address_new "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/address/new.tsx"
click node_address_edit "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/address/%5Baddressid%5D.tsx"
click node_address_model "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/types/Address.ts"
click node_api "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/libs/useApi.ts"
click node_app_state "https://github.com/omiguelwnl/b7-delivery/tree/Monarch/contexts/app"
click node_auth_state "https://github.com/omiguelwnl/b7-delivery/tree/Monarch/contexts/auth"
click node_user_model "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/styles/User.ts"
click node_cart_cookie "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/types/CartCookie.ts"
click node_formatter "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/libs/useFormatter.ts"
click node_app_shell "https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/_app.tsx"

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_product,node_product_model toneBlue
class node_cart,node_cart_item,node_checkout,node_order_model,node_order_list,node_order_detail toneAmber
class node_login,node_signup,node_forgot_password,node_recovery_success,node_address_list,node_address_new,node_address_edit,node_address_model toneMint
class node_api,node_app_state,node_auth_state,node_user_model,node_cart_cookie,node_formatter,node_app_shell toneRose
class node_customer toneIndigo
```

## Components

### Storefront

- [Promotions & Products](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/index.tsx): `pages/[tenant]/index.tsx`
- [Product Details](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/product/%5Bid%5D.tsx): `pages/[tenant]/product/[id].tsx`
- [Product Model](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/types/Product.ts): `types/Product.ts`

### Purchase Flow

- [Shopping Cart](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/cart.tsx): `pages/[tenant]/cart.tsx`
- [Cart Items](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/types/CartItem.ts): `types/CartItem.ts`
- [Checkout](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/checkout.tsx): `pages/[tenant]/checkout.tsx`
- [Order Model](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/types/Order.ts): `types/Order.ts`
- [Order History](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/pedidos.tsx): `pages/[tenant]/pedidos.tsx`
- [Order Details](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/order/%5Borderid%5D.tsx): `pages/[tenant]/order/[orderid].tsx`

### Account & Addresses

- [Login](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/login.tsx): `pages/[tenant]/login.tsx`
- [Sign Up](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/signup.tsx): `pages/[tenant]/signup.tsx`
- [Password Recovery](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/forget.tsx): `pages/[tenant]/forget.tsx`
- [Recovery Confirmation](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/forget-success.tsx): `pages/[tenant]/forget-success.tsx`
- [Saved Addresses](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/myaddresses.tsx): `pages/[tenant]/myaddresses.tsx`
- [Add Address](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/address/new.tsx): `pages/[tenant]/address/new.tsx`
- [Edit Address](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/%5Btenant%5D/address/%5Baddressid%5D.tsx): `pages/[tenant]/address/[addressid].tsx`
- [Address Model](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/types/Address.ts): `types/Address.ts`

### Shared Runtime

- [Tenant API Helper](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/libs/useApi.ts): `libs/useApi.ts`
- [Tenant & Delivery State](https://github.com/omiguelwnl/b7-delivery/tree/Monarch/contexts/app): `contexts/app`
- [Authentication State](https://github.com/omiguelwnl/b7-delivery/tree/Monarch/contexts/auth): `contexts/auth`
- [User Model](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/styles/User.ts): `styles/User.ts`
- [Cart Cookie Format](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/types/CartCookie.ts): `types/CartCookie.ts`
- [Display Formatting](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/libs/useFormatter.ts): `libs/useFormatter.ts`
- [Application Providers](https://github.com/omiguelwnl/b7-delivery/blob/Monarch/pages/_app.tsx): `pages/_app.tsx`

### Other components

- **Customer**

## Connections

- Customer → Promotions & Products: browses (evidence: `README.md`)
- Customer → Product Details: views (evidence: `README.md`)
- Customer → Shopping Cart: manages (evidence: `README.md`)
- Customer → Checkout: checks out (evidence: `README.md`)
- Customer → Login: signs in (evidence: `README.md`)
- Customer → Sign Up: registers (evidence: `README.md`)
- Customer → Saved Addresses: manages (evidence: `README.md`)
- Customer → Add Address: adds (evidence: `README.md`)
- Customer → Order History: views history (evidence: `README.md`)
- Customer → Order Details: views order (evidence: `README.md`)
- Promotions & Products → Tenant API Helper: loads products (evidence: `pages/[tenant]/index.tsx`)
- Promotions & Products → Tenant & Delivery State: uses tenant state (evidence: `pages/[tenant]/index.tsx`)
- Promotions & Products → Product Model: uses product data (evidence: `pages/[tenant]/index.tsx`)
- Product Details → Tenant API Helper: loads product (evidence: `pages/[tenant]/product/[id].tsx`)
- Product Details → Cart Cookie Format: uses cart format (evidence: `pages/[tenant]/product/[id].tsx`)
- Product Details → Product Model: uses product data (evidence: `pages/[tenant]/product/[id].tsx`)
- Shopping Cart → Tenant API Helper: loads cart
- Checkout → Tenant API Helper: submits order (evidence: `pages/[tenant]/checkout.tsx`)
- Checkout → Authentication State: uses user state (evidence: `pages/[tenant]/checkout.tsx`)
- Checkout → Tenant & Delivery State: uses delivery state (evidence: `pages/[tenant]/checkout.tsx`)
- Checkout → Cart Items: uses cart items (evidence: `pages/[tenant]/checkout.tsx`)
- Checkout → Cart Cookie Format: uses cart format (evidence: `pages/[tenant]/checkout.tsx`)
- Checkout → Address Model: uses address data (evidence: `pages/[tenant]/checkout.tsx`)
- Order Details → Tenant API Helper: loads order (evidence: `pages/[tenant]/order/[orderid].tsx`)
- Order Details → Order Model: uses order data (evidence: `pages/[tenant]/order/[orderid].tsx`)
- Saved Addresses → Tenant API Helper: loads addresses
- Add Address → Tenant API Helper: saves address (evidence: `pages/[tenant]/address/new.tsx`)
- Add Address → Address Model: uses address data (evidence: `pages/[tenant]/address/new.tsx`)
- Edit Address → Tenant API Helper: edits address (evidence: `pages/[tenant]/address/[addressid].tsx`)
- Edit Address → Address Model: uses address data (evidence: `pages/[tenant]/address/[addressid].tsx`)
- Tenant API Helper → User Model: returns user (evidence: `libs/useApi.ts`)
- Tenant API Helper → Product Model: returns products (evidence: `libs/useApi.ts`)
- Tenant API Helper → Address Model: returns addresses (evidence: `libs/useApi.ts`)
- Tenant API Helper → Cart Items: returns cart items (evidence: `libs/useApi.ts`)
- Tenant API Helper → Order Model: returns orders (evidence: `libs/useApi.ts`)
- Application Providers → Tenant & Delivery State: provides state (evidence: `pages/_app.tsx`)
- Application Providers → Authentication State: provides state (evidence: `pages/_app.tsx`)
- Login → Authentication State: uses auth state
- Sign Up → Authentication State: uses auth state
- Order Details → Display Formatting: formats display (evidence: `pages/[tenant]/order/[orderid].tsx`)
