# parthnarkar/fitmart architecture

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

- Interactive diagram: https://gitdiagram.com/parthnarkar/fitmart
- Repository: https://github.com/parthnarkar/fitmart

## Overview

FitMart is a fitness and nutrition storefront with customer shopping, fitness tools, and an administrative console. The main customer journey runs from browsing products through cart, checkout, payment, and order confirmation; Firebase authenticates users, while the Express API and MongoDB support commerce and profile state. Separate branches cover workout planning, fitness discovery, AI chat, rewards, and admin operations. Edges are limited to relationships shown in the excerpts or README; many unsampled page-to-API calls are therefore not drawn.

Main entry points: [`client/src/App.jsx`](https://github.com/parthnarkar/fitmart/blob/main/client/src/App.jsx) (Web App Router), [`server/index.js`](https://github.com/parthnarkar/fitmart/blob/main/server/index.js) (Express API), [`server/services/firstPurchaseEmailService.js`](https://github.com/parthnarkar/fitmart/blob/main/server/services/firstPurchaseEmailService.js) (First Purchase Email), [`server/routes/payment.js`](https://github.com/parthnarkar/fitmart/blob/main/server/routes/payment.js) (Payment Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_app["Web App Router<br/>[App.jsx]"]
  node_catalog["Product Catalog<br/>[HomePage.jsx]"]
  node_product["Product Details<br/>[ProductPage.jsx]"]
  node_checkout["Checkout<br/>[Checkout.jsx]"]
  node_paymentui["Payment<br/>[PaymentPage.jsx]"]
  node_confirmation["Order Confirmation"]
end

subgraph group_identity["Identity &amp; Profiles"]
  node_authui["Sign-in<br/>[Authentication.jsx]"]
  node_firebaseclient["Firebase Auth Client<br/>[firebase.js]"]
  node_authstate["Auth State<br/>[useAuth.js]"]
  node_authheaders["Auth Headers<br/>[getAuthHeaders.js]"]
  node_profileui["User Profile<br/>[Profile.jsx]"]
  node_profilemodel[("Profile Records<br/>[UserProfile.js]")]
  node_firebaseadmin["Firebase Admin<br/>[firebaseAdmin.js]"]
  node_tokencheck["Token Verification"]
end

subgraph group_commerce["Commerce Backend"]
  node_api["Express API<br/>[index.js]"]
  node_paymentroute["Payment Routes<br/>[payment.js]"]
  node_orderservice["Order Creation<br/>[orderService.js]"]
  node_cartmodel[("Cart State<br/>[Cart.js]")]
  node_productmodel[("Product Inventory<br/>[Product.js]")]
  node_ordermodel[("Order Records<br/>[Order.js]")]
end

subgraph group_fitness["Fitness Features"]
  node_fitnessui["Fitness Pages<br/>[TrackerPage.jsx]"]
  node_fitnessapi["Fitness API Routes<br/>[workouts.js]"]
  node_fitnesscenters["Fitness Centers<br/>[fitnessCenters.js]"]
  node_chat["Fitness Chatbot<br/>[FitnessChatBot.jsx]"]
  node_chatapi["Chat API<br/>[chat.js]"]
end

subgraph group_operations["Admin &amp; Services"]
  node_adminui["Admin Console<br/>[AdminDashboard.jsx]"]
  node_admincustomers["Customer Admin<br/>[customers.js]"]
  node_bugreports["Bug Reporting<br/>[bugs.js]"]
  node_emailservice["Transactional Email<br/>[emailService.js]"]
  node_firstpurchase["First Purchase Email"]
  node_emailtemplates["Email Templates<br/>[emailTemplates.js]"]
end

node_shopper(("Shopper"))
node_smtp["SMTP Provider"]
node_razorpay["Razorpay"]

node_shopper -->|"opens"| node_app
node_app -->|"routes to"| node_catalog
node_app -->|"routes to"| node_product
node_app -->|"routes to"| node_checkout
node_app -->|"routes to"| node_paymentui
node_app -->|"routes to"| node_confirmation
node_app -->|"routes to"| node_authui
node_shopper -->|"signs in"| node_authui
node_authui -->|"authenticates with"| node_firebaseclient
node_authstate -->|"observes"| node_firebaseclient
node_checkout -->|"continues to"| node_paymentui
node_paymentui -->|"requests payment"| node_api
node_api -->|"mounts"| node_paymentroute
node_paymentroute -->|"creates/verifies"| node_razorpay
node_paymentroute -->|"creates order"| node_orderservice
node_orderservice -->|"reads/clears"| node_cartmodel
node_orderservice -->|"checks/updates"| node_productmodel
node_orderservice -->|"creates"| node_ordermodel
node_paymentroute -->|"triggers email"| node_firstpurchase
node_firstpurchase -->|"checks paid orders"| node_ordermodel
node_firstpurchase -->|"reads/updates"| node_profilemodel
node_firstpurchase -->|"resolves email"| node_firebaseadmin
node_firstpurchase -->|"generates message"| node_emailtemplates
node_firstpurchase -->|"sends message"| node_emailservice
node_emailservice -->|"delivers through"| node_smtp
node_api -.->|"uses for protected routes"| node_tokencheck
node_tokencheck -->|"verifies token"| node_firebaseadmin
node_profileui -.->|"uses"| node_authheaders
node_app -->|"routes to"| node_fitnessui
node_fitnessui -.->|"uses workout services"| node_fitnessapi
node_api -->|"mounts"| node_fitnessapi
node_api -->|"mounts"| node_fitnesscenters
node_chat -.->|"queries"| node_chatapi
node_api -->|"mounts"| node_chatapi
node_app -->|"routes to"| node_adminui
node_api -->|"mounts"| node_admincustomers
node_adminui -.->|"manages customers"| node_admincustomers
node_api -->|"mounts"| node_bugreports

click node_app "https://github.com/parthnarkar/fitmart/blob/main/client/src/App.jsx"
click node_catalog "https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/HomePage.jsx"
click node_product "https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/ProductPage.jsx"
click node_checkout "https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/Checkout.jsx"
click node_paymentui "https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/PaymentPage.jsx"
click node_confirmation "https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/ProductConfirmation.jsx"
click node_authui "https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/Authentication.jsx"
click node_firebaseclient "https://github.com/parthnarkar/fitmart/blob/main/client/src/auth/firebase.js"
click node_authstate "https://github.com/parthnarkar/fitmart/blob/main/client/src/auth/useAuth.js"
click node_authheaders "https://github.com/parthnarkar/fitmart/blob/main/client/src/utils/getAuthHeaders.js"
click node_profileui "https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/Profile.jsx"
click node_api "https://github.com/parthnarkar/fitmart/blob/main/server/index.js"
click node_paymentroute "https://github.com/parthnarkar/fitmart/blob/main/server/routes/payment.js"
click node_orderservice "https://github.com/parthnarkar/fitmart/blob/main/server/services/orderService.js"
click node_cartmodel "https://github.com/parthnarkar/fitmart/blob/main/server/models/Cart.js"
click node_productmodel "https://github.com/parthnarkar/fitmart/blob/main/server/models/Product.js"
click node_ordermodel "https://github.com/parthnarkar/fitmart/blob/main/server/models/Order.js"
click node_profilemodel "https://github.com/parthnarkar/fitmart/blob/main/server/models/UserProfile.js"
click node_firebaseadmin "https://github.com/parthnarkar/fitmart/blob/main/server/firebaseAdmin.js"
click node_tokencheck "https://github.com/parthnarkar/fitmart/blob/main/server/middleware/verifyFirebaseToken.js"
click node_fitnessui "https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/TrackerPage.jsx"
click node_fitnessapi "https://github.com/parthnarkar/fitmart/blob/main/server/routes/workouts.js"
click node_fitnesscenters "https://github.com/parthnarkar/fitmart/blob/main/server/routes/fitnessCenters.js"
click node_chat "https://github.com/parthnarkar/fitmart/blob/main/client/src/components/FitnessChatBot.jsx"
click node_chatapi "https://github.com/parthnarkar/fitmart/blob/main/server/routes/chat.js"
click node_adminui "https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/AdminDashboard.jsx"
click node_admincustomers "https://github.com/parthnarkar/fitmart/blob/main/server/routes/customers.js"
click node_bugreports "https://github.com/parthnarkar/fitmart/blob/main/server/routes/bugs.js"
click node_emailservice "https://github.com/parthnarkar/fitmart/blob/main/server/services/emailService.js"
click node_firstpurchase "https://github.com/parthnarkar/fitmart/blob/main/server/services/firstPurchaseEmailService.js"
click node_emailtemplates "https://github.com/parthnarkar/fitmart/blob/main/server/services/emailTemplates.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_catalog,node_product,node_checkout,node_paymentui,node_confirmation toneBlue
class node_authui,node_firebaseclient,node_authstate,node_authheaders,node_profileui,node_profilemodel,node_firebaseadmin,node_tokencheck toneAmber
class node_api,node_paymentroute,node_orderservice,node_cartmodel,node_productmodel,node_ordermodel toneMint
class node_fitnessui,node_fitnessapi,node_fitnesscenters,node_chat,node_chatapi toneRose
class node_adminui,node_admincustomers,node_bugreports,node_emailservice,node_firstpurchase,node_emailtemplates,node_shopper,node_smtp,node_razorpay toneIndigo
```

## Components

### Storefront

- [Web App Router](https://github.com/parthnarkar/fitmart/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Product Catalog](https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/HomePage.jsx): `client/src/pages/HomePage.jsx`
- [Product Details](https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/ProductPage.jsx): `client/src/pages/ProductPage.jsx`
- [Checkout](https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/Checkout.jsx): `client/src/pages/Checkout.jsx`
- [Payment](https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/PaymentPage.jsx): `client/src/pages/PaymentPage.jsx`
- [Order Confirmation](https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/ProductConfirmation.jsx): `client/src/pages/ProductConfirmation.jsx`

### Identity & Profiles

- [Sign-in](https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/Authentication.jsx): `client/src/pages/Authentication.jsx`
- [Firebase Auth Client](https://github.com/parthnarkar/fitmart/blob/main/client/src/auth/firebase.js): `client/src/auth/firebase.js`
- [Auth State](https://github.com/parthnarkar/fitmart/blob/main/client/src/auth/useAuth.js): `client/src/auth/useAuth.js`
- [Auth Headers](https://github.com/parthnarkar/fitmart/blob/main/client/src/utils/getAuthHeaders.js): `client/src/utils/getAuthHeaders.js`
- [User Profile](https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/Profile.jsx): `client/src/pages/Profile.jsx`
- [Profile Records](https://github.com/parthnarkar/fitmart/blob/main/server/models/UserProfile.js): `server/models/UserProfile.js`
- [Firebase Admin](https://github.com/parthnarkar/fitmart/blob/main/server/firebaseAdmin.js): `server/firebaseAdmin.js`
- [Token Verification](https://github.com/parthnarkar/fitmart/blob/main/server/middleware/verifyFirebaseToken.js): `server/middleware/verifyFirebaseToken.js`

### Commerce Backend

- [Express API](https://github.com/parthnarkar/fitmart/blob/main/server/index.js): `server/index.js`
- [Payment Routes](https://github.com/parthnarkar/fitmart/blob/main/server/routes/payment.js): `server/routes/payment.js`
- [Order Creation](https://github.com/parthnarkar/fitmart/blob/main/server/services/orderService.js): `server/services/orderService.js`
- [Cart State](https://github.com/parthnarkar/fitmart/blob/main/server/models/Cart.js): `server/models/Cart.js`
- [Product Inventory](https://github.com/parthnarkar/fitmart/blob/main/server/models/Product.js): `server/models/Product.js`
- [Order Records](https://github.com/parthnarkar/fitmart/blob/main/server/models/Order.js): `server/models/Order.js`

### Fitness Features

- [Fitness Pages](https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/TrackerPage.jsx): `client/src/pages/TrackerPage.jsx`
- [Fitness API Routes](https://github.com/parthnarkar/fitmart/blob/main/server/routes/workouts.js): `server/routes/workouts.js`
- [Fitness Centers](https://github.com/parthnarkar/fitmart/blob/main/server/routes/fitnessCenters.js): `server/routes/fitnessCenters.js`
- [Fitness Chatbot](https://github.com/parthnarkar/fitmart/blob/main/client/src/components/FitnessChatBot.jsx): `client/src/components/FitnessChatBot.jsx`
- [Chat API](https://github.com/parthnarkar/fitmart/blob/main/server/routes/chat.js): `server/routes/chat.js`

### Admin & Services

- [Admin Console](https://github.com/parthnarkar/fitmart/blob/main/client/src/pages/AdminDashboard.jsx): `client/src/pages/AdminDashboard.jsx`
- [Customer Admin](https://github.com/parthnarkar/fitmart/blob/main/server/routes/customers.js): `server/routes/customers.js`
- [Bug Reporting](https://github.com/parthnarkar/fitmart/blob/main/server/routes/bugs.js): `server/routes/bugs.js`
- [Transactional Email](https://github.com/parthnarkar/fitmart/blob/main/server/services/emailService.js): `server/services/emailService.js`
- [First Purchase Email](https://github.com/parthnarkar/fitmart/blob/main/server/services/firstPurchaseEmailService.js): `server/services/firstPurchaseEmailService.js`
- [Email Templates](https://github.com/parthnarkar/fitmart/blob/main/server/services/emailTemplates.js): `server/services/emailTemplates.js`

### Other components

- **Shopper**
- **SMTP Provider**
- **Razorpay**

## Connections

- Shopper → Web App Router: opens (evidence: `client/src/App.jsx`)
- Web App Router → Product Catalog: routes to (evidence: `client/src/App.jsx`)
- Web App Router → Product Details: routes to (evidence: `client/src/App.jsx`)
- Web App Router → Checkout: routes to (evidence: `client/src/App.jsx`)
- Web App Router → Payment: routes to (evidence: `client/src/App.jsx`)
- Web App Router → Order Confirmation: routes to (evidence: `client/src/App.jsx`)
- Web App Router → Sign-in: routes to (evidence: `client/src/App.jsx`)
- Shopper → Sign-in: signs in
- Sign-in → Firebase Auth Client: authenticates with (evidence: `client/src/pages/Authentication.jsx`)
- Auth State → Firebase Auth Client: observes (evidence: `client/src/auth/useAuth.js`)
- Checkout → Payment: continues to
- Payment → Express API: requests payment
- Express API → Payment Routes: mounts (evidence: `server/index.js`)
- Payment Routes → Razorpay: creates/verifies
- Payment Routes → Order Creation: creates order (evidence: `server/routes/payment.js`)
- Order Creation → Cart State: reads/clears (evidence: `server/services/orderService.js`)
- Order Creation → Product Inventory: checks/updates (evidence: `server/services/orderService.js`)
- Order Creation → Order Records: creates (evidence: `server/services/orderService.js`)
- Payment Routes → First Purchase Email: triggers email (evidence: `server/routes/payment.js`)
- First Purchase Email → Order Records: checks paid orders (evidence: `server/services/firstPurchaseEmailService.js`)
- First Purchase Email → Profile Records: reads/updates (evidence: `server/services/firstPurchaseEmailService.js`)
- First Purchase Email → Firebase Admin: resolves email (evidence: `server/services/firstPurchaseEmailService.js`)
- First Purchase Email → Email Templates: generates message (evidence: `server/services/firstPurchaseEmailService.js`)
- First Purchase Email → Transactional Email: sends message (evidence: `server/services/firstPurchaseEmailService.js`)
- Transactional Email → SMTP Provider: delivers through (evidence: `server/services/emailService.js`)
- Express API → Token Verification: uses for protected routes
- Token Verification → Firebase Admin: verifies token (evidence: `server/middleware/verifyFirebaseToken.js`)
- User Profile → Auth Headers: uses
- Web App Router → Fitness Pages: routes to (evidence: `client/src/App.jsx`)
- Fitness Pages → Fitness API Routes: uses workout services
- Express API → Fitness API Routes: mounts (evidence: `server/index.js`)
- Express API → Fitness Centers: mounts (evidence: `server/index.js`)
- Fitness Chatbot → Chat API: queries
- Express API → Chat API: mounts (evidence: `server/index.js`)
- Web App Router → Admin Console: routes to (evidence: `client/src/App.jsx`)
- Express API → Customer Admin: mounts (evidence: `server/index.js`)
- Admin Console → Customer Admin: manages customers
- Express API → Bug Reporting: mounts (evidence: `server/index.js`)
