# mayur-web03/prv architecture

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

- Interactive diagram: https://gitdiagram.com/mayur-web03/prv
- Repository: https://github.com/mayur-web03/prv

## Overview

PRV is a bath-fittings manufacturer’s public catalogue and dealer ordering/operations platform. The user journey runs from product discovery or dealer login through typed, spoken, or image-assisted order entry, submission, staff review and decisions, then dispatch and delivery with status history. The graph also includes public enquiries and dealer applications, authentication, and persistence. Several backend modules are named in the tree and README but were not sampled; those relationships are shown only where documented, or omitted. (The README’s OCR and lifecycle capabilities are preserved.)

Main entry points: [`src/App.jsx`](https://github.com/mayur-web03/prv/blob/main/src/App.jsx) (Application router), [`src/api/client.js`](https://github.com/mayur-web03/prv/blob/main/src/api/client.js) (API client), [`src/pages/portal/NewOrder.jsx`](https://github.com/mayur-web03/prv/blob/main/src/pages/portal/NewOrder.jsx) (Order entry), [`api/dealer-applications.js`](https://github.com/mayur-web03/prv/blob/main/api/dealer-applications.js) (Form submission APIs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public storefront"]
  node_catalogue["Product catalogue<br/>[Catalogue.jsx]"]
  node_product["Product details<br/>[ProductDetail.jsx]"]
  node_productdata["Product data<br/>[product.js]"]
  node_publicforms["Enquiry and dealer forms<br/>[EnquiryForm.jsx]"]
end

subgraph group_identity["Identity and access"]
  node_auth["Session authentication<br/>[auth.js]"]
  node_authcontext["Frontend auth context<br/>[AuthContext.jsx]"]
  node_access["Role-gated portals<br/>[roles.js]"]
end

subgraph group_ordering["Dealer ordering"]
  node_neworder["Order entry<br/>[NewOrder.jsx]"]
  node_speech["Speech recognition"]
  node_camera["Image capture<br/>[CameraCapture.jsx]"]
  node_orderparse["Order text parsing<br/>[parseOrderText.js]"]
  node_orderlist["Dealer order list<br/>[Orders.jsx]"]
end

subgraph group_operations["Order operations"]
  node_review["Staff order review"]
  node_adminorders["Staff order queue<br/>[AdminOrders.jsx]"]
  node_history["Order status history<br/>[orders.js]"]
end

subgraph group_backend["Backend services"]
  node_validation["Shared validation<br/>[validation.js]"]
  node_formroutes["Form submission APIs"]
  node_handler["Form request handler<br/>[handler.js]"]
  node_client["API client<br/>[client.js]"]
  node_orderapi["Order API<br/>[orders.js]"]
  node_database[("PostgreSQL database<br/>[db.js]")]
end

node_visitor(("Public visitor"))
node_dealer(("Dealer or staff"))
node_app["Application router<br/>[App.jsx]"]
node_vision{{"Google Cloud Vision"}}

node_visitor -->|"browses"| node_app
node_app -->|"routes to"| node_catalogue
node_app -->|"routes to"| node_product
node_product -->|"reads"| node_productdata
node_visitor -.->|"submits"| node_publicforms
node_publicforms -.->|"posts to"| node_formroutes
node_formroutes -->|"delegates to"| node_handler
node_formroutes -->|"validates with"| node_validation
node_formroutes -->|"writes to"| node_database
node_dealer -->|"uses portal"| node_app
node_app -->|"provides auth"| node_authcontext
node_authcontext -->|"requests session"| node_client
node_client -.->|"calls API"| node_auth
node_auth -->|"reads and writes"| node_database
node_app -->|"gates routes"| node_access
node_app -->|"routes to"| node_neworder
node_neworder -.->|"submits order"| node_client
node_neworder -.->|"uses dictation"| node_speech
node_neworder -.->|"captures image"| node_camera
node_neworder -.->|"parses text"| node_orderparse
node_orderparse -->|"suggests matches"| node_productdata
node_client -.->|"calls API"| node_orderapi
node_orderapi -.->|"requests OCR"| node_vision
node_orderapi -.->|"persists orders"| node_database
node_app -->|"routes to"| node_orderlist
node_orderlist -.->|"loads orders"| node_client
node_app -->|"routes to"| node_adminorders
node_adminorders -.->|"loads queue"| node_client
node_app -->|"routes to"| node_review
node_review -->|"loads and updates"| node_client
node_orderapi -.->|"records changes"| node_history
node_history -.->|"persists history"| node_database

click node_app "https://github.com/mayur-web03/prv/blob/main/src/App.jsx"
click node_catalogue "https://github.com/mayur-web03/prv/blob/main/src/pages/Catalogue.jsx"
click node_product "https://github.com/mayur-web03/prv/blob/main/src/pages/ProductDetail.jsx"
click node_productdata "https://github.com/mayur-web03/prv/blob/main/src/data/product.js"
click node_publicforms "https://github.com/mayur-web03/prv/blob/main/src/components/contact/EnquiryForm.jsx"
click node_validation "https://github.com/mayur-web03/prv/blob/main/shared/validation.js"
click node_formroutes "https://github.com/mayur-web03/prv/blob/main/api/dealer-applications.js"
click node_handler "https://github.com/mayur-web03/prv/blob/main/api/_lib/handler.js"
click node_auth "https://github.com/mayur-web03/prv/blob/main/api/_lib/auth.js"
click node_authcontext "https://github.com/mayur-web03/prv/blob/main/src/auth/AuthContext.jsx"
click node_access "https://github.com/mayur-web03/prv/blob/main/src/auth/roles.js"
click node_client "https://github.com/mayur-web03/prv/blob/main/src/api/client.js"
click node_neworder "https://github.com/mayur-web03/prv/blob/main/src/pages/portal/NewOrder.jsx"
click node_speech "https://github.com/mayur-web03/prv/blob/main/src/hooks/useSpeechRecognition.js"
click node_camera "https://github.com/mayur-web03/prv/blob/main/src/components/orders/CameraCapture.jsx"
click node_orderparse "https://github.com/mayur-web03/prv/blob/main/src/utils/parseOrderText.js"
click node_orderapi "https://github.com/mayur-web03/prv/blob/main/api/_lib/orders.js"
click node_orderlist "https://github.com/mayur-web03/prv/blob/main/src/pages/portal/Orders.jsx"
click node_review "https://github.com/mayur-web03/prv/blob/main/src/pages/portal/AdminOrderReview.jsx"
click node_adminorders "https://github.com/mayur-web03/prv/blob/main/src/pages/portal/AdminOrders.jsx"
click node_history "https://github.com/mayur-web03/prv/blob/main/api/_lib/orders.js"
click node_database "https://github.com/mayur-web03/prv/blob/main/api/_lib/db.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_catalogue,node_product,node_productdata,node_publicforms toneBlue
class node_auth,node_authcontext,node_access toneAmber
class node_neworder,node_speech,node_camera,node_orderparse,node_orderlist,node_app toneMint
class node_review,node_adminorders,node_history toneRose
class node_validation,node_formroutes,node_handler,node_client,node_orderapi,node_database,node_visitor,node_dealer,node_vision toneIndigo
```

## Components

### Public storefront

- [Product catalogue](https://github.com/mayur-web03/prv/blob/main/src/pages/Catalogue.jsx): `src/pages/Catalogue.jsx`
- [Product details](https://github.com/mayur-web03/prv/blob/main/src/pages/ProductDetail.jsx): `src/pages/ProductDetail.jsx`
- [Product data](https://github.com/mayur-web03/prv/blob/main/src/data/product.js): `src/data/product.js`
- [Enquiry and dealer forms](https://github.com/mayur-web03/prv/blob/main/src/components/contact/EnquiryForm.jsx): `src/components/contact/EnquiryForm.jsx`

### Identity and access

- [Session authentication](https://github.com/mayur-web03/prv/blob/main/api/_lib/auth.js): `api/_lib/auth.js`
- [Frontend auth context](https://github.com/mayur-web03/prv/blob/main/src/auth/AuthContext.jsx): `src/auth/AuthContext.jsx`
- [Role-gated portals](https://github.com/mayur-web03/prv/blob/main/src/auth/roles.js): `src/auth/roles.js`

### Dealer ordering

- [Order entry](https://github.com/mayur-web03/prv/blob/main/src/pages/portal/NewOrder.jsx): `src/pages/portal/NewOrder.jsx`
- [Speech recognition](https://github.com/mayur-web03/prv/blob/main/src/hooks/useSpeechRecognition.js): `src/hooks/useSpeechRecognition.js`
- [Image capture](https://github.com/mayur-web03/prv/blob/main/src/components/orders/CameraCapture.jsx): `src/components/orders/CameraCapture.jsx`
- [Order text parsing](https://github.com/mayur-web03/prv/blob/main/src/utils/parseOrderText.js): `src/utils/parseOrderText.js`
- [Dealer order list](https://github.com/mayur-web03/prv/blob/main/src/pages/portal/Orders.jsx): `src/pages/portal/Orders.jsx`

### Order operations

- [Staff order review](https://github.com/mayur-web03/prv/blob/main/src/pages/portal/AdminOrderReview.jsx): `src/pages/portal/AdminOrderReview.jsx`
- [Staff order queue](https://github.com/mayur-web03/prv/blob/main/src/pages/portal/AdminOrders.jsx): `src/pages/portal/AdminOrders.jsx`
- [Order status history](https://github.com/mayur-web03/prv/blob/main/api/_lib/orders.js): `api/_lib/orders.js`

### Backend services

- [Shared validation](https://github.com/mayur-web03/prv/blob/main/shared/validation.js): `shared/validation.js`
- [Form submission APIs](https://github.com/mayur-web03/prv/blob/main/api/dealer-applications.js): `api/dealer-applications.js`
- [Form request handler](https://github.com/mayur-web03/prv/blob/main/api/_lib/handler.js): `api/_lib/handler.js`
- [API client](https://github.com/mayur-web03/prv/blob/main/src/api/client.js): `src/api/client.js`
- [Order API](https://github.com/mayur-web03/prv/blob/main/api/_lib/orders.js): `api/_lib/orders.js`
- [PostgreSQL database](https://github.com/mayur-web03/prv/blob/main/api/_lib/db.js): `api/_lib/db.js`

### Other components

- **Public visitor**
- **Dealer or staff**
- [Application router](https://github.com/mayur-web03/prv/blob/main/src/App.jsx): `src/App.jsx`
- **Google Cloud Vision**

## Connections

- Public visitor → Application router: browses (evidence: `src/App.jsx`)
- Application router → Product catalogue: routes to (evidence: `src/App.jsx`)
- Application router → Product details: routes to (evidence: `src/App.jsx`)
- Product details → Product data: reads (evidence: `src/pages/ProductDetail.jsx`)
- Public visitor → Enquiry and dealer forms: submits
- Enquiry and dealer forms → Form submission APIs: posts to
- Form submission APIs → Form request handler: delegates to (evidence: `api/dealer-applications.js`)
- Form submission APIs → Shared validation: validates with (evidence: `api/dealer-applications.js`)
- Form submission APIs → PostgreSQL database: writes to (evidence: `api/dealer-applications.js`)
- Dealer or staff → Application router: uses portal (evidence: `src/App.jsx`)
- Application router → Frontend auth context: provides auth (evidence: `src/App.jsx`)
- Frontend auth context → API client: requests session (evidence: `src/auth/AuthContext.jsx`)
- API client → Session authentication: calls API
- Session authentication → PostgreSQL database: reads and writes (evidence: `api/_lib/auth.js`)
- Application router → Role-gated portals: gates routes (evidence: `src/App.jsx`)
- Application router → Order entry: routes to (evidence: `src/App.jsx`)
- Order entry → API client: submits order
- Order entry → Speech recognition: uses dictation
- Order entry → Image capture: captures image
- Order entry → Order text parsing: parses text
- Order text parsing → Product data: suggests matches (evidence: `src/utils/parseOrderText.js`)
- API client → Order API: calls API
- Order API → Google Cloud Vision: requests OCR
- Order API → PostgreSQL database: persists orders
- Application router → Dealer order list: routes to (evidence: `src/App.jsx`)
- Dealer order list → API client: loads orders
- Application router → Staff order queue: routes to (evidence: `src/App.jsx`)
- Staff order queue → API client: loads queue
- Application router → Staff order review: routes to (evidence: `src/App.jsx`)
- Staff order review → API client: loads and updates (evidence: `src/pages/portal/AdminOrderReview.jsx`)
- Order API → Order status history: records changes
- Order status history → PostgreSQL database: persists history
