# arshad1428/ticketflow architecture

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

- Interactive diagram: https://gitdiagram.com/arshad1428/ticketflow
- Repository: https://github.com/arshad1428/ticketflow

## Overview

TicketFlow is a client-and-staff ticketing portal backed by an Express API and PostgreSQL. The main workflow is client ticket creation, staff assignment and replies, business-calendar SLA tracking and escalation, then resolution, rating or reopening. The portal also exposes administration, reports, security settings and knowledge-base content; the server supports inbound email, queued SMTP delivery, attachment scanning, licensing and extension hooks. The API is concentrated in app.js. Relationships involving the UI are documented at the product level; unsampled implementation details are not inferred.

Main entry points: [`server/src/app.js`](https://github.com/arshad1428/ticketflow/blob/master/server/src/app.js) (Express API), [`server/src/worker.js`](https://github.com/arshad1428/ticketflow/blob/master/server/src/worker.js) (Background worker), [`client/src/main.jsx`](https://github.com/arshad1428/ticketflow/blob/master/client/src/main.jsx) (React portal), [`server/src/db.js`](https://github.com/arshad1428/ticketflow/blob/master/server/src/db.js) (PostgreSQL)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_portal["React portal<br/>[main.jsx]"]
end

subgraph group_tickets["Ticket operations"]
  node_api["Express API<br/>[app.js]"]
  node_ticketflow["Ticket lifecycle<br/>[app.js]"]
  node_admin["Administration<br/>[app.js]"]
  node_insights["Reports and alerts<br/>[app.js]"]
end

subgraph group_platform["Platform and security"]
  node_mfa["MFA security<br/>[mfa.js]"]
  node_licensing["License validation<br/>[license.js]"]
  node_extensions["Extension hooks<br/>[index.js]"]
  node_runtime["Server runtime<br/>[index.js]"]
end

subgraph group_service["SLA and messaging"]
  node_sla["Business-time SLA<br/>[sla.js]"]
  node_worker["Background worker<br/>[worker.js]"]
  node_mailout["Mail outbox<br/>[worker.js]"]
end

subgraph group_integrations["Integrations and storage"]
  node_scanner["Upload scanning<br/>[scanner.js]"]
  node_database[("PostgreSQL<br/>[db.js]")]
end

node_clients(("Clients"))
node_staff(("Support staff"))
node_smtp["SMTP service"]
node_clamav["ClamAV scanner"]
node_mailprovider["Mail provider"]

node_clients -->|"use portal"| node_portal
node_staff -->|"use workspace"| node_portal
node_portal -->|"request API"| node_api
node_api -->|"routes tickets"| node_ticketflow
node_api -->|"routes administration"| node_admin
node_api -.->|"serves reports"| node_insights
node_api -->|"queries and writes"| node_database
node_api -->|"validates MFA"| node_mfa
node_api -->|"validates license"| node_licensing
node_api -->|"runs hooks"| node_extensions
node_api -->|"scans uploads"| node_scanner
node_api -->|"computes SLA"| node_sla
node_api -.->|"notifies worker"| node_worker
node_ticketflow -->|"stores ticket data"| node_database
node_ticketflow -->|"invokes ticket hook"| node_extensions
node_scanner -->|"scans bytes"| node_clamav
node_runtime -->|"starts server"| node_api
node_runtime -->|"schedules ticks"| node_worker
node_worker -->|"reads and updates"| node_database
node_worker -->|"computes elapsed time"| node_sla
node_worker -->|"uses config and notifications"| node_api
node_worker -->|"delivers queued mail"| node_mailout
node_mailout -->|"sends email"| node_smtp
node_mailprovider -->|"posts inbound mail"| node_api

click node_portal "https://github.com/arshad1428/ticketflow/blob/master/client/src/main.jsx"
click node_api "https://github.com/arshad1428/ticketflow/blob/master/server/src/app.js"
click node_ticketflow "https://github.com/arshad1428/ticketflow/blob/master/server/src/app.js"
click node_admin "https://github.com/arshad1428/ticketflow/blob/master/server/src/app.js"
click node_insights "https://github.com/arshad1428/ticketflow/blob/master/server/src/app.js"
click node_sla "https://github.com/arshad1428/ticketflow/blob/master/server/src/sla.js"
click node_worker "https://github.com/arshad1428/ticketflow/blob/master/server/src/worker.js"
click node_mailout "https://github.com/arshad1428/ticketflow/blob/master/server/src/worker.js"
click node_mfa "https://github.com/arshad1428/ticketflow/blob/master/server/src/mfa.js"
click node_licensing "https://github.com/arshad1428/ticketflow/blob/master/server/src/license.js"
click node_extensions "https://github.com/arshad1428/ticketflow/blob/master/server/src/modules/index.js"
click node_scanner "https://github.com/arshad1428/ticketflow/blob/master/server/src/scanner.js"
click node_database "https://github.com/arshad1428/ticketflow/blob/master/server/src/db.js"
click node_runtime "https://github.com/arshad1428/ticketflow/blob/master/server/src/index.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_portal,node_clients toneBlue
class node_api,node_ticketflow,node_admin,node_insights toneAmber
class node_mfa,node_licensing,node_extensions,node_runtime toneMint
class node_sla,node_worker,node_mailout toneRose
class node_scanner,node_database,node_staff,node_smtp,node_clamav,node_mailprovider toneIndigo
```

## Components

### User experience

- [React portal](https://github.com/arshad1428/ticketflow/blob/master/client/src/main.jsx): `client/src/main.jsx`

### Ticket operations

- [Express API](https://github.com/arshad1428/ticketflow/blob/master/server/src/app.js): `server/src/app.js`
- [Ticket lifecycle](https://github.com/arshad1428/ticketflow/blob/master/server/src/app.js): `server/src/app.js`
- [Administration](https://github.com/arshad1428/ticketflow/blob/master/server/src/app.js): `server/src/app.js`
- [Reports and alerts](https://github.com/arshad1428/ticketflow/blob/master/server/src/app.js): `server/src/app.js`

### Platform and security

- [MFA security](https://github.com/arshad1428/ticketflow/blob/master/server/src/mfa.js): `server/src/mfa.js`
- [License validation](https://github.com/arshad1428/ticketflow/blob/master/server/src/license.js): `server/src/license.js`
- [Extension hooks](https://github.com/arshad1428/ticketflow/blob/master/server/src/modules/index.js): `server/src/modules/index.js`
- [Server runtime](https://github.com/arshad1428/ticketflow/blob/master/server/src/index.js): `server/src/index.js`

### SLA and messaging

- [Business-time SLA](https://github.com/arshad1428/ticketflow/blob/master/server/src/sla.js): `server/src/sla.js`
- [Background worker](https://github.com/arshad1428/ticketflow/blob/master/server/src/worker.js): `server/src/worker.js`
- [Mail outbox](https://github.com/arshad1428/ticketflow/blob/master/server/src/worker.js): `server/src/worker.js`

### Integrations and storage

- [Upload scanning](https://github.com/arshad1428/ticketflow/blob/master/server/src/scanner.js): `server/src/scanner.js`
- [PostgreSQL](https://github.com/arshad1428/ticketflow/blob/master/server/src/db.js): `server/src/db.js`

### Other components

- **Clients**
- **Support staff**
- **SMTP service**
- **ClamAV scanner**
- **Mail provider**

## Connections

- Clients → React portal: use portal (evidence: `README.md`)
- Support staff → React portal: use workspace (evidence: `README.md`)
- React portal → Express API: request API (evidence: `README.md`)
- Express API → Ticket lifecycle: routes tickets (evidence: `server/src/app.js`)
- Express API → Administration: routes administration (evidence: `server/src/app.js`)
- Express API → Reports and alerts: serves reports (evidence: `server/src/app.js`)
- Express API → PostgreSQL: queries and writes (evidence: `server/src/app.js`)
- Express API → MFA security: validates MFA (evidence: `server/src/app.js`)
- Express API → License validation: validates license (evidence: `server/src/app.js`)
- Express API → Extension hooks: runs hooks (evidence: `server/src/app.js`)
- Express API → Upload scanning: scans uploads (evidence: `server/src/app.js`)
- Express API → Business-time SLA: computes SLA (evidence: `server/src/app.js`)
- Express API → Background worker: notifies worker (evidence: `server/src/worker.js`)
- Ticket lifecycle → PostgreSQL: stores ticket data (evidence: `server/src/app.js`)
- Ticket lifecycle → Extension hooks: invokes ticket hook (evidence: `server/src/app.js`)
- Upload scanning → ClamAV scanner: scans bytes (evidence: `server/src/scanner.js`)
- Server runtime → Express API: starts server (evidence: `server/src/index.js`)
- Server runtime → Background worker: schedules ticks (evidence: `server/src/index.js`)
- Background worker → PostgreSQL: reads and updates (evidence: `server/src/worker.js`)
- Background worker → Business-time SLA: computes elapsed time (evidence: `server/src/worker.js`)
- Background worker → Express API: uses config and notifications (evidence: `server/src/worker.js`)
- Background worker → Mail outbox: delivers queued mail (evidence: `server/src/worker.js`)
- Mail outbox → SMTP service: sends email (evidence: `server/src/worker.js`)
- Mail provider → Express API: posts inbound mail (evidence: `README.md`)
