# appgitusers/detailing_crm architecture

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

- Interactive diagram: https://gitdiagram.com/appgitusers/detailing_crm
- Repository: https://github.com/appgitusers/detailing_crm

## Overview

#### Purpose and entry points
This is a garage/workshop management system: customer vehicles, service estimates, job cards, inventory/vendor procurement, sales, staff, finance, notifications, and public invoice/estimate sharing. It is a Django backend API plus a Vite/React SPA.

Backend entry points are `backend/manage.py`, routing in `backend/core/urls.py`, and deployment adapters `backend/core/asgi.py` / `backend/core/wsgi.py`. Frontend boots at `frontend/src/main.jsx` and composes routes/UI in `frontend/src/App.jsx`.

#### Frontend application boundary
The React SPA provides authenticated operational screens, plus token-based public document views. Shared API clients isolate browser-to-backend calls under `frontend/src/api/axios.js` and domain modules such as `frontend/src/api/jobcards.js`; access control is represented by `frontend/src/components/RequireAuth.jsx`.

Primary operator workflows live in pages: job-card creation/detail/edit (`frontend/src/pages/JobCards/Create.jsx`, `frontend/src/pages/JobCards/Detail.jsx`), vendor/inventory operations (`frontend/src/pages/Vendors/index.jsx`), and dashboard reporting (`frontend/src/pages/Dashboard/index.jsx`). Public estimate and invoice views are separate from the authenticated layout in `frontend/src/pages/Public/EstimationView.jsx`, `frontend/src/pages/Public/InvoiceView.jsx`, and `frontend/src/pages/Public/SalesInvoiceView.jsx`.

#### Customer, vehicle, and service catalog
`customers` owns customer, garage-owner, and vehicle/asset records, exposed through `backend/apps/customers/models.py`, `backend/apps/customers/serializers.py`, and `backend/apps/customers/views.py`. These records feed estimates and job cards.

`services` defines the service catalog, vehicle-specific pricing, warranties, and service-to-product/stock relationships: `backend/apps/services/models.py`, `backend/apps/services/views.py`, and `backend/apps/services/serializers.py`. Service selection is therefore a boundary between quoting/work execution and inventory consumption.

#### Estimation-to-job-card lifecycle
Estimates are a pre-work commercial document with line items, selected services, vehicle metadata, and share tokens, represented in `backend/apps/estimation/models.py` and exposed through `backend/apps/estimation/views.py`. Its frontend workflow is `frontend/src/pages/Estimation/estimation.jsx` and `frontend/src/pages/Estimation/Detail.jsx`.

Job cards are the execution and billing core. `backend/apps/jobcards/models.py` includes job cards, service statuses, assigned employees, products/usages, payments, sales products, and sales orders. API behavior resides in `backend/apps/jobcards/views.py`, while job-card-specific calculations/document logic is centralized in `backend/apps/jobcards/utils.py`. This stage connects customers/assets, catalog services/products, employees, payments, and invoice sharing.

#### Procurement, inventory, and sales
The `vendors` domain owns vendors, products, inventory, purchase invoices/items, and invoice payments, in `backend/apps/vendors/models.py`, `backend/apps/vendors/views.py`, and `backend/apps/vendors/serializers.py`. Inventory state is changed by procurement and by job-card/service product use; frontend management is consolidated in `frontend/src/pages/Vendors/InventoryTab.jsx` and `frontend/src/pages/Vendors/InvoicesTab.jsx`.

Retail sales are modeled alongside job cards/sales orders, rather than as a separate backend app, in `backend/apps/jobcards/models.py`; the operator UI is `frontend/src/pages/Sales/index.jsx`.

#### Workforce, finance, and settings
`employees` manages staff, roles, attendance, shifts, payroll/advance salary, and incentives (`backend/apps/employees/models.py`, `backend/apps/employees/views.py`). Job-card employee assignment provides the operational link to performance and compensation.

`finance` records expenses and daily balances. Signals and balance utilities indicate finance is updated as a cross-domain side effect: `backend/apps/finance/models.py`, `backend/apps/finance/signals.py`, `backend/apps/finance/balance_utils.py`.

Site-level operational defaults, user profiles, notification behavior, incentive thresholds, and UPI settings are held by `backend/apps/site_settings/models.py` and administered through `backend/apps/site_settings/views.py`.

#### Notifications and runtime infrastructure
Notifications are persisted and exposed by `backend/apps/notifications/models.py` and `backend/apps/notifications/views.py`. Scheduled/background behavior is organized through `backend/apps/notifications/scheduler.py` and `backend/apps/notifications/jobs.py`; WhatsApp integration is isolated in `backend/apps/notifications/whatsapp.py`.

Django is the backend runtime with ORM migrations under each app; dependencies are declared in `backend/requirements.txt`. The frontend is a Node/Vite React build (`frontend/package.json`, `frontend/vite.config.js`). No database, hosting provider, task queue, or WhatsApp vendor is identifiable from the supplied tree.

