# abhinash04/ipc-qms architecture

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

- Interactive diagram: https://gitdiagram.com/abhinash04/ipc-qms
- Repository: https://github.com/abhinash04/ipc-qms

## Overview

BRIDGETECH is an end-to-end query-email and case-workflow system for an IPC client. The principal flow is public enquiry intake, Front Office acceptance or rejection, AI-assisted assignment and drafting, reviews, final approval, automatic response dispatch, and closure. The React application serves role-specific workflow and oversight views over an Express API; MongoDB stores cases and related records, while a server-side audit trail records activity. README claims document several capabilities whose implementation files were not sampled, so those branches are included only at subsystem level.

Main entry points: [`backend/src/controllers/queryController.js`](https://github.com/abhinash04/ipc-qms/blob/main/backend/src/controllers/queryController.js) (Case Workflow API), [`backend/src/controllers/mailboxController.js`](https://github.com/abhinash04/ipc-qms/blob/main/backend/src/controllers/mailboxController.js) (Mailbox API), [`frontend/src/App.jsx`](https://github.com/abhinash04/ipc-qms/blob/main/frontend/src/App.jsx) (Role-based Web App), [`backend/src/services/email/mailbox/acceptMessage.js`](https://github.com/abhinash04/ipc-qms/blob/main/backend/src/services/email/mailbox/acceptMessage.js) (Acceptance and Triage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Enquiry Intake"]
  node_mailbox["Front Office Mailbox"]
  node_mailbox_api["Mailbox API"]
  node_accept["Acceptance and Triage<br/>[acceptMessage.js]"]
  node_auto_reply["Auto-reply Routing<br/>[route.js]"]
  node_attachments["Attachment Handling"]
  node_email_delivery["Email Delivery<br/>[caseMail.js]"]
end

subgraph group_workflow["Case Workflow"]
  node_ai["AI Assistance<br/>[gemmaService.js]"]
  node_case_api["Case Workflow API<br/>[queryController.js]"]
  node_workflow_engine["Workflow Engine"]
  node_assignment_clock["Assignment Timers<br/>[assignmentClock.js]"]
  node_auto_transfer["Auto-transfer Scheduler"]
end

subgraph group_platform["API and Identity"]
  node_mongo[("MongoDB Records<br/>[db.js]")]
  node_auth["Authentication and Roles<br/>[verifyToken.js]"]
end

subgraph group_oversight["Audit and Oversight"]
  node_audit[("Audit Trail<br/>[auditService.js]")]
  node_admin["Admin Oversight"]
end

subgraph group_client["Web Application"]
  node_web["Role-based Web App<br/>[App.jsx]"]
  node_case_service["Case API Client"]
end

node_public(("Public Inquirer"))
node_actor(("Staff User"))
node_nic["NICeMail Services"]

node_public -->|"sends enquiry"| node_mailbox
node_mailbox_api -->|"reads mailbox"| node_mailbox
node_mailbox_api -->|"accepts message"| node_accept
node_mailbox_api -->|"routes assessment"| node_auto_reply
node_mailbox_api -.->|"serves attachments"| node_attachments
node_accept -.->|"requests assistance"| node_ai
node_accept -->|"creates case"| node_case_api
node_actor -->|"uses workflow"| node_web
node_web -->|"requests case data"| node_case_service
node_case_service -->|"calls case API"| node_case_api
node_case_api -.->|"records transitions"| node_workflow_engine
node_case_api -->|"runs sweep"| node_auto_transfer
node_auto_transfer -->|"checks assignment time"| node_assignment_clock
node_case_api -->|"requests case mail"| node_email_delivery
node_case_api -->|"reads and writes"| node_mongo
node_auto_transfer -->|"reads case state"| node_mongo
node_mailbox_api -->|"checks availability"| node_mongo
node_actor -->|"authenticates"| node_auth
node_auth -->|"guards access"| node_web
node_case_api -->|"records activity"| node_audit
node_mailbox_api -->|"records decisions"| node_audit
node_admin -.->|"queries trail"| node_audit
node_web -.->|"presents oversight"| node_admin
node_email_delivery -->|"sends response"| node_public
node_email_delivery -.->|"uses configured transport"| node_nic
node_mailbox -.->|"optionally syncs mailbox"| node_nic

click node_mailbox "https://github.com/abhinash04/ipc-qms/tree/main/backend/src/services/email/mailbox"
click node_mailbox_api "https://github.com/abhinash04/ipc-qms/blob/main/backend/src/controllers/mailboxController.js"
click node_accept "https://github.com/abhinash04/ipc-qms/blob/main/backend/src/services/email/mailbox/acceptMessage.js"
click node_auto_reply "https://github.com/abhinash04/ipc-qms/blob/main/backend/src/services/autoReply/route.js"
click node_attachments "https://github.com/abhinash04/ipc-qms/tree/main/backend/src/services/attachments"
click node_ai "https://github.com/abhinash04/ipc-qms/blob/main/backend/src/services/ai/gemmaService.js"
click node_case_api "https://github.com/abhinash04/ipc-qms/blob/main/backend/src/controllers/queryController.js"
click node_workflow_engine "https://github.com/abhinash04/ipc-qms/tree/main/backend/src/services/workflow"
click node_assignment_clock "https://github.com/abhinash04/ipc-qms/blob/main/backend/src/services/query/assignmentClock.js"
click node_auto_transfer "https://github.com/abhinash04/ipc-qms/blob/main/backend/src/services/query/autoTransferScheduler.js"
click node_email_delivery "https://github.com/abhinash04/ipc-qms/blob/main/backend/src/services/email/caseMail.js"
click node_mongo "https://github.com/abhinash04/ipc-qms/blob/main/backend/src/config/db.js"
click node_auth "https://github.com/abhinash04/ipc-qms/blob/main/backend/src/middleware/verifyToken.js"
click node_audit "https://github.com/abhinash04/ipc-qms/blob/main/backend/src/services/audit/auditService.js"
click node_admin "https://github.com/abhinash04/ipc-qms/tree/main/backend/src/services/admin"
click node_web "https://github.com/abhinash04/ipc-qms/blob/main/frontend/src/App.jsx"
click node_case_service "https://github.com/abhinash04/ipc-qms/blob/main/frontend/src/services/api/queryCaseService.js"

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_mailbox,node_mailbox_api,node_accept,node_auto_reply,node_attachments,node_email_delivery,node_actor toneBlue
class node_ai,node_case_api,node_workflow_engine,node_assignment_clock,node_auto_transfer toneAmber
class node_mongo,node_auth toneMint
class node_audit,node_admin toneRose
class node_web,node_case_service,node_public,node_nic toneIndigo
```

## Components

### Enquiry Intake

- [Front Office Mailbox](https://github.com/abhinash04/ipc-qms/tree/main/backend/src/services/email/mailbox): `backend/src/services/email/mailbox`
- [Mailbox API](https://github.com/abhinash04/ipc-qms/blob/main/backend/src/controllers/mailboxController.js): `backend/src/controllers/mailboxController.js`
- [Acceptance and Triage](https://github.com/abhinash04/ipc-qms/blob/main/backend/src/services/email/mailbox/acceptMessage.js): `backend/src/services/email/mailbox/acceptMessage.js`
- [Auto-reply Routing](https://github.com/abhinash04/ipc-qms/blob/main/backend/src/services/autoReply/route.js): `backend/src/services/autoReply/route.js`
- [Attachment Handling](https://github.com/abhinash04/ipc-qms/tree/main/backend/src/services/attachments): `backend/src/services/attachments`
- [Email Delivery](https://github.com/abhinash04/ipc-qms/blob/main/backend/src/services/email/caseMail.js): `backend/src/services/email/caseMail.js`

### Case Workflow

- [AI Assistance](https://github.com/abhinash04/ipc-qms/blob/main/backend/src/services/ai/gemmaService.js): `backend/src/services/ai/gemmaService.js`
- [Case Workflow API](https://github.com/abhinash04/ipc-qms/blob/main/backend/src/controllers/queryController.js): `backend/src/controllers/queryController.js`
- [Workflow Engine](https://github.com/abhinash04/ipc-qms/tree/main/backend/src/services/workflow): `backend/src/services/workflow`
- [Assignment Timers](https://github.com/abhinash04/ipc-qms/blob/main/backend/src/services/query/assignmentClock.js): `backend/src/services/query/assignmentClock.js`
- [Auto-transfer Scheduler](https://github.com/abhinash04/ipc-qms/blob/main/backend/src/services/query/autoTransferScheduler.js): `backend/src/services/query/autoTransferScheduler.js`

### API and Identity

- [MongoDB Records](https://github.com/abhinash04/ipc-qms/blob/main/backend/src/config/db.js): `backend/src/config/db.js`
- [Authentication and Roles](https://github.com/abhinash04/ipc-qms/blob/main/backend/src/middleware/verifyToken.js): `backend/src/middleware/verifyToken.js`

### Audit and Oversight

- [Audit Trail](https://github.com/abhinash04/ipc-qms/blob/main/backend/src/services/audit/auditService.js): `backend/src/services/audit/auditService.js`
- [Admin Oversight](https://github.com/abhinash04/ipc-qms/tree/main/backend/src/services/admin): `backend/src/services/admin`

### Web Application

- [Role-based Web App](https://github.com/abhinash04/ipc-qms/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Case API Client](https://github.com/abhinash04/ipc-qms/blob/main/frontend/src/services/api/queryCaseService.js): `frontend/src/services/api/queryCaseService.js`

### Other components

- **Public Inquirer**
- **Staff User**
- **NICeMail Services**

## Connections

- Public Inquirer → Front Office Mailbox: sends enquiry (evidence: `README.md`)
- Mailbox API → Front Office Mailbox: reads mailbox (evidence: `backend/src/controllers/mailboxController.js`)
- Mailbox API → Acceptance and Triage: accepts message (evidence: `backend/src/controllers/mailboxController.js`)
- Mailbox API → Auto-reply Routing: routes assessment (evidence: `backend/src/controllers/mailboxController.js`)
- Mailbox API → Attachment Handling: serves attachments
- Acceptance and Triage → AI Assistance: requests assistance
- Acceptance and Triage → Case Workflow API: creates case (evidence: `README.md`)
- Staff User → Role-based Web App: uses workflow (evidence: `README.md`)
- Role-based Web App → Case API Client: requests case data (evidence: `frontend/src/services/api/queryCaseService.js`)
- Case API Client → Case Workflow API: calls case API (evidence: `README.md`)
- Case Workflow API → Workflow Engine: records transitions (evidence: `backend/src/controllers/queryController.js`)
- Case Workflow API → Auto-transfer Scheduler: runs sweep (evidence: `backend/src/controllers/queryController.js`)
- Auto-transfer Scheduler → Assignment Timers: checks assignment time (evidence: `backend/src/services/query/autoTransferScheduler.js`)
- Case Workflow API → Email Delivery: requests case mail (evidence: `backend/src/controllers/queryController.js`)
- Case Workflow API → MongoDB Records: reads and writes (evidence: `backend/src/controllers/queryController.js`)
- Auto-transfer Scheduler → MongoDB Records: reads case state (evidence: `backend/src/services/query/autoTransferScheduler.js`)
- Mailbox API → MongoDB Records: checks availability (evidence: `backend/src/controllers/mailboxController.js`)
- Staff User → Authentication and Roles: authenticates (evidence: `README.md`)
- Authentication and Roles → Role-based Web App: guards access (evidence: `README.md`)
- Case Workflow API → Audit Trail: records activity (evidence: `backend/src/controllers/queryController.js`)
- Mailbox API → Audit Trail: records decisions (evidence: `backend/src/controllers/mailboxController.js`)
- Admin Oversight → Audit Trail: queries trail
- Role-based Web App → Admin Oversight: presents oversight
- Email Delivery → Public Inquirer: sends response (evidence: `README.md`)
- Email Delivery → NICeMail Services: uses configured transport (evidence: `README.md`)
- Front Office Mailbox → NICeMail Services: optionally syncs mailbox (evidence: `README.md`)
