# reluctant-king/trendz-upholstery architecture

> Architecture diagram of the GitHub repository reluctant-king/trendz-upholstery, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/reluctant-king/trendz-upholstery
- Repository: https://github.com/reluctant-king/trendz-upholstery

## Overview

Trendz Furnishing is a public upholstery and custom-furniture showcase paired with an admin content and enquiry-management dashboard. Visitors browse projects and business content, then submit quote enquiries; administrators authenticate, maintain that content, and track enquiry progress. The frontend uses a shared site-data context and API client, while the Express API dispatches to domain controllers backed by MongoDB. README-described capabilities are included where source excerpts were unavailable; their internal wiring is shown only at the subsystem level.

Main entry points: [`server/routes`](https://github.com/reluctant-king/trendz-upholstery/tree/main/server/routes) (API routes), [`client/src/lib/api.js`](https://github.com/reluctant-king/trendz-upholstery/blob/main/client/src/lib/api.js) (API client), [`client/src/App.jsx`](https://github.com/reluctant-king/trendz-upholstery/blob/main/client/src/App.jsx) (React routes), [`server/utils/imageUpload.js`](https://github.com/reluctant-king/trendz-upholstery/blob/main/server/utils/imageUpload.js) (Image storage adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Website Experience"]
  node_app["React routes<br/>[App.jsx]"]
  node_public["Public pages"]
  node_sitecontext["Site content<br/>[SiteContext.jsx]"]
  node_quote["Quote form<br/>[QuoteForm.jsx]"]
  node_clientapi["API client<br/>[api.js]"]
end

subgraph group_admin["Admin Operations"]
  node_adminpages["Admin pages"]
  node_authguard["Admin access<br/>[RequireAuth.jsx]"]
  node_authcontext["Auth state<br/>[AuthContext.jsx]"]
end

subgraph group_api["API Services"]
  node_server["Express API<br/>[index.js]"]
  node_routes["API routes"]
  node_authcontroller["Authentication<br/>[authController.js]"]
  node_contentcontrollers["Content controllers"]
  node_enquirycontroller["Enquiry workflow"]
  node_uploadcontroller["Image uploads"]
end

subgraph group_data["Persistence &amp; Media"]
  node_mongo[("MongoDB<br/>[db.js]")]
  node_models[("Domain models")]
  node_imageupload["Image storage adapter<br/>[imageUpload.js]"]
  node_localfiles[("Local image files")]
end

node_visitor(("Visitor"))
node_owner(("Business owner"))
node_cloudinary[("Cloudinary")]

node_visitor -->|"opens site"| node_app
node_owner -->|"opens dashboard"| node_app
node_app -->|"routes visitors"| node_public
node_app -->|"guards admin"| node_authguard
node_authguard -->|"permits access"| node_adminpages
node_adminpages -->|"uses session"| node_authcontext
node_public -->|"reads content"| node_sitecontext
node_public -->|"offers enquiry"| node_quote
node_sitecontext -->|"loads content"| node_clientapi
node_quote -->|"submits request"| node_clientapi
node_adminpages -->|"manages records"| node_clientapi
node_authcontext -->|"authenticates"| node_clientapi
node_clientapi -->|"sends API requests"| node_server
node_server -->|"dispatches requests"| node_routes
node_routes -->|"dispatches auth"| node_authcontroller
node_routes -->|"dispatches content"| node_contentcontrollers
node_routes -->|"dispatches enquiries"| node_enquirycontroller
node_routes -->|"dispatches uploads"| node_uploadcontroller
node_authcontroller -->|"reads/writes admin"| node_models
node_contentcontrollers -->|"reads/writes content"| node_models
node_enquirycontroller -->|"reads/writes enquiries"| node_models
node_models -->|"persists records"| node_mongo
node_enquirycontroller -->|"uploads enquiry images"| node_imageupload
node_uploadcontroller -->|"uploads images"| node_imageupload
node_imageupload -.->|"stores images"| node_cloudinary
node_imageupload -.->|"stores images"| node_localfiles

click node_app "https://github.com/reluctant-king/trendz-upholstery/blob/main/client/src/App.jsx"
click node_public "https://github.com/reluctant-king/trendz-upholstery/tree/main/client/src/pages"
click node_sitecontext "https://github.com/reluctant-king/trendz-upholstery/blob/main/client/src/context/SiteContext.jsx"
click node_quote "https://github.com/reluctant-king/trendz-upholstery/blob/main/client/src/components/quote/QuoteForm.jsx"
click node_adminpages "https://github.com/reluctant-king/trendz-upholstery/tree/main/client/src/pages/admin"
click node_authguard "https://github.com/reluctant-king/trendz-upholstery/blob/main/client/src/components/admin/RequireAuth.jsx"
click node_authcontext "https://github.com/reluctant-king/trendz-upholstery/blob/main/client/src/context/AuthContext.jsx"
click node_clientapi "https://github.com/reluctant-king/trendz-upholstery/blob/main/client/src/lib/api.js"
click node_server "https://github.com/reluctant-king/trendz-upholstery/blob/main/server/index.js"
click node_routes "https://github.com/reluctant-king/trendz-upholstery/tree/main/server/routes"
click node_authcontroller "https://github.com/reluctant-king/trendz-upholstery/blob/main/server/controllers/authController.js"
click node_contentcontrollers "https://github.com/reluctant-king/trendz-upholstery/tree/main/server/controllers"
click node_enquirycontroller "https://github.com/reluctant-king/trendz-upholstery/blob/main/server/controllers/enquiryController.js"
click node_uploadcontroller "https://github.com/reluctant-king/trendz-upholstery/blob/main/server/controllers/uploadController.js"
click node_mongo "https://github.com/reluctant-king/trendz-upholstery/blob/main/server/config/db.js"
click node_models "https://github.com/reluctant-king/trendz-upholstery/tree/main/server/models"
click node_imageupload "https://github.com/reluctant-king/trendz-upholstery/blob/main/server/utils/imageUpload.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_app,node_public,node_sitecontext,node_quote,node_clientapi toneBlue
class node_adminpages,node_authguard,node_authcontext,node_cloudinary toneAmber
class node_server,node_routes,node_authcontroller,node_contentcontrollers,node_enquirycontroller,node_uploadcontroller toneMint
class node_mongo,node_models,node_imageupload,node_localfiles toneRose
class node_visitor,node_owner toneIndigo
```

## Components

### Website Experience

- [React routes](https://github.com/reluctant-king/trendz-upholstery/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Public pages](https://github.com/reluctant-king/trendz-upholstery/tree/main/client/src/pages): `client/src/pages`
- [Site content](https://github.com/reluctant-king/trendz-upholstery/blob/main/client/src/context/SiteContext.jsx): `client/src/context/SiteContext.jsx`
- [Quote form](https://github.com/reluctant-king/trendz-upholstery/blob/main/client/src/components/quote/QuoteForm.jsx): `client/src/components/quote/QuoteForm.jsx`
- [API client](https://github.com/reluctant-king/trendz-upholstery/blob/main/client/src/lib/api.js): `client/src/lib/api.js`

### Admin Operations

- [Admin pages](https://github.com/reluctant-king/trendz-upholstery/tree/main/client/src/pages/admin): `client/src/pages/admin`
- [Admin access](https://github.com/reluctant-king/trendz-upholstery/blob/main/client/src/components/admin/RequireAuth.jsx): `client/src/components/admin/RequireAuth.jsx`
- [Auth state](https://github.com/reluctant-king/trendz-upholstery/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`

### API Services

- [Express API](https://github.com/reluctant-king/trendz-upholstery/blob/main/server/index.js): `server/index.js`
- [API routes](https://github.com/reluctant-king/trendz-upholstery/tree/main/server/routes): `server/routes`
- [Authentication](https://github.com/reluctant-king/trendz-upholstery/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [Content controllers](https://github.com/reluctant-king/trendz-upholstery/tree/main/server/controllers): `server/controllers`
- [Enquiry workflow](https://github.com/reluctant-king/trendz-upholstery/blob/main/server/controllers/enquiryController.js): `server/controllers/enquiryController.js`
- [Image uploads](https://github.com/reluctant-king/trendz-upholstery/blob/main/server/controllers/uploadController.js): `server/controllers/uploadController.js`

### Persistence & Media

- [MongoDB](https://github.com/reluctant-king/trendz-upholstery/blob/main/server/config/db.js): `server/config/db.js`
- [Domain models](https://github.com/reluctant-king/trendz-upholstery/tree/main/server/models): `server/models`
- [Image storage adapter](https://github.com/reluctant-king/trendz-upholstery/blob/main/server/utils/imageUpload.js): `server/utils/imageUpload.js`
- **Local image files**

### Other components

- **Visitor**
- **Business owner**
- **Cloudinary**

## Connections

- Visitor → React routes: opens site
- Business owner → React routes: opens dashboard
- React routes → Public pages: routes visitors
- React routes → Admin access: guards admin
- Admin access → Admin pages: permits access
- Admin pages → Auth state: uses session
- Public pages → Site content: reads content
- Public pages → Quote form: offers enquiry
- Site content → API client: loads content
- Quote form → API client: submits request
- Admin pages → API client: manages records
- Auth state → API client: authenticates
- API client → Express API: sends API requests
- Express API → API routes: dispatches requests
- API routes → Authentication: dispatches auth
- API routes → Content controllers: dispatches content
- API routes → Enquiry workflow: dispatches enquiries
- API routes → Image uploads: dispatches uploads
- Authentication → Domain models: reads/writes admin
- Content controllers → Domain models: reads/writes content
- Enquiry workflow → Domain models: reads/writes enquiries
- Domain models → MongoDB: persists records
- Enquiry workflow → Image storage adapter: uploads enquiry images
- Image uploads → Image storage adapter: uploads images
- Image storage adapter → Cloudinary: stores images
- Image storage adapter → Local image files: stores images
