# thesolverse/permitflow-nexus architecture

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

- Interactive diagram: https://gitdiagram.com/thesolverse/permitflow-nexus
- Repository: https://github.com/thesolverse/permitflow-nexus

## Overview

PermitFlow Nexus is a Maharashtra industrial-permit and compliance platform for entrepreneurs, government officers, and administrators. The main journey is project setup, rules-based approval discovery, document submission and validation, application review and inspection, then ongoing compliance and incentive discovery. The map combines documented product capabilities with evidenced frontend, API, persistence, and AI components. Several feature pages were not sampled; their inclusion and broad workflow links rely on the README, not inspection of their implementations.

Main entry points: [`src/context/AppContext.tsx`](https://github.com/thesolverse/permitflow-nexus/blob/main/src/context/AppContext.tsx) (Shared App State), [`src/App.tsx`](https://github.com/thesolverse/permitflow-nexus/blob/main/src/App.tsx) (Role-Based App), [`src/components/entrepreneur/SmartChecklistPage.tsx`](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/SmartChecklistPage.tsx) (Approval Checklist), [`src/components/entrepreneur/ApplyApprovalModal.tsx`](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/ApplyApprovalModal.tsx) (Application Submission)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portal["Portal and State"]
  node_app["Role-Based App<br/>[App.tsx]"]
  node_login["Login and Roles<br/>[LoginPage.tsx]"]
  node_app_state["Shared App State<br/>[AppContext.tsx]"]
end

subgraph group_entrepreneur["Entrepreneur Journey"]
  node_project_setup["Project Setup<br/>[NewProjectForm.tsx]"]
  node_checklist["Approval Checklist"]
  node_application["Application Submission"]
  node_documents["Document Centre"]
  node_tracking["Application Tracking"]
  node_compliance["Compliance Calendar"]
  node_incentives["Incentive Finder"]
  node_assistant["AI Assistant"]
end

subgraph group_government["Government Operations"]
  node_officer_review["Application Review"]
  node_inspections["Inspection Management"]
  node_officer_queries["Query Management"]
  node_analytics["SLA Analytics"]
  node_admin_rules["Rules Administration"]
  node_notifications["Notification Centre"]
  node_audit["Audit Logs<br/>[AuditLogsPage.tsx]"]
end

subgraph group_platform["Platform Services"]
  node_rules["Rules Engine<br/>[rulesEngine.ts]"]
  node_ocr["OCR Validation<br/>[realOcrAnalyzer.ts]"]
  node_risk["Risk Guidance<br/>[riskCalculator.ts]"]
  node_regulatory["Regulatory Knowledge"]
end

subgraph group_backend["API and Persistence"]
  node_api_client["REST Client<br/>[api.ts]"]
  node_api_server["Express API<br/>[server.ts]"]
  node_queries["Data Queries<br/>[queries.ts]"]
  node_db_pool["Database Pool<br/>[pool.ts]"]
  node_database[("Application Database<br/>[pool.ts]")]
end

node_entrepreneur_actor(("Entrepreneur"))
node_officer_actor(("Government Officer"))
node_admin_actor(("Platform Admin"))

node_entrepreneur_actor -->|"uses portal"| node_app
node_officer_actor -->|"uses portal"| node_app
node_admin_actor -->|"uses portal"| node_app
node_app -->|"routes to"| node_login
node_app -->|"reads state"| node_app_state
node_app_state -->|"fetches data"| node_api_client
node_entrepreneur_actor -->|"registers project"| node_project_setup
node_project_setup -.->|"updates project"| node_app_state
node_app_state -.->|"supplies project"| node_checklist
node_checklist -->|"uses rules"| node_rules
node_checklist -->|"starts application"| node_application
node_entrepreneur_actor -->|"submits documents"| node_documents
node_application -->|"validates documents"| node_ocr
node_application -->|"sends application"| node_api_client
node_app_state -.->|"supplies status"| node_tracking
node_entrepreneur_actor -->|"monitors renewals"| node_compliance
node_entrepreneur_actor -->|"discovers incentives"| node_incentives
node_entrepreneur_actor -->|"reviews guidance"| node_risk
node_entrepreneur_actor -->|"asks questions"| node_assistant
node_officer_actor -->|"reviews applications"| node_officer_review
node_officer_actor -->|"manages inspections"| node_inspections
node_officer_actor -->|"handles queries"| node_officer_queries
node_officer_actor -->|"reviews SLAs"| node_analytics
node_admin_actor -->|"configures rules"| node_admin_rules
node_admin_rules -->|"adds rules"| node_app_state
node_admin_actor -->|"manages alerts"| node_notifications
node_admin_actor -->|"reviews actions"| node_audit
node_api_client -->|"calls REST API"| node_api_server
node_api_server -->|"calls queries"| node_queries
node_queries -->|"uses connection"| node_db_pool
node_db_pool -->|"connects to"| node_database
node_api_server -->|"queries knowledge"| node_regulatory

click node_app "https://github.com/thesolverse/permitflow-nexus/blob/main/src/App.tsx"
click node_login "https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/auth/LoginPage.tsx"
click node_app_state "https://github.com/thesolverse/permitflow-nexus/blob/main/src/context/AppContext.tsx"
click node_project_setup "https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/NewProjectForm.tsx"
click node_checklist "https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/SmartChecklistPage.tsx"
click node_rules "https://github.com/thesolverse/permitflow-nexus/blob/main/src/utils/rulesEngine.ts"
click node_application "https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/ApplyApprovalModal.tsx"
click node_documents "https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/DocumentCentrePage.tsx"
click node_ocr "https://github.com/thesolverse/permitflow-nexus/blob/main/src/utils/realOcrAnalyzer.ts"
click node_tracking "https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/ApplicationTrackerPage.tsx"
click node_compliance "https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/ComplianceCalendarPage.tsx"
click node_incentives "https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/IncentiveFinderPage.tsx"
click node_risk "https://github.com/thesolverse/permitflow-nexus/blob/main/src/utils/riskCalculator.ts"
click node_assistant "https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/AiAssistantPage.tsx"
click node_officer_review "https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/officer/ApplicationReviewModal.tsx"
click node_inspections "https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/officer/OfficerInspectionPage.tsx"
click node_officer_queries "https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/officer/OfficerQueryPage.tsx"
click node_analytics "https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/officer/SlaAnalyticsPage.tsx"
click node_admin_rules "https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/admin/RulesEngineManager.tsx"
click node_notifications "https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/admin/NotificationCentrePage.tsx"
click node_audit "https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/admin/AuditLogsPage.tsx"
click node_api_client "https://github.com/thesolverse/permitflow-nexus/blob/main/src/services/api.ts"
click node_api_server "https://github.com/thesolverse/permitflow-nexus/blob/main/server/server.ts"
click node_queries "https://github.com/thesolverse/permitflow-nexus/blob/main/server/db/queries.ts"
click node_db_pool "https://github.com/thesolverse/permitflow-nexus/blob/main/server/db/pool.ts"
click node_regulatory "https://github.com/thesolverse/permitflow-nexus/blob/main/server/ai/regulatoryKnowledge.ts"
click node_database "https://github.com/thesolverse/permitflow-nexus/blob/main/server/db/pool.ts"

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_app,node_login,node_app_state toneBlue
class node_project_setup,node_checklist,node_application,node_documents,node_tracking,node_compliance,node_incentives,node_assistant toneAmber
class node_officer_review,node_inspections,node_officer_queries,node_analytics,node_admin_rules,node_notifications,node_audit toneMint
class node_rules,node_ocr,node_risk,node_regulatory toneRose
class node_api_client,node_api_server,node_queries,node_db_pool,node_database,node_entrepreneur_actor,node_officer_actor,node_admin_actor toneIndigo
```

## Components

### Portal and State

- [Role-Based App](https://github.com/thesolverse/permitflow-nexus/blob/main/src/App.tsx): `src/App.tsx`
- [Login and Roles](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/auth/LoginPage.tsx): `src/components/auth/LoginPage.tsx`
- [Shared App State](https://github.com/thesolverse/permitflow-nexus/blob/main/src/context/AppContext.tsx): `src/context/AppContext.tsx`

### Entrepreneur Journey

- [Project Setup](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/NewProjectForm.tsx): `src/components/entrepreneur/NewProjectForm.tsx`
- [Approval Checklist](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/SmartChecklistPage.tsx): `src/components/entrepreneur/SmartChecklistPage.tsx`
- [Application Submission](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/ApplyApprovalModal.tsx): `src/components/entrepreneur/ApplyApprovalModal.tsx`
- [Document Centre](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/DocumentCentrePage.tsx): `src/components/entrepreneur/DocumentCentrePage.tsx`
- [Application Tracking](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/ApplicationTrackerPage.tsx): `src/components/entrepreneur/ApplicationTrackerPage.tsx`
- [Compliance Calendar](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/ComplianceCalendarPage.tsx): `src/components/entrepreneur/ComplianceCalendarPage.tsx`
- [Incentive Finder](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/IncentiveFinderPage.tsx): `src/components/entrepreneur/IncentiveFinderPage.tsx`
- [AI Assistant](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/entrepreneur/AiAssistantPage.tsx): `src/components/entrepreneur/AiAssistantPage.tsx`

### Government Operations

- [Application Review](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/officer/ApplicationReviewModal.tsx): `src/components/officer/ApplicationReviewModal.tsx`
- [Inspection Management](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/officer/OfficerInspectionPage.tsx): `src/components/officer/OfficerInspectionPage.tsx`
- [Query Management](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/officer/OfficerQueryPage.tsx): `src/components/officer/OfficerQueryPage.tsx`
- [SLA Analytics](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/officer/SlaAnalyticsPage.tsx): `src/components/officer/SlaAnalyticsPage.tsx`
- [Rules Administration](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/admin/RulesEngineManager.tsx): `src/components/admin/RulesEngineManager.tsx`
- [Notification Centre](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/admin/NotificationCentrePage.tsx): `src/components/admin/NotificationCentrePage.tsx`
- [Audit Logs](https://github.com/thesolverse/permitflow-nexus/blob/main/src/components/admin/AuditLogsPage.tsx): `src/components/admin/AuditLogsPage.tsx`

### Platform Services

- [Rules Engine](https://github.com/thesolverse/permitflow-nexus/blob/main/src/utils/rulesEngine.ts): `src/utils/rulesEngine.ts`
- [OCR Validation](https://github.com/thesolverse/permitflow-nexus/blob/main/src/utils/realOcrAnalyzer.ts): `src/utils/realOcrAnalyzer.ts`
- [Risk Guidance](https://github.com/thesolverse/permitflow-nexus/blob/main/src/utils/riskCalculator.ts): `src/utils/riskCalculator.ts`
- [Regulatory Knowledge](https://github.com/thesolverse/permitflow-nexus/blob/main/server/ai/regulatoryKnowledge.ts): `server/ai/regulatoryKnowledge.ts`

### API and Persistence

- [REST Client](https://github.com/thesolverse/permitflow-nexus/blob/main/src/services/api.ts): `src/services/api.ts`
- [Express API](https://github.com/thesolverse/permitflow-nexus/blob/main/server/server.ts): `server/server.ts`
- [Data Queries](https://github.com/thesolverse/permitflow-nexus/blob/main/server/db/queries.ts): `server/db/queries.ts`
- [Database Pool](https://github.com/thesolverse/permitflow-nexus/blob/main/server/db/pool.ts): `server/db/pool.ts`
- [Application Database](https://github.com/thesolverse/permitflow-nexus/blob/main/server/db/pool.ts): `server/db/pool.ts`

### Other components

- **Entrepreneur**
- **Government Officer**
- **Platform Admin**

## Connections

- Entrepreneur → Role-Based App: uses portal
- Government Officer → Role-Based App: uses portal
- Platform Admin → Role-Based App: uses portal
- Role-Based App → Login and Roles: routes to (evidence: `src/App.tsx`)
- Role-Based App → Shared App State: reads state (evidence: `src/App.tsx`)
- Shared App State → REST Client: fetches data (evidence: `src/context/AppContext.tsx`)
- Entrepreneur → Project Setup: registers project
- Project Setup → Shared App State: updates project
- Shared App State → Approval Checklist: supplies project (evidence: `src/components/entrepreneur/SmartChecklistPage.tsx`)
- Approval Checklist → Rules Engine: uses rules (evidence: `src/components/entrepreneur/SmartChecklistPage.tsx`)
- Approval Checklist → Application Submission: starts application (evidence: `src/components/entrepreneur/SmartChecklistPage.tsx`)
- Entrepreneur → Document Centre: submits documents
- Application Submission → OCR Validation: validates documents (evidence: `src/components/entrepreneur/ApplyApprovalModal.tsx`)
- Application Submission → REST Client: sends application (evidence: `src/components/entrepreneur/ApplyApprovalModal.tsx`)
- Shared App State → Application Tracking: supplies status
- Entrepreneur → Compliance Calendar: monitors renewals
- Entrepreneur → Incentive Finder: discovers incentives
- Entrepreneur → Risk Guidance: reviews guidance
- Entrepreneur → AI Assistant: asks questions
- Government Officer → Application Review: reviews applications
- Government Officer → Inspection Management: manages inspections
- Government Officer → Query Management: handles queries
- Government Officer → SLA Analytics: reviews SLAs
- Platform Admin → Rules Administration: configures rules
- Rules Administration → Shared App State: adds rules (evidence: `src/components/admin/RulesEngineManager.tsx`)
- Platform Admin → Notification Centre: manages alerts
- Platform Admin → Audit Logs: reviews actions
- REST Client → Express API: calls REST API
- Express API → Data Queries: calls queries (evidence: `server/server.ts`)
- Data Queries → Database Pool: uses connection (evidence: `server/db/queries.ts`)
- Database Pool → Application Database: connects to (evidence: `server/db/pool.ts`)
- Express API → Regulatory Knowledge: queries knowledge (evidence: `server/server.ts`)