Main entry points: [`backend/apps/jobcards/models.py`](https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/jobcards/models.py) (Job cards & sales), [`backend/core/urls.py`](https://github.com/appgitusers/detailing_crm/blob/main/backend/core/urls.py) (Django API routing), [`backend/apps/estimation/models.py`](https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/estimation/models.py) (Estimates), [`backend/apps/vendors/models.py`](https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/vendors/models.py) (Vendors & inventory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React SPA"]
  node_spa_boot["SPA bootstrap &amp; routes<br/>React/Vite entry<br/>[main.jsx]"]
  node_auth_guard["Authenticated access<br/>route guard<br/>[RequireAuth.jsx]"]
  node_api_client["API client modules<br/>browser API boundary<br/>[axios.js]"]
  node_operator_workflows["Operator workflows<br/>React pages<br/>[Detail.jsx]"]
  node_public_documents["Public document views<br/>token-based React pages<br/>[InvoiceView.jsx]"]
end

subgraph group_backend["Django API"]
  node_django_routing["Django API routing<br/>HTTP routing<br/>[urls.py]"]
end

subgraph group_operations["Operational domains"]
  node_customers["Customers &amp; vehicles<br/>Django domain<br/>[models.py]"]
  node_service_catalog["Service catalog<br/>Django domain<br/>[models.py]"]
  node_estimation["Estimates<br/>Django domain<br/>[models.py]"]
  node_jobcards{{"Job cards &amp; sales<br/>Django execution core<br/>[models.py]"}}
  node_jobcard_logic["Job-card calculations<br/>domain utilities<br/>[utils.py]"]
  node_vendors_inventory["Vendors &amp; inventory<br/>Django domain<br/>[models.py]"]
  node_employees["Workforce<br/>Django domain<br/>[models.py]"]
end

subgraph group_crosscutting["Cross-cutting services"]
  node_finance["Finance balances<br/>Django domain<br/>[models.py]"]
  node_site_settings["Site settings<br/>Django domain<br/>[models.py]"]
  node_notifications["Notifications<br/>Django integration<br/>[models.py]"]
  node_notification_jobs["Scheduled notification jobs<br/>background scheduler<br/>[scheduler.py]"]
end

node_spa_boot -->|"protects operator routes"| node_auth_guard
node_spa_boot -->|"renders"| node_operator_workflows
node_spa_boot -->|"renders public routes"| node_public_documents
node_operator_workflows -->|"uses"| node_api_client
node_public_documents -->|"uses token requests"| node_api_client
node_api_client -->|"HTTP API"| node_django_routing
node_django_routing -->|"routes domain APIs"| node_customers
node_django_routing -->|"routes domain APIs"| node_estimation
node_django_routing -->|"routes domain APIs"| node_jobcards
node_django_routing -->|"routes domain APIs"| node_vendors_inventory
node_estimation -->|"quotes customer vehicles"| node_customers
node_estimation -->|"selects services"| node_service_catalog
node_estimation -->|"converts to work"| node_jobcards
node_jobcards -->|"serves vehicles"| node_customers
node_jobcards -->|"executes services"| node_service_catalog
node_jobcards -->|"calculates documents"| node_jobcard_logic
node_jobcards -->|"consumes stock"| node_vendors_inventory
node_vendors_inventory -->|"supplies linked products"| node_service_catalog
node_jobcards -->|"assigns staff"| node_employees
node_jobcards -.->|"updates balances"| node_finance
node_vendors_inventory -.->|"procurement side effects"| node_finance
node_jobcards -.->|"emits events"| node_notifications
node_notification_jobs -->|"schedules delivery"| node_notifications
node_site_settings -.->|"configures behavior"| node_notifications

click node_spa_boot "https://github.com/appgitusers/detailing_crm/blob/main/frontend/src/main.jsx"
click node_auth_guard "https://github.com/appgitusers/detailing_crm/blob/main/frontend/src/components/RequireAuth.jsx"
click node_api_client "https://github.com/appgitusers/detailing_crm/blob/main/frontend/src/api/axios.js"
click node_operator_workflows "https://github.com/appgitusers/detailing_crm/blob/main/frontend/src/pages/JobCards/Detail.jsx"
click node_public_documents "https://github.com/appgitusers/detailing_crm/blob/main/frontend/src/pages/Public/InvoiceView.jsx"
click node_django_routing "https://github.com/appgitusers/detailing_crm/blob/main/backend/core/urls.py"
click node_customers "https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/customers/models.py"
click node_service_catalog "https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/services/models.py"
click node_estimation "https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/estimation/models.py"
click node_jobcards "https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/jobcards/models.py"
click node_jobcard_logic "https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/jobcards/utils.py"
click node_vendors_inventory "https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/vendors/models.py"
click node_employees "https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/employees/models.py"
click node_finance "https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/finance/models.py"
click node_site_settings "https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/site_settings/models.py"
click node_notifications "https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/notifications/models.py"
click node_notification_jobs "https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/notifications/scheduler.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_spa_boot,node_auth_guard,node_api_client,node_operator_workflows,node_public_documents toneBlue
class node_django_routing toneAmber
class node_customers,node_service_catalog,node_estimation,node_jobcards,node_jobcard_logic,node_vendors_inventory,node_employees toneMint
class node_finance,node_site_settings,node_notifications,node_notification_jobs toneRose
```

## Components

### React SPA

- [SPA bootstrap & routes](https://github.com/appgitusers/detailing_crm/blob/main/frontend/src/main.jsx): React/Vite entry · `frontend/src/main.jsx`
- [Authenticated access](https://github.com/appgitusers/detailing_crm/blob/main/frontend/src/components/RequireAuth.jsx): route guard · `frontend/src/components/RequireAuth.jsx`
- [API client modules](https://github.com/appgitusers/detailing_crm/blob/main/frontend/src/api/axios.js): browser API boundary · `frontend/src/api/axios.js`
- [Operator workflows](https://github.com/appgitusers/detailing_crm/blob/main/frontend/src/pages/JobCards/Detail.jsx): React pages · Job cards, vendors, inventory, and dashboard operations. · `frontend/src/pages/JobCards/Detail.jsx`
- [Public document views](https://github.com/appgitusers/detailing_crm/blob/main/frontend/src/pages/Public/InvoiceView.jsx): token-based React pages · `frontend/src/pages/Public/InvoiceView.jsx`

### Django API

- [Django API routing](https://github.com/appgitusers/detailing_crm/blob/main/backend/core/urls.py): HTTP routing · `backend/core/urls.py`

### Operational domains

- [Customers & vehicles](https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/customers/models.py): Django domain · `backend/apps/customers/models.py`
- [Service catalog](https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/services/models.py): Django domain · Pricing, warranties, and service-product relationships. · `backend/apps/services/models.py`
- [Estimates](https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/estimation/models.py): Django domain · Pre-work documents with line items and share tokens. · `backend/apps/estimation/models.py`
- [Job cards & sales](https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/jobcards/models.py): Django execution core · Work execution, billing, payments, product usage, and sales orders. · `backend/apps/jobcards/models.py`
- [Job-card calculations](https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/jobcards/utils.py): domain utilities · `backend/apps/jobcards/utils.py`
- [Vendors & inventory](https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/vendors/models.py): Django domain · Products, stock, purchase invoices, and vendor payments. · `backend/apps/vendors/models.py`
- [Workforce](https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/employees/models.py): Django domain · Staff, attendance, payroll, advances, and incentives. · `backend/apps/employees/models.py`

### Cross-cutting services

- [Finance balances](https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/finance/models.py): Django domain · Expenses and daily balances updated by cross-domain effects. · `backend/apps/finance/models.py`
- [Site settings](https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/site_settings/models.py): Django domain · Profiles, defaults, notifications, incentives, and UPI settings. · `backend/apps/site_settings/models.py`
- [Notifications](https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/notifications/models.py): Django integration · Persisted notifications plus scheduled jobs and WhatsApp delivery. · `backend/apps/notifications/models.py`
- [Scheduled notification jobs](https://github.com/appgitusers/detailing_crm/blob/main/backend/apps/notifications/scheduler.py): background scheduler · `backend/apps/notifications/scheduler.py`

## Connections

- SPA bootstrap & routes → Authenticated access: protects operator routes
- SPA bootstrap & routes → Operator workflows: renders
- SPA bootstrap & routes → Public document views: renders public routes
- Operator workflows → API client modules: uses
- Public document views → API client modules: uses token requests
- API client modules → Django API routing: HTTP API
- Django API routing → Customers & vehicles: routes domain APIs
- Django API routing → Estimates: routes domain APIs
- Django API routing → Job cards & sales: routes domain APIs
- Django API routing → Vendors & inventory: routes domain APIs
- Estimates → Customers & vehicles: quotes customer vehicles
- Estimates → Service catalog: selects services
- Estimates → Job cards & sales: converts to work
- Job cards & sales → Customers & vehicles: serves vehicles
- Job cards & sales → Service catalog: executes services
- Job cards & sales → Job-card calculations: calculates documents
- Job cards & sales → Vendors & inventory: consumes stock
- Vendors & inventory → Service catalog: supplies linked products
- Job cards & sales → Workforce: assigns staff
- Job cards & sales → Finance balances: updates balances
- Vendors & inventory → Finance balances: procurement side effects
- Job cards & sales → Notifications: emits events
- Scheduled notification jobs → Notifications: schedules delivery
- Site settings → Notifications: configures behavior
