# mkmathepe/chillpiperentapp architecture

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

- Interactive diagram: https://gitdiagram.com/mkmathepe/chillpiperentapp
- Repository: https://github.com/mkmathepe/chillpiperentapp

## Overview

This is a hookah-rental booking and operations application. Customers configure a rental, check out, and track booking status; staff manage requests and inventory through an admin dashboard. The source index and excerpts support the main API-to-domain-helper and admin flows, but do not show all client-side request wiring, so those links are omitted. The README is empty, and several listed subsystems are represented only by their exact source paths.

Main entry points: [`app/api/bookings/route.ts`](https://github.com/mkmathepe/chillpiperentapp/blob/main/app/api/bookings/route.ts) (Booking API), [`app/api/admin/bookings/route.ts`](https://github.com/mkmathepe/chillpiperentapp/blob/main/app/api/admin/bookings/route.ts) (Admin bookings API), [`db/index.ts`](https://github.com/mkmathepe/chillpiperentapp/blob/main/db/index.ts) (Application database), [`lib/inventory-server.ts`](https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/inventory-server.ts) (Inventory service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer rental"]
  node_home["Rental storefront<br/>[page.tsx]"]
  node_checkout["Checkout<br/>[page.tsx]"]
  node_tracking["Booking tracking<br/>[page.tsx]"]
  node_header["Customer header<br/>[app-header.tsx]"]
end

subgraph group_booking["Booking services"]
  node_booking_api["Booking API<br/>[route.ts]"]
  node_pricing["Rental pricing<br/>[booking-pricing.ts]"]
  node_rental_prices["Price hook"]
  node_handoff["Booking handoff<br/>[booking-handoff.ts]"]
  node_delivery_quote["Delivery quote API<br/>[route.ts]"]
  node_delivery_quotes["Quote verification<br/>[delivery-quotes.ts]"]
  node_expiry["Booking expiry<br/>[booking-expiry.ts]"]
  node_inventory_server["Inventory service"]
  node_inventory_rules["Inventory rules<br/>[inventory.ts]"]
  node_payment_methods["Payment methods<br/>[payment-methods.ts]"]
end

subgraph group_operations["Admin operations"]
  node_admin_dashboard["Admin dashboard<br/>[page.tsx]"]
  node_admin_inventory_ui["Inventory dashboard<br/>[inventory.tsx]"]
  node_admin_performance_ui["Performance dashboard<br/>[performance.tsx]"]
  node_performance["Performance metrics<br/>[performance.ts]"]
  node_admin_bookings_api["Admin bookings API<br/>[route.ts]"]
  node_admin_inventory_api["Admin inventory API<br/>[route.ts]"]
  node_admin_booking_logic["Booking transitions<br/>[admin-bookings.ts]"]
  node_admin_login_api["Admin login API<br/>[route.ts]"]
  node_admin_auth["Admin authentication<br/>[admin-auth.ts]"]
end

subgraph group_platform["Persistence and identity"]
  node_database[("Application database<br/>[index.ts]")]
end

node_customer(("Customer"))
node_delivery_service["Geocoding service"]
node_identity["Supabase identity"]

node_customer -->|"browses rentals"| node_home
node_checkout -->|"loads prices"| node_rental_prices
node_checkout -->|"saves handoff"| node_handoff
node_tracking -->|"reads handoff"| node_handoff
node_home -->|"uses header"| node_header
node_checkout -->|"uses header"| node_header
node_booking_api -->|"prices booking"| node_pricing
node_booking_api -->|"verifies quote"| node_delivery_quotes
node_booking_api -->|"expires pending"| node_expiry
node_booking_api -->|"loads prices"| node_inventory_server
node_booking_api -->|"validates method"| node_payment_methods
node_delivery_quote -->|"stores quote"| node_database
node_delivery_quote -.->|"geocodes address"| node_delivery_service
node_inventory_server -->|"reads inventory"| node_database
node_inventory_server -->|"uses rental rules"| node_inventory_rules
node_rental_prices -->|"uses price defaults"| node_pricing
node_admin_dashboard -->|"uses booking data"| node_admin_booking_logic
node_admin_dashboard -->|"renders inventory"| node_admin_inventory_ui
node_admin_dashboard -->|"renders metrics"| node_admin_performance_ui
node_admin_performance_ui -->|"loads metrics"| node_performance
node_admin_bookings_api -->|"verifies admin"| node_admin_auth
node_admin_bookings_api -->|"transitions booking"| node_admin_booking_logic
node_admin_bookings_api -->|"checks stock"| node_inventory_server
node_admin_bookings_api -->|"expires pending"| node_expiry
node_admin_bookings_api -->|"reads and writes"| node_database
node_admin_inventory_api -->|"verifies admin"| node_admin_auth
node_admin_inventory_api -->|"updates inventory"| node_inventory_server
node_admin_inventory_api -->|"writes stock"| node_database
node_admin_login_api -->|"uses auth"| node_admin_auth
node_admin_login_api -->|"stores session"| node_database
node_admin_auth -->|"checks sessions"| node_database
node_admin_auth -->|"checks user"| node_identity

click node_home "https://github.com/mkmathepe/chillpiperentapp/blob/main/app/page.tsx"
click node_checkout "https://github.com/mkmathepe/chillpiperentapp/blob/main/app/checkout/page.tsx"
click node_tracking "https://github.com/mkmathepe/chillpiperentapp/blob/main/app/track/page.tsx"
click node_header "https://github.com/mkmathepe/chillpiperentapp/blob/main/components/app-header.tsx"
click node_booking_api "https://github.com/mkmathepe/chillpiperentapp/blob/main/app/api/bookings/route.ts"
click node_pricing "https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/booking-pricing.ts"
click node_rental_prices "https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/use-rental-prices.ts"
click node_handoff "https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/booking-handoff.ts"
click node_delivery_quote "https://github.com/mkmathepe/chillpiperentapp/blob/main/app/api/delivery-quote/route.ts"
click node_delivery_quotes "https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/delivery-quotes.ts"
click node_expiry "https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/booking-expiry.ts"
click node_inventory_server "https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/inventory-server.ts"
click node_inventory_rules "https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/inventory.ts"
click node_payment_methods "https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/payment-methods.ts"
click node_admin_dashboard "https://github.com/mkmathepe/chillpiperentapp/blob/main/app/admin-preview/page.tsx"
click node_admin_inventory_ui "https://github.com/mkmathepe/chillpiperentapp/blob/main/app/admin-preview/inventory.tsx"
click node_admin_performance_ui "https://github.com/mkmathepe/chillpiperentapp/blob/main/app/admin-preview/performance.tsx"
click node_performance "https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/performance.ts"
click node_admin_bookings_api "https://github.com/mkmathepe/chillpiperentapp/blob/main/app/api/admin/bookings/route.ts"
click node_admin_inventory_api "https://github.com/mkmathepe/chillpiperentapp/blob/main/app/api/admin/inventory/route.ts"
click node_admin_booking_logic "https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/admin-bookings.ts"
click node_admin_login_api "https://github.com/mkmathepe/chillpiperentapp/blob/main/app/api/admin/auth/login/route.ts"
click node_admin_auth "https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/admin-auth.ts"
click node_database "https://github.com/mkmathepe/chillpiperentapp/blob/main/db/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_home,node_checkout,node_tracking,node_header toneBlue
class node_booking_api,node_pricing,node_rental_prices,node_handoff,node_delivery_quote,node_delivery_quotes,node_expiry,node_inventory_server,node_inventory_rules,node_payment_methods toneAmber
class node_admin_dashboard,node_admin_inventory_ui,node_admin_performance_ui,node_performance,node_admin_bookings_api,node_admin_inventory_api,node_admin_booking_logic,node_admin_login_api,node_admin_auth toneMint
class node_database toneRose
class node_customer,node_delivery_service,node_identity toneIndigo
```

## Components

### Customer rental

- [Rental storefront](https://github.com/mkmathepe/chillpiperentapp/blob/main/app/page.tsx): `app/page.tsx`
- [Checkout](https://github.com/mkmathepe/chillpiperentapp/blob/main/app/checkout/page.tsx): `app/checkout/page.tsx`
- [Booking tracking](https://github.com/mkmathepe/chillpiperentapp/blob/main/app/track/page.tsx): `app/track/page.tsx`
- [Customer header](https://github.com/mkmathepe/chillpiperentapp/blob/main/components/app-header.tsx): `components/app-header.tsx`

### Booking services

- [Booking API](https://github.com/mkmathepe/chillpiperentapp/blob/main/app/api/bookings/route.ts): `app/api/bookings/route.ts`
- [Rental pricing](https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/booking-pricing.ts): `lib/booking-pricing.ts`
- [Price hook](https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/use-rental-prices.ts): `lib/use-rental-prices.ts`
- [Booking handoff](https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/booking-handoff.ts): `lib/booking-handoff.ts`
- [Delivery quote API](https://github.com/mkmathepe/chillpiperentapp/blob/main/app/api/delivery-quote/route.ts): `app/api/delivery-quote/route.ts`
- [Quote verification](https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/delivery-quotes.ts): `lib/delivery-quotes.ts`
- [Booking expiry](https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/booking-expiry.ts): `lib/booking-expiry.ts`
- [Inventory service](https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/inventory-server.ts): `lib/inventory-server.ts`
- [Inventory rules](https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/inventory.ts): `lib/inventory.ts`
- [Payment methods](https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/payment-methods.ts): `lib/payment-methods.ts`

### Admin operations

- [Admin dashboard](https://github.com/mkmathepe/chillpiperentapp/blob/main/app/admin-preview/page.tsx): `app/admin-preview/page.tsx`
- [Inventory dashboard](https://github.com/mkmathepe/chillpiperentapp/blob/main/app/admin-preview/inventory.tsx): `app/admin-preview/inventory.tsx`
- [Performance dashboard](https://github.com/mkmathepe/chillpiperentapp/blob/main/app/admin-preview/performance.tsx): `app/admin-preview/performance.tsx`
- [Performance metrics](https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/performance.ts): `lib/performance.ts`
- [Admin bookings API](https://github.com/mkmathepe/chillpiperentapp/blob/main/app/api/admin/bookings/route.ts): `app/api/admin/bookings/route.ts`
- [Admin inventory API](https://github.com/mkmathepe/chillpiperentapp/blob/main/app/api/admin/inventory/route.ts): `app/api/admin/inventory/route.ts`
- [Booking transitions](https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/admin-bookings.ts): `lib/admin-bookings.ts`
- [Admin login API](https://github.com/mkmathepe/chillpiperentapp/blob/main/app/api/admin/auth/login/route.ts): `app/api/admin/auth/login/route.ts`
- [Admin authentication](https://github.com/mkmathepe/chillpiperentapp/blob/main/lib/admin-auth.ts): `lib/admin-auth.ts`

### Persistence and identity

- [Application database](https://github.com/mkmathepe/chillpiperentapp/blob/main/db/index.ts): `db/index.ts`

### Other components

- **Customer**
- **Geocoding service**
- **Supabase identity**

## Connections

- Customer → Rental storefront: browses rentals
- Checkout → Price hook: loads prices (evidence: `app/checkout/page.tsx`)
- Checkout → Booking handoff: saves handoff (evidence: `app/checkout/page.tsx`)
- Booking tracking → Booking handoff: reads handoff (evidence: `app/track/page.tsx`)
- Rental storefront → Customer header: uses header (evidence: `app/page.tsx`)
- Checkout → Customer header: uses header (evidence: `app/checkout/page.tsx`)
- Booking API → Rental pricing: prices booking (evidence: `app/api/bookings/route.ts`)
- Booking API → Quote verification: verifies quote (evidence: `app/api/bookings/route.ts`)
- Booking API → Booking expiry: expires pending (evidence: `app/api/bookings/route.ts`)
- Booking API → Inventory service: loads prices (evidence: `app/api/bookings/route.ts`)
- Booking API → Payment methods: validates method (evidence: `app/api/bookings/route.ts`)
- Delivery quote API → Application database: stores quote (evidence: `app/api/delivery-quote/route.ts`)
- Delivery quote API → Geocoding service: geocodes address
- Inventory service → Application database: reads inventory (evidence: `lib/inventory-server.ts`)
- Inventory service → Inventory rules: uses rental rules (evidence: `lib/inventory-server.ts`)
- Price hook → Rental pricing: uses price defaults (evidence: `lib/use-rental-prices.ts`)
- Admin dashboard → Booking transitions: uses booking data (evidence: `app/admin-preview/page.tsx`)
- Admin dashboard → Inventory dashboard: renders inventory (evidence: `app/admin-preview/page.tsx`)
- Admin dashboard → Performance dashboard: renders metrics (evidence: `app/admin-preview/page.tsx`)
- Performance dashboard → Performance metrics: loads metrics (evidence: `app/admin-preview/performance.tsx`)
- Admin bookings API → Admin authentication: verifies admin (evidence: `app/api/admin/bookings/route.ts`)
- Admin bookings API → Booking transitions: transitions booking (evidence: `app/api/admin/bookings/route.ts`)
- Admin bookings API → Inventory service: checks stock (evidence: `app/api/admin/bookings/route.ts`)
- Admin bookings API → Booking expiry: expires pending (evidence: `app/api/admin/bookings/route.ts`)
- Admin bookings API → Application database: reads and writes (evidence: `app/api/admin/bookings/route.ts`)
- Admin inventory API → Admin authentication: verifies admin (evidence: `app/api/admin/inventory/route.ts`)
- Admin inventory API → Inventory service: updates inventory (evidence: `app/api/admin/inventory/route.ts`)
- Admin inventory API → Application database: writes stock (evidence: `app/api/admin/inventory/route.ts`)
- Admin login API → Admin authentication: uses auth (evidence: `app/api/admin/auth/login/route.ts`)
- Admin login API → Application database: stores session (evidence: `app/api/admin/auth/login/route.ts`)
- Admin authentication → Application database: checks sessions (evidence: `lib/admin-auth.ts`)
- Admin authentication → Supabase identity: checks user (evidence: `lib/admin-auth.ts`)
