System Architecture
===================
High-Level Architecture
-----------------------
.. mermaid::
graph TB
subgraph Clients
WEB[Web Dashboard
Central Ops / Finance / Procurement / OEM Reporting]
MOB[Mobile App
Field Teams]
OEM_PORTAL[OEM Portal
Lead Submission & Reports]
CUST[Customer Interface
SMS / WhatsApp / Email]
end
subgraph API Layer
GW[API Gateway
JWT Auth + Rate Limiting]
API[Django REST Framework
api/v1/]
end
subgraph Django Apps
ACC[accounts]
LED[leads]
SRV[surveys]
INS[installations]
PRO[procurement]
FIN[finance]
REP[reporting]
NOT[notifications]
EMG[emergency]
end
subgraph Data Layer
DB[(PostgreSQL)]
MEDIA[Media Storage
S3 / MinIO]
CACHE[Redis
Cache + Celery Broker]
end
subgraph External Services
SMS[SMS Gateway]
WA[WhatsApp API]
EMAIL[Email Service]
PAY[Payment Gateway
UPI / Bank Transfer]
end
WEB --> GW
MOB --> GW
OEM_PORTAL --> GW
GW --> API
API --> ACC
API --> LED
API --> SRV
API --> INS
API --> PRO
API --> FIN
API --> REP
API --> NOT
API --> EMG
ACC --> DB
LED --> DB
SRV --> DB
INS --> DB
PRO --> DB
FIN --> DB
REP --> DB
NOT --> DB
EMG --> DB
SRV --> MEDIA
INS --> MEDIA
NOT --> SMS
NOT --> WA
NOT --> EMAIL
FIN --> PAY
API --> CACHE
Technology Stack
----------------
.. list-table::
:header-rows: 1
:widths: 30 70
* - Component
- Technology
* - Backend Framework
- Django 5.x + Django REST Framework
* - Database
- PostgreSQL 16
* - Task Queue
- Celery + Redis
* - Media Storage
- S3-compatible (AWS S3 or MinIO for local dev)
* - Authentication
- JWT (SimpleJWT)
* - API Documentation
- drf-spectacular (OpenAPI 3.0)
* - Notifications
- SMS gateway, WhatsApp Business API, SMTP
* - Payments
- UPI integration, bank transfer APIs
* - Containerization
- Docker + Docker Compose
* - Package Manager
- uv
App Dependency Graph
--------------------
.. mermaid::
graph LR
accounts --> |"no deps"|accounts
leads --> accounts
surveys --> leads
surveys --> accounts
installations --> surveys
installations --> accounts
procurement --> installations
finance --> procurement
finance --> accounts
reporting --> leads
reporting --> surveys
reporting --> installations
notifications --> accounts
emergency --> accounts
emergency --> surveys
emergency --> installations