# ppanchal5698/cbc-final architecture

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

- Interactive diagram: https://gitdiagram.com/ppanchal5698/cbc-final
- Repository: https://github.com/ppanchal5698/cbc-final

## Overview

CBC Estimating Copilot is a bid-estimating application: estimators upload bid documents, review extracted openings and takeoffs, match and price items, then prepare a proposal. The backend is a FastAPI modular monolith with a separate worker that claims Mongo-backed jobs; the web app proxies API requests. The graph preserves the documented pipeline, catalog, pricing, and proposal capabilities. Some source excerpts are partial, so uncertain internal dispatch links are omitted.

Main entry points: [`apps/backend/src/cbc/app/main.py`](https://github.com/ppanchal5698/cbc-final/blob/master/apps/backend/src/cbc/app/main.py) (FastAPI API), [`apps/backend/src/cbc/shared/storage.py`](https://github.com/ppanchal5698/cbc-final/blob/master/apps/backend/src/cbc/shared/storage.py) (Project files), [`apps/backend/src/cbc/shared/mongo.py`](https://github.com/ppanchal5698/cbc-final/blob/master/apps/backend/src/cbc/shared/mongo.py) (MongoDB), [`apps/backend/src/cbc/modules/projects/api/pipeline.py`](https://github.com/ppanchal5698/cbc-final/blob/master/apps/backend/src/cbc/modules/projects/api/pipeline.py) (Pipeline runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Estimator interface"]
  node_webapp["Ops-Hub web<br/>[page.tsx]"]
end

subgraph group_intake["Document processing"]
  node_intake["Document intake"]
  node_extraction["Extraction and review"]
end

subgraph group_projects["Bid workflow"]
  node_projects["Bid and autopilot"]
  node_pipeline["Pipeline runner<br/>[pipeline.py]"]
end

subgraph group_catalog["Catalog and pricing"]
  node_catalog["Product catalog"]
  node_pricing["Pricing rules"]
end

subgraph group_quote["Quote and proposal"]
  node_quoting["Quote and proposal"]
end

subgraph group_ops["Runtime operations"]
  node_api["FastAPI API<br/>[main.py]"]
  node_ops["Jobs and settings"]
  node_worker["Background worker<br/>[worker.py]"]
  node_mongo[("MongoDB<br/>[mongo.py]")]
  node_files["Project files<br/>[storage.py]"]
  node_s3[("S3 storage")]
end

node_estimator(("Estimator"))
node_claude{{"Claude provider"}}

node_estimator -->|"uses"| node_webapp
node_webapp -->|"proxies requests"| node_api
node_api -->|"handles intake"| node_intake
node_api -->|"handles review"| node_extraction
node_api -->|"handles bids"| node_projects
node_api -->|"serves catalog"| node_catalog
node_api -->|"serves pricing"| node_pricing
node_api -->|"serves quotes"| node_quoting
node_api -->|"manages jobs"| node_ops
node_intake -->|"stores documents"| node_files
node_projects -->|"starts passes"| node_pipeline
node_pipeline -->|"coordinates jobs"| node_ops
node_worker -->|"claims jobs"| node_mongo
node_ops -->|"persists job state"| node_mongo
node_pipeline -->|"runs passes"| node_claude
node_extraction -->|"reads and writes artifacts"| node_files
node_quoting -->|"stores proposal artifacts"| node_files
node_catalog -->|"reads catalog data"| node_mongo
node_pricing -->|"reads pricing data"| node_mongo
node_files -.->|"syncs optionally"| node_s3

click node_webapp "https://github.com/ppanchal5698/cbc-final/blob/master/apps/web/app/(app)/bids/%5Bcode%5D/intake/page.tsx"
click node_api "https://github.com/ppanchal5698/cbc-final/blob/master/apps/backend/src/cbc/app/main.py"
click node_intake "https://github.com/ppanchal5698/cbc-final/tree/master/apps/backend/src/cbc/modules/intake"
click node_extraction "https://github.com/ppanchal5698/cbc-final/tree/master/apps/backend/src/cbc/modules/extraction"
click node_projects "https://github.com/ppanchal5698/cbc-final/tree/master/apps/backend/src/cbc/modules/projects"
click node_pipeline "https://github.com/ppanchal5698/cbc-final/blob/master/apps/backend/src/cbc/modules/projects/api/pipeline.py"
click node_catalog "https://github.com/ppanchal5698/cbc-final/tree/master/apps/backend/src/cbc/modules/catalog"
click node_pricing "https://github.com/ppanchal5698/cbc-final/tree/master/apps/backend/src/cbc/modules/pricing"
click node_quoting "https://github.com/ppanchal5698/cbc-final/tree/master/apps/backend/src/cbc/modules/quoting"
click node_ops "https://github.com/ppanchal5698/cbc-final/tree/master/apps/backend/src/cbc/modules/ops"
click node_worker "https://github.com/ppanchal5698/cbc-final/blob/master/apps/backend/src/cbc/app/worker.py"
click node_mongo "https://github.com/ppanchal5698/cbc-final/blob/master/apps/backend/src/cbc/shared/mongo.py"
click node_files "https://github.com/ppanchal5698/cbc-final/blob/master/apps/backend/src/cbc/shared/storage.py"
click node_s3 "https://github.com/ppanchal5698/cbc-final/blob/master/apps/backend/src/cbc/shared/storage_backends.py"

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_webapp toneBlue
class node_intake,node_extraction toneAmber
class node_projects,node_pipeline toneMint
class node_catalog,node_pricing toneRose
class node_quoting,node_estimator,node_claude toneIndigo
class node_api,node_ops,node_worker,node_mongo,node_files,node_s3 toneTeal
```

## Components

### Estimator interface

- [Ops-Hub web](https://github.com/ppanchal5698/cbc-final/blob/master/apps/web/app/(app)/bids/%5Bcode%5D/intake/page.tsx): `apps/web/app/(app)/bids/[code]/intake/page.tsx`

### Document processing

- [Document intake](https://github.com/ppanchal5698/cbc-final/tree/master/apps/backend/src/cbc/modules/intake): `apps/backend/src/cbc/modules/intake`
- [Extraction and review](https://github.com/ppanchal5698/cbc-final/tree/master/apps/backend/src/cbc/modules/extraction): `apps/backend/src/cbc/modules/extraction`

### Bid workflow

- [Bid and autopilot](https://github.com/ppanchal5698/cbc-final/tree/master/apps/backend/src/cbc/modules/projects): `apps/backend/src/cbc/modules/projects`
- [Pipeline runner](https://github.com/ppanchal5698/cbc-final/blob/master/apps/backend/src/cbc/modules/projects/api/pipeline.py): `apps/backend/src/cbc/modules/projects/api/pipeline.py`

### Catalog and pricing

- [Product catalog](https://github.com/ppanchal5698/cbc-final/tree/master/apps/backend/src/cbc/modules/catalog): `apps/backend/src/cbc/modules/catalog`
- [Pricing rules](https://github.com/ppanchal5698/cbc-final/tree/master/apps/backend/src/cbc/modules/pricing): `apps/backend/src/cbc/modules/pricing`

### Quote and proposal

- [Quote and proposal](https://github.com/ppanchal5698/cbc-final/tree/master/apps/backend/src/cbc/modules/quoting): `apps/backend/src/cbc/modules/quoting`

### Runtime operations

- [FastAPI API](https://github.com/ppanchal5698/cbc-final/blob/master/apps/backend/src/cbc/app/main.py): `apps/backend/src/cbc/app/main.py`
- [Jobs and settings](https://github.com/ppanchal5698/cbc-final/tree/master/apps/backend/src/cbc/modules/ops): `apps/backend/src/cbc/modules/ops`
- [Background worker](https://github.com/ppanchal5698/cbc-final/blob/master/apps/backend/src/cbc/app/worker.py): `apps/backend/src/cbc/app/worker.py`
- [MongoDB](https://github.com/ppanchal5698/cbc-final/blob/master/apps/backend/src/cbc/shared/mongo.py): `apps/backend/src/cbc/shared/mongo.py`
- [Project files](https://github.com/ppanchal5698/cbc-final/blob/master/apps/backend/src/cbc/shared/storage.py): `apps/backend/src/cbc/shared/storage.py`
- [S3 storage](https://github.com/ppanchal5698/cbc-final/blob/master/apps/backend/src/cbc/shared/storage_backends.py): `apps/backend/src/cbc/shared/storage_backends.py`

### Other components

- **Estimator**
- **Claude provider**

## Connections

- Estimator → Ops-Hub web: uses
- Ops-Hub web → FastAPI API: proxies requests
- FastAPI API → Document intake: handles intake
- FastAPI API → Extraction and review: handles review
- FastAPI API → Bid and autopilot: handles bids
- FastAPI API → Product catalog: serves catalog
- FastAPI API → Pricing rules: serves pricing
- FastAPI API → Quote and proposal: serves quotes
- FastAPI API → Jobs and settings: manages jobs
- Document intake → Project files: stores documents
- Bid and autopilot → Pipeline runner: starts passes
- Pipeline runner → Jobs and settings: coordinates jobs
- Background worker → MongoDB: claims jobs
- Jobs and settings → MongoDB: persists job state
- Pipeline runner → Claude provider: runs passes
- Extraction and review → Project files: reads and writes artifacts
- Quote and proposal → Project files: stores proposal artifacts
- Product catalog → MongoDB: reads catalog data
- Pricing rules → MongoDB: reads pricing data
- Project files → S3 storage: syncs optionally
