How haaaarssssh/mis works
Purpose and entry points
Pariman Hub is a unified CRM and Income Tax Return (ITR) management system. It exposes a Flask API backed by PostgreSQL and a React/Vite single-page application. Backend startup is backend/app.py; frontend bootstraps at frontend/src/main.jsx and route composition is centered in frontend/src/App.jsx.
Runtime and deployment boundary
Docker Compose runs PostgreSQL, a Gunicorn-hosted Flask backend on port 5001, and an Nginx-served production frontend on port 3000. Local frontend development uses Vite and proxies /api to the backend. Primary deployment/runtime artifacts are docker-compose.yml, backend/Dockerfile, frontend/Dockerfile, and .github/workflows/deploy.yml.
Backend application composition
The Flask application initializes shared extensions and registers domain blueprints. backend/app.py is the HTTP composition root; backend/extensions.py holds cross-cutting application integrations; backend/models.py defines the persistence domain. API areas are split by business capability rather than a single controller layer.
Authentication, authorization, and protected access
Authentication endpoints and credential/session mechanics reside in backend/auth_bp.py and backend/auth_helpers.py. Client/staff access is guarded at backend boundaries, including document-specific access workflows in backend/document_access_bp.py. The frontend establishes client-side auth state and route protection through frontend/src/context/AuthContext.jsx and frontend/src/components/layouts/ProtectedLayout.jsx; server authorization remains the enforcement boundary.
CRM, staff, and work-management domains
Client lifecycle and CRM operations are served by backend/client_bp.py, with user-facing CRM/client views such as frontend/src/pages/CrmDashboard.jsx, frontend/src/pages/Client360.jsx, and frontend/src/pages/ClientOnboarding.jsx. Staff operations use backend/staff_bp.py; shared task/work queues use backend/todo_bp.py and frontend/src/pages/UniversalTodoModule.jsx. These domains converge around client records, staff allocations, and operational task status.
ITR workflow and document delivery
ITR-specific API operations are isolated in backend/itr_bp.py. The frontend provides upload, allocation, status, analytics, and staff/admin boards in frontend/src/pages/ItrUpload.jsx, frontend/src/pages/ItrAllocations.jsx, and frontend/src/pages/ItrModule.jsx. Document viewing and delivery are handled through client document UI components such as frontend/src/components/ClientDocuments.jsx and frontend/src/components/SecurePdfViewer.jsx, crossing the protected document-access API boundary.
Policy, library, notifications, and correspondence
Supporting operational modules are independently exposed: policies via backend/policy_bp.py, shared library content via backend/library_bp.py, and in-app notifications via backend/notify_bp.py plus backend/notifications.py. Letter generation spans backend templates in backend/letter_templates/ and frontend composition/export paths in frontend/src/components/LetterGenerator.jsx and frontend/src/utils/letterFill.js.
Persistence and data movement
PostgreSQL schema evolution is managed by Alembic under backend/migrations/, while ORM entities live in backend/models.py. Existing-data ingestion/migration utilities are separate operational paths: backend/etl_from_sql.py, backend/etl_migration.py, and backend/load_backup.py. This keeps one-time or administrative data movement outside normal API request handling.
Main entry points: app.py Flask composition root · App.jsx Application routes · docker-compose.yml Docker Compose · client_bp.py CRM & staff APIs
Components 22
Runtime & Delivery
- Docker Compose · Runs database, API, and production frontend.
docker-compose.yml - Deploy workflow
.github/workflows/deploy.yml - Nginx frontend
frontend/Dockerfile - Gunicorn API
backend/Dockerfile
React Frontend
- SPA bootstrap & routes
frontend/src/main.jsx - Application routes
frontend/src/App.jsx - Auth state & protected routes · Client-side state and route gating; API remains authoritative.
frontend/src/context/AuthContext.jsx - CRM client workspace
frontend/src/pages/Client360.jsx - ITR workflow UI
frontend/src/pages/ItrModule.jsx - Secure document viewer
frontend/src/components/SecurePdfViewer.jsx - Work queue UI
frontend/src/pages/UniversalTodoModule.jsx
Flask API
- Flask composition root · Initializes extensions and registers domain blueprints.
backend/app.py - Shared extensions
backend/extensions.py - Authentication & access · Credentials, sessions, and protected access boundaries.
backend/auth_bp.py - CRM & staff APIs · Client lifecycle, staff operations, and task management.
backend/client_bp.py - ITR API
backend/itr_bp.py - Document access API · Enforces document-specific access workflows.
backend/document_access_bp.py - Operational content APIs · Policy, library, notifications, and correspondence support.
backend/notify_bp.py
Data & Operations
- ORM domain models
backend/models.py - PostgreSQL
- Alembic migrations
backend/migrations/env.py - Data ingestion utilities · Separate from normal API request handling.
backend/etl_migration.py
Connections 29
- Deploy workflow → Docker Compose: deploys
- Docker Compose → Nginx frontend: runs
- Docker Compose → Gunicorn API: runs
- Docker Compose → PostgreSQL: runs
- Nginx frontend → SPA bootstrap & routes: serves
- Gunicorn API → Flask composition root: hosts
- SPA bootstrap & routes → Application routes: boots
- Application routes → Auth state & protected routes: guards routes with
- Application routes → CRM client workspace: renders
- Application routes → ITR workflow UI: renders
- Application routes → Secure document viewer: renders
- Application routes → Work queue UI: renders
- Auth state & protected routes → Authentication & access: authenticates via
- CRM client workspace → CRM & staff APIs: uses
- ITR workflow UI → ITR API: uses
- Secure document viewer → Document access API: uses
- Work queue UI → CRM & staff APIs: uses
- Flask composition root → Shared extensions: initializes
- Flask composition root → Authentication & access: registers
- Flask composition root → CRM & staff APIs: registers
- Flask composition root → ITR API: registers
- Flask composition root → Document access API: registers
- Flask composition root → Operational content APIs: registers
- CRM & staff APIs → ORM domain models: uses
- ITR API → ORM domain models: uses
- Document access API → ORM domain models: uses
- ORM domain models → PostgreSQL: persists to
- Alembic migrations → PostgreSQL: evolves schema
- Data ingestion utilities → PostgreSQL: imports administrative data