# vijayb1209/petpuja architecture

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

- Interactive diagram: https://gitdiagram.com/vijayb1209/petpuja
- Repository: https://github.com/vijayb1209/petpuja

## Overview

PetPuja is a single-restaurant ordering platform spanning customer, admin, and rider portals. Customers browse and recommend dishes, build a cart, then submit an order with delivery location and on-delivery payment; the server validates pricing and persists it. Staff manage menu/settings and order status, while riders share location and customers follow order updates and rate delivery. The README documents these capabilities, but the UI is a single unsampled HTML file and server excerpts are partial, so UI-to-API wiring and several specific server stages are not mapped beyond documented relationships.

Main entry points: [`public/index.html`](https://github.com/vijayb1209/petpuja/blob/main/public/index.html) (Customer and staff portals), [`server.js`](https://github.com/vijayb1209/petpuja/blob/main/server.js) (Order lifecycle), [`chat.js`](https://github.com/vijayb1209/petpuja/blob/main/chat.js) (Chat assistant)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer experience"]
  node_web["Customer and staff portals<br/>[index.html]"]
  node_discovery["Menu and recommendations<br/>[server.js]"]
  node_cart["Cart and checkout<br/>[index.html]"]
  node_chat["Chat assistant<br/>[chat.js]"]
end

subgraph group_operations["Restaurant operations"]
  node_admin["Menu and settings management<br/>[server.js]"]
end

subgraph group_fulfillment["Order fulfillment"]
  node_orders["Order lifecycle<br/>[server.js]"]
  node_pricing["Pricing and delivery rules<br/>[server.js]"]
  node_tracking["Live delivery tracking<br/>[server.js]"]
  node_reviews["Ratings and reviews<br/>[server.js]"]
end

subgraph group_platform["Platform services"]
  node_auth["Login and role checks<br/>[server.js]"]
  node_api["HTTP API and event dispatch<br/>[server.js]"]
  node_sqlite[("SQLite state<br/>[server.js]")]
end

node_shopper(("Customer"))
node_staff(("Admin staff"))
node_rider(("Rider"))
node_claude["Anthropic Claude API"]

node_shopper -->|"uses"| node_web
node_staff -->|"uses"| node_web
node_rider -->|"uses"| node_web
node_web -.->|"browses"| node_discovery
node_web -.->|"checks out"| node_cart
node_cart -.->|"submits order"| node_orders
node_orders -.->|"recalculates totals"| node_pricing
node_web -->|"offers assistant"| node_chat
node_api -->|"handles chat"| node_chat
node_chat -->|"gets recommendations"| node_discovery
node_chat -.->|"requests tools"| node_claude
node_claude -.->|"returns tool calls"| node_chat
node_staff -.->|"manages menu"| node_admin
node_staff -.->|"updates status"| node_orders
node_rider -.->|"posts location"| node_tracking
node_orders -.->|"publishes updates"| node_tracking
node_tracking -.->|"streams updates"| node_web
node_shopper -.->|"rates delivery"| node_reviews
node_api -->|"checks roles"| node_auth
node_api -->|"reads and writes"| node_sqlite
node_orders -.->|"persists orders"| node_sqlite
node_admin -.->|"stores settings"| node_sqlite

click node_web "https://github.com/vijayb1209/petpuja/blob/main/public/index.html"
click node_discovery "https://github.com/vijayb1209/petpuja/blob/main/server.js"
click node_cart "https://github.com/vijayb1209/petpuja/blob/main/public/index.html"
click node_chat "https://github.com/vijayb1209/petpuja/blob/main/chat.js"
click node_orders "https://github.com/vijayb1209/petpuja/blob/main/server.js"
click node_pricing "https://github.com/vijayb1209/petpuja/blob/main/server.js"
click node_tracking "https://github.com/vijayb1209/petpuja/blob/main/server.js"
click node_reviews "https://github.com/vijayb1209/petpuja/blob/main/server.js"
click node_admin "https://github.com/vijayb1209/petpuja/blob/main/server.js"
click node_auth "https://github.com/vijayb1209/petpuja/blob/main/server.js"
click node_api "https://github.com/vijayb1209/petpuja/blob/main/server.js"
click node_sqlite "https://github.com/vijayb1209/petpuja/blob/main/server.js"

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_web,node_discovery,node_cart,node_chat toneBlue
class node_admin toneAmber
class node_orders,node_pricing,node_tracking,node_reviews,node_claude toneMint
class node_auth,node_api,node_sqlite toneRose
class node_shopper,node_staff,node_rider toneIndigo
```

## Components

### Customer experience

- [Customer and staff portals](https://github.com/vijayb1209/petpuja/blob/main/public/index.html): `public/index.html`
- [Menu and recommendations](https://github.com/vijayb1209/petpuja/blob/main/server.js): `server.js`
- [Cart and checkout](https://github.com/vijayb1209/petpuja/blob/main/public/index.html): `public/index.html`
- [Chat assistant](https://github.com/vijayb1209/petpuja/blob/main/chat.js): `chat.js`

### Restaurant operations

- [Menu and settings management](https://github.com/vijayb1209/petpuja/blob/main/server.js): `server.js`

### Order fulfillment

- [Order lifecycle](https://github.com/vijayb1209/petpuja/blob/main/server.js): `server.js`
- [Pricing and delivery rules](https://github.com/vijayb1209/petpuja/blob/main/server.js): `server.js`
- [Live delivery tracking](https://github.com/vijayb1209/petpuja/blob/main/server.js): `server.js`
- [Ratings and reviews](https://github.com/vijayb1209/petpuja/blob/main/server.js): `server.js`

### Platform services

- [Login and role checks](https://github.com/vijayb1209/petpuja/blob/main/server.js): `server.js`
- [HTTP API and event dispatch](https://github.com/vijayb1209/petpuja/blob/main/server.js): `server.js`
- [SQLite state](https://github.com/vijayb1209/petpuja/blob/main/server.js): `server.js`

### Other components

- **Customer**
- **Admin staff**
- **Rider**
- **Anthropic Claude API**

## Connections

- Customer → Customer and staff portals: uses (evidence: `README.md`)
- Admin staff → Customer and staff portals: uses (evidence: `README.md`)
- Rider → Customer and staff portals: uses (evidence: `README.md`)
- Customer and staff portals → Menu and recommendations: browses (evidence: `README.md`)
- Customer and staff portals → Cart and checkout: checks out (evidence: `README.md`)
- Cart and checkout → Order lifecycle: submits order (evidence: `README.md`)
- Order lifecycle → Pricing and delivery rules: recalculates totals (evidence: `README.md`)
- Customer and staff portals → Chat assistant: offers assistant (evidence: `README.md`)
- HTTP API and event dispatch → Chat assistant: handles chat (evidence: `server.js`)
- Chat assistant → Menu and recommendations: gets recommendations (evidence: `server.js`)
- Chat assistant → Anthropic Claude API: requests tools (evidence: `chat.js`)
- Anthropic Claude API → Chat assistant: returns tool calls (evidence: `chat.js`)
- Admin staff → Menu and settings management: manages menu (evidence: `README.md`)
- Admin staff → Order lifecycle: updates status (evidence: `README.md`)
- Rider → Live delivery tracking: posts location (evidence: `README.md`)
- Order lifecycle → Live delivery tracking: publishes updates (evidence: `README.md`)
- Live delivery tracking → Customer and staff portals: streams updates (evidence: `README.md`)
- Customer → Ratings and reviews: rates delivery (evidence: `README.md`)
- HTTP API and event dispatch → Login and role checks: checks roles (evidence: `server.js`)
- HTTP API and event dispatch → SQLite state: reads and writes (evidence: `server.js`)
- Order lifecycle → SQLite state: persists orders (evidence: `README.md`)
- Menu and settings management → SQLite state: stores settings (evidence: `README.md`)
