# surenash/quotanic architecture

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

- Interactive diagram: https://gitdiagram.com/surenash/quotanic
- Repository: https://github.com/surenash/quotanic

## Overview

1. **Repository shape**
   - This repo is really two separate front ends plus one main product.
   - **`manfacquot/`** is the production system: a Django backend plus a React/Vite frontend in the same directory.
   - **`front end /`** is a separate React/Vite prototype/AI Studio app and should be treated as an independent UI, not part of the main backend flow.

2. **Main runtime stack in `manfacquot/`**
   - Django is the application core: `gmqp_project/` contains settings, routing, ASGI/WSGI, middleware, and Celery wiring.
   - The backend is organized as a set of Django apps, each with its own `models.py`, `views.py`, `serializers.py`, `urls.py`, and migrations.
   - The frontend is built with React + Vite and TypeScript, with app entry files at the repo root (`index.tsx`, `index.html`, `vite.config.ts`).

3. **Domain boundaries**
   - The major business areas are split into Django apps:
     - **`accounts`**: users, manufacturer/customer profiles, dashboard and settings views.
     - **`designs`**: uploaded part files, CAD analysis orchestration, and matching logic.
     - **`quotes`**: pricing and quote generation.
     - **`orders`**: order lifecycle and payment-related flow.
     - **`reviews`**: post-order feedback.
     - **`notifications`**: event-driven user notifications.
   - This is a modular monolith rather than microservices: the apps share one database and one Django runtime.

4. **CAD ingestion and analysis pipeline**
   - The main technical differentiator is the **FBM engine** under `manfacquot/FBM/`.
   - It processes uploaded CAD files, especially **STEP** and **IGES**, and performs geometry/feature analysis.
   - Supporting modules indicate a pipeline of:
     - geometry analysis
     - feature recognition / pattern recognition
     - machine and material lookup
     - tooling/toolpath optimization
     - simulation and quality checks
     - manufacturing-cost estimation
   - Test assets under `designs/test_data/` confirm that file upload and model analysis are core inputs to the system.

5. **Asynchronous processing boundary**
   - Heavy CAD processing is pushed off the request thread via **Celery** (`gmqp_project/celery.py`).
   - The README calls out **Redis** as the worker broker/runtime dependency.
   - This creates a clear split:
     - synchronous web/API requests handle uploads, CRUD, and status queries
     - background workers handle CAD parsing, analysis, and quote computation

6. **Quotation and pricing flow**
   - The `quotes/` app and `FBM/cost_estimator.py` form the pricing layer.
   - The README’s “14-point costing model” suggests detailed cost breakdowns rather than a single flat quote.
   - Pricing depends on outputs from design analysis plus reference data such as materials, machines, tools, and machining rules.
   - The quote object is therefore downstream of the CAD analysis pipeline and upstream of order placement.

7. **Order and payment flow**
   - `orders/` owns order state, delivery tracking, and payment integration.
   - The README explicitly mentions **Razorpay**, so payment authorization/confirmation is part of the order path.
   - Order creation likely depends on an accepted quote; the order then tracks fulfillment through to shipment/delivery.

8. **Manufacturer portal and operational UI**
   - `accounts/dashboard_views.py` and `manufacturer_settings_views.py` suggest a manufacturer-facing portal for managing profile settings and operational data.
   - Frontend components such as `ManufacturerSettings.tsx`, `UploadPage`, and the various `components/` files indicate a rich, role-aware UI.
   - The system is built around two user groups: customers submitting RFQs/designs, and manufacturers reviewing, quoting, and fulfilling work.

9. **3D visualization**
   - The browser-side 3D viewer lives in `components/Viewer/` and related files like `ModelViewer.tsx`.
   - This is a client-side visualization boundary: it renders uploaded models, likely for preview and inspection, but does not itself perform the manufacturing analysis.
   - The viewer includes its own error/loading scene management, which suggests it is treated as a semi-isolated UI subsystem.

10. **Data persistence and shared assets**
   - Django models and migrations are the system of record for users, designs, quotes, orders, reviews, and notifications.
   - Uploaded media appears to be stored under `public/media` and served through the web stack.
   - Static/frontend support code lives in `utils/`, `types/`, `components/`, and `public/`, while backend logic stays inside Django apps and the FBM package.

11. **Integration and eventing**
   - Notification behavior is likely driven by model signals in `notifications/signals.py`, which is a common event boundary in Django projects.
   - The app-to-app coupling is mostly internal: design status changes can trigger quote generation, order creation, and notifications without leaving the monolith.

12. **Deployment/infrastructure**
   - Production artifacts include `Dockerfile`, `docker-compose.prod.yml`, and Nginx templates, so the main app is container-ready and fronted by Nginx in production.
   - The presence of `amplify.yml` and build logs suggests an AWS Amplify deployment path for at least one frontend.
   - `context/` and the `.agent`/`.gemini` skill directories are documentation/assistant support layers, not runtime product components.

13. **Secondary app**
   - The separate **`front end /`** directory is a standalone React/Vite app with its own package files and entrypoint.
   - It does not share the same backend structure as `manfacquot/`, so for an architecture diagram it should be drawn as a distinct client-side project unless explicitly integrated elsewhere.

