# sujallsh/petalpath-ai-ordering architecture

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

- Interactive diagram: https://gitdiagram.com/sujallsh/petalpath-ai-ordering
- Repository: https://github.com/sujallsh/petalpath-ai-ordering

## Overview

PetalPath is a flower-shop ordering web app with product recommendations and an AI chat assistant. Customers use the public site to browse and customize bouquets, then place orders; the Express server exposes product and order APIs backed by SQLite. The chat endpoint also handles order details and tracking/cancellation requests, and can call Hugging Face for recommendation wording. The README documents the broader shopping UI, but only the chat client source was excerpted, so specific browser-side product and bouquet interactions are not mapped.

Main entry points: [`server.js`](https://github.com/sujallsh/petalpath-ai-ordering/blob/main/server.js) (Chat workflow), [`database.js`](https://github.com/sujallsh/petalpath-ai-ordering/blob/main/database.js) (Product catalog), [`public`](https://github.com/sujallsh/petalpath-ai-ordering/tree/main/public) (Shop interface), [`public/app.js`](https://github.com/sujallsh/petalpath-ai-ordering/blob/main/public/app.js) (Chat client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Customer experience"]
  node_shop_ui["Shop interface"]
  node_chat_ui["Chat client<br/>[app.js]"]
end

subgraph group_api["Application services"]
  node_api_server["Express API<br/>[server.js]"]
  node_chat_flow["Chat workflow<br/>[server.js]"]
  node_order_flow["Order handling<br/>[server.js]"]
end

subgraph group_data["Shop data"]
  node_catalog["Product catalog<br/>[database.js]"]
  node_recommendations["Product matching<br/>[database.js]"]
  node_order_store[("Shop database<br/>[database.js]")]
end

node_customer(("Customer"))
node_hf_service["Hugging Face"]

node_customer -->|"shops and customizes"| node_shop_ui
node_customer -->|"asks assistant"| node_chat_ui
node_chat_ui -->|"POSTs chat"| node_api_server
node_shop_ui -.->|"uses shop APIs"| node_api_server
node_api_server -->|"reads products"| node_catalog
node_api_server -->|"routes orders"| node_order_flow
node_chat_flow -->|"requests matches"| node_recommendations
node_chat_flow -->|"reads products"| node_catalog
node_chat_flow -->|"creates or cancels"| node_order_flow
node_order_flow -->|"reads and writes"| node_order_store
node_catalog -->|"reads catalog"| node_order_store
node_recommendations -->|"reads products"| node_order_store
node_chat_flow -->|"requests wording"| node_hf_service

click node_shop_ui "https://github.com/sujallsh/petalpath-ai-ordering/tree/main/public"
click node_chat_ui "https://github.com/sujallsh/petalpath-ai-ordering/blob/main/public/app.js"
click node_api_server "https://github.com/sujallsh/petalpath-ai-ordering/blob/main/server.js"
click node_catalog "https://github.com/sujallsh/petalpath-ai-ordering/blob/main/database.js"
click node_recommendations "https://github.com/sujallsh/petalpath-ai-ordering/blob/main/database.js"
click node_chat_flow "https://github.com/sujallsh/petalpath-ai-ordering/blob/main/server.js"
click node_order_flow "https://github.com/sujallsh/petalpath-ai-ordering/blob/main/server.js"
click node_order_store "https://github.com/sujallsh/petalpath-ai-ordering/blob/main/database.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_shop_ui,node_chat_ui toneBlue
class node_api_server,node_chat_flow,node_order_flow toneAmber
class node_catalog,node_recommendations,node_order_store toneMint
class node_customer,node_hf_service toneIndigo
```

## Components

### Customer experience

- [Shop interface](https://github.com/sujallsh/petalpath-ai-ordering/tree/main/public): `public`
- [Chat client](https://github.com/sujallsh/petalpath-ai-ordering/blob/main/public/app.js): `public/app.js`

### Application services

- [Express API](https://github.com/sujallsh/petalpath-ai-ordering/blob/main/server.js): `server.js`
- [Chat workflow](https://github.com/sujallsh/petalpath-ai-ordering/blob/main/server.js): `server.js`
- [Order handling](https://github.com/sujallsh/petalpath-ai-ordering/blob/main/server.js): `server.js`

### Shop data

- [Product catalog](https://github.com/sujallsh/petalpath-ai-ordering/blob/main/database.js): `database.js`
- [Product matching](https://github.com/sujallsh/petalpath-ai-ordering/blob/main/database.js): `database.js`
- [Shop database](https://github.com/sujallsh/petalpath-ai-ordering/blob/main/database.js): `database.js`

### Other components

- **Customer**
- **Hugging Face**

## Connections

- Customer → Shop interface: shops and customizes (evidence: `README.md`)
- Customer → Chat client: asks assistant (evidence: `README.md`)
- Chat client → Express API: POSTs chat (evidence: `public/app.js`)
- Shop interface → Express API: uses shop APIs (evidence: `README.md`)
- Express API → Product catalog: reads products (evidence: `server.js`)
- Express API → Order handling: routes orders (evidence: `server.js`)
- Chat workflow → Product matching: requests matches (evidence: `server.js`)
- Chat workflow → Product catalog: reads products (evidence: `server.js`)
- Chat workflow → Order handling: creates or cancels (evidence: `server.js`)
- Order handling → Shop database: reads and writes (evidence: `database.js`)
- Product catalog → Shop database: reads catalog (evidence: `database.js`)
- Product matching → Shop database: reads products (evidence: `database.js`)
- Chat workflow → Hugging Face: requests wording (evidence: `server.js`)
