# manan-8017/buildflow architecture

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

- Interactive diagram: https://gitdiagram.com/manan-8017/buildflow
- Repository: https://github.com/manan-8017/buildflow

## Overview

BuildFlow is a construction-material estimation and procurement app: users enter building dimensions for a material-and-cost estimate, then browse products, manage a cart, place and pay for orders, and track them. The graph follows the React entry point through the API routes to server controllers, services, and MongoDB-backed models. It also shows authentication and the documented product-management capability. The tree and excerpts do not expose every page or controller implementation, so uncertain internal links are omitted.

Main entry points: [`client/src/App.jsx`](https://github.com/manan-8017/buildflow/blob/main/client/src/App.jsx) (App routes), [`server/routes/routes.js`](https://github.com/manan-8017/buildflow/blob/main/server/routes/routes.js) (API router), [`client/src/services/api.js`](https://github.com/manan-8017/buildflow/blob/main/client/src/services/api.js) (HTTP client), [`server/config/db.js`](https://github.com/manan-8017/buildflow/blob/main/server/config/db.js) (MongoDB)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App routes<br/>[App.jsx]"]
  node_authui["Auth context<br/>[AuthContext.jsx]"]
  node_pages["Marketplace pages<br/>[Products.jsx]"]
  node_cartui["Cart page<br/>[Cart.jsx]"]
  node_checkoutui["Checkout page<br/>[Checkout.jsx]"]
  node_paymentui["Payment page<br/>[Payment.jsx]"]
  node_ordersui["Order pages<br/>[Orders.jsx]"]
  node_estimateui["Estimation pages<br/>[Estimation.jsx]"]
  node_api_client["HTTP client<br/>[api.js]"]
end

subgraph group_api["API dispatch"]
  node_api_routes["API router<br/>[routes.js]"]
  node_auth_routes["Auth routes<br/>[authRoutes.js]"]
  node_cart_routes["Cart routes<br/>[cartRoute.js]"]
  node_product_routes["Product routes<br/>[productRoute.js]"]
  node_order_routes["Order routes<br/>[orderRoute.js]"]
  node_payment_routes["Payment routes<br/>[paymentRoute.js]"]
  node_est_routes["Estimation routes<br/>[estimationRoute.js]"]
end

subgraph group_domain["Commerce and identity"]
  node_auth_ctrl["Auth controller<br/>[authController.js]"]
  node_cart_ctrl["Cart controller<br/>[cartController.js]"]
  node_product_ctrl["Product controller"]
  node_order_ctrl["Order controller<br/>[orderController.js]"]
  node_payment_ctrl["Payment controller"]
  node_auth_service["JWT service<br/>[authService.js]"]
  node_payment_service["Payment service<br/>[paymentService.js]"]
end

subgraph group_estimate["Estimation"]
  node_est_ctrl["Estimation controller"]
  node_est_service["Estimate service"]
  node_gemini["Gemini estimator<br/>[geminiService.js]"]
end

subgraph group_data["Persistence"]
  node_mongo[("MongoDB<br/>[db.js]")]
  node_user_model["User model<br/>[user.js]"]
  node_cart_model["Cart model<br/>[cart.js]"]
  node_product_model["Product model<br/>[product.js]"]
  node_order_model["Order model<br/>[order.js]"]
  node_payment_model["Payment model<br/>[payment.js]"]
  node_est_model["Estimation model<br/>[estimation.js]"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"provides auth"| node_authui
node_app -->|"routes to"| node_pages
node_app -->|"routes to"| node_cartui
node_app -->|"routes to"| node_checkoutui
node_app -->|"routes to"| node_paymentui
node_app -->|"routes to"| node_ordersui
node_app -->|"routes to"| node_estimateui
node_authui -->|"requests"| node_api_client
node_pages -->|"requests"| node_api_client
node_cartui -->|"requests"| node_api_client
node_checkoutui -->|"requests"| node_api_client
node_paymentui -->|"requests"| node_api_client
node_ordersui -->|"requests"| node_api_client
node_estimateui -->|"requests"| node_api_client
node_api_client -->|"HTTP calls"| node_api_routes
node_api_routes -->|"mounts"| node_auth_routes
node_api_routes -->|"mounts"| node_cart_routes
node_api_routes -->|"mounts"| node_product_routes
node_api_routes -->|"mounts"| node_order_routes
node_api_routes -->|"mounts"| node_payment_routes
node_api_routes -->|"mounts"| node_est_routes
node_auth_routes -->|"dispatches"| node_auth_ctrl
node_cart_routes -->|"dispatches"| node_cart_ctrl
node_product_routes -->|"dispatches"| node_product_ctrl
node_order_routes -->|"dispatches"| node_order_ctrl
node_payment_routes -->|"dispatches"| node_payment_ctrl
node_est_routes -->|"dispatches"| node_est_ctrl
node_auth_ctrl -->|"generates tokens"| node_auth_service
node_auth_ctrl -->|"reads and writes"| node_user_model
node_cart_ctrl -->|"reads and writes"| node_cart_model
node_product_ctrl -->|"manages products"| node_product_model
node_order_ctrl -->|"creates and reads"| node_order_model
node_order_ctrl -->|"creates payment order"| node_payment_service
node_payment_ctrl -->|"handles payment"| node_payment_service
node_payment_ctrl -->|"persists payment"| node_payment_model
node_est_ctrl -->|"generates estimate"| node_est_service
node_est_ctrl -->|"reads and writes"| node_est_model
node_est_service -.->|"requests estimate"| node_gemini
node_user_model -->|"stores in"| node_mongo
node_cart_model -->|"stores in"| node_mongo
node_product_model -->|"stores in"| node_mongo
node_order_model -->|"stores in"| node_mongo
node_payment_model -->|"stores in"| node_mongo
node_est_model -->|"stores in"| node_mongo

click node_app "https://github.com/manan-8017/buildflow/blob/main/client/src/App.jsx"
click node_authui "https://github.com/manan-8017/buildflow/blob/main/client/src/context/AuthContext.jsx"
click node_pages "https://github.com/manan-8017/buildflow/blob/main/client/src/pages/Products.jsx"
click node_cartui "https://github.com/manan-8017/buildflow/blob/main/client/src/pages/Cart.jsx"
click node_checkoutui "https://github.com/manan-8017/buildflow/blob/main/client/src/pages/Checkout.jsx"
click node_paymentui "https://github.com/manan-8017/buildflow/blob/main/client/src/pages/Payment.jsx"
click node_ordersui "https://github.com/manan-8017/buildflow/blob/main/client/src/pages/Orders.jsx"
click node_estimateui "https://github.com/manan-8017/buildflow/blob/main/client/src/pages/Estimation.jsx"
click node_api_client "https://github.com/manan-8017/buildflow/blob/main/client/src/services/api.js"
click node_api_routes "https://github.com/manan-8017/buildflow/blob/main/server/routes/routes.js"
click node_auth_routes "https://github.com/manan-8017/buildflow/blob/main/server/routes/authRoutes.js"
click node_cart_routes "https://github.com/manan-8017/buildflow/blob/main/server/routes/cartRoute.js"
click node_product_routes "https://github.com/manan-8017/buildflow/blob/main/server/routes/productRoute.js"
click node_order_routes "https://github.com/manan-8017/buildflow/blob/main/server/routes/orderRoute.js"
click node_payment_routes "https://github.com/manan-8017/buildflow/blob/main/server/routes/paymentRoute.js"
click node_est_routes "https://github.com/manan-8017/buildflow/blob/main/server/routes/estimationRoute.js"
click node_auth_ctrl "https://github.com/manan-8017/buildflow/blob/main/server/controllers/authController.js"
click node_cart_ctrl "https://github.com/manan-8017/buildflow/blob/main/server/controllers/cartController.js"
click node_product_ctrl "https://github.com/manan-8017/buildflow/blob/main/server/controllers/productController.js"
click node_order_ctrl "https://github.com/manan-8017/buildflow/blob/main/server/controllers/orderController.js"
click node_payment_ctrl "https://github.com/manan-8017/buildflow/blob/main/server/controllers/paymentController.js"
click node_auth_service "https://github.com/manan-8017/buildflow/blob/main/server/services/authService.js"
click node_payment_service "https://github.com/manan-8017/buildflow/blob/main/server/services/paymentService.js"
click node_est_ctrl "https://github.com/manan-8017/buildflow/blob/main/server/controllers/estimationController.js"
click node_est_service "https://github.com/manan-8017/buildflow/blob/main/server/services/estimationService.js"
click node_gemini "https://github.com/manan-8017/buildflow/blob/main/server/services/geminiService.js"
click node_mongo "https://github.com/manan-8017/buildflow/blob/main/server/config/db.js"
click node_user_model "https://github.com/manan-8017/buildflow/blob/main/server/models/user.js"
click node_cart_model "https://github.com/manan-8017/buildflow/blob/main/server/models/cart.js"
click node_product_model "https://github.com/manan-8017/buildflow/blob/main/server/models/product.js"
click node_order_model "https://github.com/manan-8017/buildflow/blob/main/server/models/order.js"
click node_payment_model "https://github.com/manan-8017/buildflow/blob/main/server/models/payment.js"
click node_est_model "https://github.com/manan-8017/buildflow/blob/main/server/models/estimation.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_authui,node_pages,node_cartui,node_checkoutui,node_paymentui,node_ordersui,node_estimateui,node_api_client,node_user toneBlue
class node_api_routes,node_auth_routes,node_cart_routes,node_product_routes,node_order_routes,node_payment_routes,node_est_routes toneAmber
class node_auth_ctrl,node_cart_ctrl,node_product_ctrl,node_order_ctrl,node_payment_ctrl,node_auth_service,node_payment_service toneMint
class node_est_ctrl,node_est_service,node_gemini toneRose
class node_mongo,node_user_model,node_cart_model,node_product_model,node_order_model,node_payment_model,node_est_model toneIndigo
```

## Components

### Web client

- [App routes](https://github.com/manan-8017/buildflow/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Auth context](https://github.com/manan-8017/buildflow/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Marketplace pages](https://github.com/manan-8017/buildflow/blob/main/client/src/pages/Products.jsx): `client/src/pages/Products.jsx`
- [Cart page](https://github.com/manan-8017/buildflow/blob/main/client/src/pages/Cart.jsx): `client/src/pages/Cart.jsx`
- [Checkout page](https://github.com/manan-8017/buildflow/blob/main/client/src/pages/Checkout.jsx): `client/src/pages/Checkout.jsx`
- [Payment page](https://github.com/manan-8017/buildflow/blob/main/client/src/pages/Payment.jsx): `client/src/pages/Payment.jsx`
- [Order pages](https://github.com/manan-8017/buildflow/blob/main/client/src/pages/Orders.jsx): `client/src/pages/Orders.jsx`
- [Estimation pages](https://github.com/manan-8017/buildflow/blob/main/client/src/pages/Estimation.jsx): `client/src/pages/Estimation.jsx`
- [HTTP client](https://github.com/manan-8017/buildflow/blob/main/client/src/services/api.js): `client/src/services/api.js`

### API dispatch

- [API router](https://github.com/manan-8017/buildflow/blob/main/server/routes/routes.js): `server/routes/routes.js`
- [Auth routes](https://github.com/manan-8017/buildflow/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`
- [Cart routes](https://github.com/manan-8017/buildflow/blob/main/server/routes/cartRoute.js): `server/routes/cartRoute.js`
- [Product routes](https://github.com/manan-8017/buildflow/blob/main/server/routes/productRoute.js): `server/routes/productRoute.js`
- [Order routes](https://github.com/manan-8017/buildflow/blob/main/server/routes/orderRoute.js): `server/routes/orderRoute.js`
- [Payment routes](https://github.com/manan-8017/buildflow/blob/main/server/routes/paymentRoute.js): `server/routes/paymentRoute.js`
- [Estimation routes](https://github.com/manan-8017/buildflow/blob/main/server/routes/estimationRoute.js): `server/routes/estimationRoute.js`

### Commerce and identity

- [Auth controller](https://github.com/manan-8017/buildflow/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [Cart controller](https://github.com/manan-8017/buildflow/blob/main/server/controllers/cartController.js): `server/controllers/cartController.js`
- [Product controller](https://github.com/manan-8017/buildflow/blob/main/server/controllers/productController.js): `server/controllers/productController.js`
- [Order controller](https://github.com/manan-8017/buildflow/blob/main/server/controllers/orderController.js): `server/controllers/orderController.js`
- [Payment controller](https://github.com/manan-8017/buildflow/blob/main/server/controllers/paymentController.js): `server/controllers/paymentController.js`
- [JWT service](https://github.com/manan-8017/buildflow/blob/main/server/services/authService.js): `server/services/authService.js`
- [Payment service](https://github.com/manan-8017/buildflow/blob/main/server/services/paymentService.js): `server/services/paymentService.js`

### Estimation

- [Estimation controller](https://github.com/manan-8017/buildflow/blob/main/server/controllers/estimationController.js): `server/controllers/estimationController.js`
- [Estimate service](https://github.com/manan-8017/buildflow/blob/main/server/services/estimationService.js): `server/services/estimationService.js`
- [Gemini estimator](https://github.com/manan-8017/buildflow/blob/main/server/services/geminiService.js): `server/services/geminiService.js`

### Persistence

- [MongoDB](https://github.com/manan-8017/buildflow/blob/main/server/config/db.js): `server/config/db.js`
- [User model](https://github.com/manan-8017/buildflow/blob/main/server/models/user.js): `server/models/user.js`
- [Cart model](https://github.com/manan-8017/buildflow/blob/main/server/models/cart.js): `server/models/cart.js`
- [Product model](https://github.com/manan-8017/buildflow/blob/main/server/models/product.js): `server/models/product.js`
- [Order model](https://github.com/manan-8017/buildflow/blob/main/server/models/order.js): `server/models/order.js`
- [Payment model](https://github.com/manan-8017/buildflow/blob/main/server/models/payment.js): `server/models/payment.js`
- [Estimation model](https://github.com/manan-8017/buildflow/blob/main/server/models/estimation.js): `server/models/estimation.js`

### Other components

- **User**

## Connections

- User → App routes: uses
- App routes → Auth context: provides auth
- App routes → Marketplace pages: routes to
- App routes → Cart page: routes to
- App routes → Checkout page: routes to
- App routes → Payment page: routes to
- App routes → Order pages: routes to
- App routes → Estimation pages: routes to
- Auth context → HTTP client: requests
- Marketplace pages → HTTP client: requests
- Cart page → HTTP client: requests
- Checkout page → HTTP client: requests
- Payment page → HTTP client: requests
- Order pages → HTTP client: requests
- Estimation pages → HTTP client: requests
- HTTP client → API router: HTTP calls
- API router → Auth routes: mounts
- API router → Cart routes: mounts
- API router → Product routes: mounts
- API router → Order routes: mounts
- API router → Payment routes: mounts
- API router → Estimation routes: mounts
- Auth routes → Auth controller: dispatches
- Cart routes → Cart controller: dispatches
- Product routes → Product controller: dispatches
- Order routes → Order controller: dispatches
- Payment routes → Payment controller: dispatches
- Estimation routes → Estimation controller: dispatches
- Auth controller → JWT service: generates tokens
- Auth controller → User model: reads and writes
- Cart controller → Cart model: reads and writes
- Product controller → Product model: manages products
- Order controller → Order model: creates and reads
- Order controller → Payment service: creates payment order
- Payment controller → Payment service: handles payment
- Payment controller → Payment model: persists payment
- Estimation controller → Estimate service: generates estimate
- Estimation controller → Estimation model: reads and writes
- Estimate service → Gemini estimator: requests estimate
- User model → MongoDB: stores in
- Cart model → MongoDB: stores in
- Product model → MongoDB: stores in
- Order model → MongoDB: stores in
- Payment model → MongoDB: stores in
- Estimation model → MongoDB: stores in