14. **Recommended diagram framing**
   - The central diagram should show:
     - browser clients and manufacturer portal
     - Django monolith API
     - Celery worker + Redis
     - FBM analysis engine
     - shared database/media storage
     - Razorpay external payment service
     - optional 3D viewer in the browser as part of the frontend

Main entry points: [`manfacquot/gmqp_project/settings.py`](https://github.com/surenash/quotanic/blob/main/manfacquot/gmqp_project/settings.py) (Django Core), [`manfacquot/designs/models.py`](https://github.com/surenash/quotanic/blob/main/manfacquot/designs/models.py) (Designs), [`manfacquot/index.tsx`](https://github.com/surenash/quotanic/blob/main/manfacquot/index.tsx) (App UI), [`manfacquot/README.md`](https://github.com/surenash/quotanic/blob/main/manfacquot/README.md) (Database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_main["Main Product"]
  node_browser(("Browser<br/>client"))
  node_main_ui["App UI<br/>react-vite<br/>[index.tsx]"]
  node_viewer["3D Viewer<br/>client viewer<br/>[Viewer.tsx]"]
  node_django_core["Django Core<br/>django runtime<br/>[settings.py]"]
  node_accounts["Accounts<br/>django app<br/>[models.py]"]
  node_designs["Designs<br/>django app<br/>[models.py]"]
  node_quotes["Quotes<br/>pricing app<br/>[pricing.py]"]
  node_orders["Orders<br/>order app<br/>[models.py]"]
  node_reviews["Reviews<br/>django app<br/>[models.py]"]
  node_notifications["Notifications<br/>event app<br/>[signals.py]"]
  node_fbm_engine["FBM Engine<br/>analysis pipeline<br/>[FBM_core.py]"]
end

subgraph group_prototype["Prototype UI"]
  node_prototype_ui["Prototype UI<br/>react-vite app<br/>[index.tsx]"]
end

subgraph group_infra["Infra"]
  node_celery_worker["Celery Worker<br/>async jobs<br/>[celery.py]"]
  node_redis[("Redis<br/>broker")]
  node_db[("Database<br/>shared storage<br/>[README.md]")]
  node_media[("Media Store<br/>uploaded assets")]
  node_razorpay(("Razorpay<br/>payment service"))
  node_nginx["Nginx<br/>edge server"]
end

node_browser -->|"uses"| node_main_ui
node_browser -->|"uses"| node_prototype_ui
node_main_ui -->|"renders"| node_viewer
node_main_ui -->|"API calls"| node_django_core
node_django_core -->|"routes"| node_accounts
node_django_core -->|"routes"| node_designs
node_django_core -->|"routes"| node_quotes
node_django_core -->|"routes"| node_orders
node_django_core -->|"routes"| node_reviews
node_django_core -->|"routes"| node_notifications
node_designs -->|"analyzes"| node_fbm_engine
node_designs -->|"queues"| node_celery_worker
node_quotes -->|"prices"| node_fbm_engine
node_quotes -->|"reads/writes"| node_db
node_orders -->|"payments"| node_razorpay
node_orders -->|"reads/writes"| node_db
node_reviews -->|"reads/writes"| node_db
node_notifications -->|"reads/writes"| node_db
node_designs -->|"stores"| node_media
node_django_core -->|"broker"| node_redis
node_nginx -->|"serves"| node_main_ui
node_nginx -->|"proxies"| node_django_core

click node_main_ui "https://github.com/surenash/quotanic/blob/main/manfacquot/index.tsx"
click node_viewer "https://github.com/surenash/quotanic/blob/main/manfacquot/components/Viewer/Viewer.tsx"
click node_django_core "https://github.com/surenash/quotanic/blob/main/manfacquot/gmqp_project/settings.py"
click node_accounts "https://github.com/surenash/quotanic/blob/main/manfacquot/accounts/models.py"
click node_designs "https://github.com/surenash/quotanic/blob/main/manfacquot/designs/models.py"
click node_quotes "https://github.com/surenash/quotanic/blob/main/manfacquot/quotes/pricing.py"
click node_orders "https://github.com/surenash/quotanic/blob/main/manfacquot/orders/models.py"
click node_reviews "https://github.com/surenash/quotanic/blob/main/manfacquot/reviews/models.py"
click node_notifications "https://github.com/surenash/quotanic/blob/main/manfacquot/notifications/signals.py"
click node_fbm_engine "https://github.com/surenash/quotanic/blob/main/manfacquot/FBM/FBM_core.py"
click node_celery_worker "https://github.com/surenash/quotanic/blob/main/manfacquot/gmqp_project/celery.py"
click node_db "https://github.com/surenash/quotanic/blob/main/manfacquot/README.md"
click node_media "https://github.com/surenash/quotanic/tree/main/manfacquot/public/media"
click node_nginx "https://github.com/surenash/quotanic/blob/main/manfacquot/nginx/default.conf.template"
click node_prototype_ui "https://github.com/surenash/quotanic/blob/main/front end /index.tsx"

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_browser,node_main_ui,node_viewer,node_django_core,node_accounts,node_designs,node_quotes,node_orders,node_reviews,node_notifications,node_fbm_engine toneBlue
class node_prototype_ui toneAmber
class node_celery_worker,node_redis,node_db,node_media,node_razorpay,node_nginx toneMint
```

## Components

### Main Product

Production Django monolith in manfacquot/

- **Browser**: client · Customer and manufacturer users
- [App UI](https://github.com/surenash/quotanic/blob/main/manfacquot/index.tsx): react-vite · Primary React/Vite frontend · `manfacquot/index.tsx`
- [3D Viewer](https://github.com/surenash/quotanic/blob/main/manfacquot/components/Viewer/Viewer.tsx): client viewer · Browser-side CAD preview and scene handling · `manfacquot/components/Viewer/Viewer.tsx`
- [Django Core](https://github.com/surenash/quotanic/blob/main/manfacquot/gmqp_project/settings.py): django runtime · Settings, routing, middleware, ASGI/WSGI, Celery wiring · `manfacquot/gmqp_project/settings.py`
- [Accounts](https://github.com/surenash/quotanic/blob/main/manfacquot/accounts/models.py): django app · Users, profiles, dashboard, manufacturer settings · `manfacquot/accounts/models.py`
- [Designs](https://github.com/surenash/quotanic/blob/main/manfacquot/designs/models.py): django app · Uploads, CAD analysis orchestration, matching · `manfacquot/designs/models.py`
- [Quotes](https://github.com/surenash/quotanic/blob/main/manfacquot/quotes/pricing.py): pricing app · Quote generation and pricing breakdowns · `manfacquot/quotes/pricing.py`
- [Orders](https://github.com/surenash/quotanic/blob/main/manfacquot/orders/models.py): order app · Order lifecycle and payment flow · `manfacquot/orders/models.py`
- [Reviews](https://github.com/surenash/quotanic/blob/main/manfacquot/reviews/models.py): django app · Post-order feedback · `manfacquot/reviews/models.py`
- [Notifications](https://github.com/surenash/quotanic/blob/main/manfacquot/notifications/signals.py): event app · Signals-driven user notifications · `manfacquot/notifications/signals.py`
- [FBM Engine](https://github.com/surenash/quotanic/blob/main/manfacquot/FBM/FBM_core.py): analysis pipeline · Geometry, feature, tooling, simulation, and cost estimation · `manfacquot/FBM/FBM_core.py`

### Prototype UI

Standalone React/Vite app in front end /

- [Prototype UI](https://github.com/surenash/quotanic/blob/HEAD/front%20end%20/index.tsx): react-vite app · Standalone React/Vite prototype app · `front end /index.tsx`

### Infra

Shared runtime and external services

- [Celery Worker](https://github.com/surenash/quotanic/blob/main/manfacquot/gmqp_project/celery.py): async jobs · Background execution for heavy CAD and pricing tasks · `manfacquot/gmqp_project/celery.py`
- **Redis**: broker · Celery broker/runtime dependency
- [Database](https://github.com/surenash/quotanic/blob/main/manfacquot/README.md): shared storage · Single Django system of record for business data · `manfacquot/README.md`
- [Media Store](https://github.com/surenash/quotanic/tree/main/manfacquot/public/media): uploaded assets · Uploaded CAD and generated media files · `manfacquot/public/media`
- **Razorpay**: payment service · External payment authorization and confirmation
- [Nginx](https://github.com/surenash/quotanic/blob/main/manfacquot/nginx/default.conf.template): edge server · Production front door and static serving · `manfacquot/nginx/default.conf.template`

## Connections

- Browser → App UI: uses · Primary customer/manufacturer interface
- Browser → Prototype UI: uses · Independent prototype front end
- App UI → 3D Viewer: renders · 3D model preview and inspection
- App UI → Django Core: API calls · App data and workflow requests
- Django Core → Accounts: routes · User and portal features
- Django Core → Designs: routes · Design upload and analysis endpoints
- Django Core → Quotes: routes · Quotation endpoints
- Django Core → Orders: routes · Order and payment endpoints
- Django Core → Reviews: routes · Feedback endpoints
- Django Core → Notifications: routes · Notification-related endpoints and signals
- Designs → FBM Engine: analyzes · CAD parsing and manufacturing intelligence
- Designs → Celery Worker: queues · Heavy analysis runs off-thread
- Quotes → FBM Engine: prices · Cost model consumes analysis outputs
- Quotes → Database: reads/writes · Persist quote records and reference data
- Orders → Razorpay: payments · Payment authorization/confirmation
- Orders → Database: reads/writes · Order state and fulfillment tracking
- Reviews → Database: reads/writes · Stores post-order feedback
- Notifications → Database: reads/writes · Notification records and status
- Designs → Media Store: stores · Uploaded parts and generated assets
- Django Core → Redis: broker · Celery task transport
- Nginx → App UI: serves · Production web entry point
- Nginx → Django Core: proxies · API and application traffic
