# rutvi23/ticket-flow architecture

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

- Interactive diagram: https://gitdiagram.com/rutvi23/ticket-flow
- Repository: https://github.com/rutvi23/ticket-flow

## Overview

TicketFlow is a customer-and-agent helpdesk: users authenticate, create and find tickets, then inspect ticket details, exchange comments, and (as agents) assign tickets or advance their status. The React client calls an Express REST API, whose controllers enforce ownership and workflow rules and persist data in MySQL. Other documented capabilities include category management, filtered/paginated ticket lists, and dashboard statistics. The graph includes these major branches; links for unsampled modules rely on the README or SOURCE INDEX references.

Main entry points: [`client/src/App.jsx`](https://github.com/rutvi23/ticket-flow/blob/main/client/src/App.jsx) (App routes), [`client/src/api.js`](https://github.com/rutvi23/ticket-flow/blob/main/client/src/api.js) (API client), [`server/src/config/db.js`](https://github.com/rutvi23/ticket-flow/blob/main/server/src/config/db.js) (MySQL pool), [`server/src/app.js`](https://github.com/rutvi23/ticket-flow/blob/main/server/src/app.js) (Express app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_appui["App routes<br/>[App.jsx]"]
  node_authui["Auth context<br/>[AuthContext.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_ticket_pages["Ticket views<br/>[Tickets.jsx]"]
  node_ticket_detail["Ticket detail<br/>[TicketDetail.jsx]"]
  node_ticket_form["Ticket form<br/>[TicketForm.jsx]"]
  node_categories_ui["Category view<br/>[Categories.jsx]"]
  node_dashboard_ui["Dashboard view<br/>[Dashboard.jsx]"]
end

subgraph group_api["REST API"]
  node_api_app["Express app<br/>[app.js]"]
  node_auth_routes["Auth routes<br/>[auth.js]"]
  node_ticket_routes["Ticket routes<br/>[tickets.js]"]
  node_category_routes["Category routes<br/>[categories.js]"]
  node_comment_routes["Comment routes<br/>[comments.js]"]
  node_stats_routes["Stats routes<br/>[stats.js]"]
end

subgraph group_domain["Ticket domain"]
  node_auth_ctrl["Authentication<br/>[authController.js]"]
  node_ticket_ctrl["Ticket operations"]
  node_comment_ctrl["Comments"]
  node_category_ctrl["Categories"]
  node_stats_ctrl["Statistics<br/>[statsController.js]"]
  node_auth_mw["JWT / roles<br/>[auth.js]"]
  node_validation["Request validation<br/>[validate.js]"]
  node_access["Ticket access<br/>[access.js]"]
  node_transitions["Status rules<br/>[transitions.js]"]
end

subgraph group_persistence["Persistence"]
  node_mysql_pool["MySQL pool<br/>[db.js]"]
  node_mysql[("MySQL database<br/>[schema.sql]")]
end

node_user(("Customer / agent"))

node_user -->|"uses"| node_appui
node_appui -->|"checks identity"| node_authui
node_appui -->|"routes to"| node_ticket_pages
node_appui -->|"routes to"| node_ticket_detail
node_appui -->|"routes to"| node_ticket_form
node_appui -->|"routes to"| node_categories_ui
node_appui -->|"routes to"| node_dashboard_ui
node_authui -->|"calls"| node_api_client
node_ticket_pages -->|"calls"| node_api_client
node_ticket_detail -->|"calls"| node_api_client
node_ticket_form -->|"calls"| node_api_client
node_categories_ui -->|"calls"| node_api_client
node_dashboard_ui -->|"calls"| node_api_client
node_api_client -->|"sends REST requests"| node_api_app
node_api_app -->|"mounts"| node_auth_routes
node_api_app -->|"mounts"| node_ticket_routes
node_api_app -->|"mounts"| node_category_routes
node_api_app -->|"mounts"| node_comment_routes
node_api_app -->|"mounts"| node_stats_routes
node_auth_routes -->|"dispatches"| node_auth_ctrl
node_ticket_routes -->|"dispatches"| node_ticket_ctrl
node_ticket_routes -->|"dispatches"| node_comment_ctrl
node_category_routes -->|"dispatches"| node_category_ctrl
node_comment_routes -->|"dispatches"| node_comment_ctrl
node_stats_routes -->|"dispatches"| node_stats_ctrl
node_auth_routes -->|"authenticates"| node_auth_mw
node_ticket_routes -->|"authenticates"| node_auth_mw
node_category_routes -->|"validates"| node_validation
node_ticket_routes -->|"validates"| node_validation
node_ticket_ctrl -->|"checks access"| node_access
node_comment_ctrl -->|"checks access"| node_access
node_ticket_ctrl -->|"checks status change"| node_transitions
node_auth_ctrl -->|"queries"| node_mysql_pool
node_ticket_ctrl -->|"queries"| node_mysql_pool
node_comment_ctrl -->|"queries"| node_mysql_pool
node_category_ctrl -->|"queries"| node_mysql_pool
node_stats_ctrl -->|"queries"| node_mysql_pool
node_access -->|"loads tickets"| node_mysql_pool
node_mysql_pool -.->|"connects"| node_mysql

click node_appui "https://github.com/rutvi23/ticket-flow/blob/main/client/src/App.jsx"
click node_authui "https://github.com/rutvi23/ticket-flow/blob/main/client/src/AuthContext.jsx"
click node_api_client "https://github.com/rutvi23/ticket-flow/blob/main/client/src/api.js"
click node_ticket_pages "https://github.com/rutvi23/ticket-flow/blob/main/client/src/pages/Tickets.jsx"
click node_ticket_detail "https://github.com/rutvi23/ticket-flow/blob/main/client/src/pages/TicketDetail.jsx"
click node_ticket_form "https://github.com/rutvi23/ticket-flow/blob/main/client/src/pages/TicketForm.jsx"
click node_categories_ui "https://github.com/rutvi23/ticket-flow/blob/main/client/src/pages/Categories.jsx"
click node_dashboard_ui "https://github.com/rutvi23/ticket-flow/blob/main/client/src/pages/Dashboard.jsx"
click node_api_app "https://github.com/rutvi23/ticket-flow/blob/main/server/src/app.js"
click node_auth_routes "https://github.com/rutvi23/ticket-flow/blob/main/server/src/routes/auth.js"
click node_ticket_routes "https://github.com/rutvi23/ticket-flow/blob/main/server/src/routes/tickets.js"
click node_category_routes "https://github.com/rutvi23/ticket-flow/blob/main/server/src/routes/categories.js"
click node_comment_routes "https://github.com/rutvi23/ticket-flow/blob/main/server/src/routes/comments.js"
click node_stats_routes "https://github.com/rutvi23/ticket-flow/blob/main/server/src/routes/stats.js"
click node_auth_ctrl "https://github.com/rutvi23/ticket-flow/blob/main/server/src/controllers/authController.js"
click node_ticket_ctrl "https://github.com/rutvi23/ticket-flow/blob/main/server/src/controllers/ticketController.js"
click node_comment_ctrl "https://github.com/rutvi23/ticket-flow/blob/main/server/src/controllers/commentController.js"
click node_category_ctrl "https://github.com/rutvi23/ticket-flow/blob/main/server/src/controllers/categoryController.js"
click node_stats_ctrl "https://github.com/rutvi23/ticket-flow/blob/main/server/src/controllers/statsController.js"
click node_auth_mw "https://github.com/rutvi23/ticket-flow/blob/main/server/src/middleware/auth.js"
click node_validation "https://github.com/rutvi23/ticket-flow/blob/main/server/src/middleware/validate.js"
click node_access "https://github.com/rutvi23/ticket-flow/blob/main/server/src/utils/access.js"
click node_transitions "https://github.com/rutvi23/ticket-flow/blob/main/server/src/utils/transitions.js"
click node_mysql_pool "https://github.com/rutvi23/ticket-flow/blob/main/server/src/config/db.js"
click node_mysql "https://github.com/rutvi23/ticket-flow/blob/main/server/schema.sql"

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_appui,node_authui,node_api_client,node_ticket_pages,node_ticket_detail,node_ticket_form,node_categories_ui,node_dashboard_ui toneBlue
class node_api_app,node_auth_routes,node_ticket_routes,node_category_routes,node_comment_routes,node_stats_routes toneAmber
class node_auth_ctrl,node_ticket_ctrl,node_comment_ctrl,node_category_ctrl,node_stats_ctrl,node_auth_mw,node_validation,node_access,node_transitions toneMint
class node_mysql_pool,node_mysql toneRose
class node_user toneIndigo
```

## Components

### React client

- [App routes](https://github.com/rutvi23/ticket-flow/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Auth context](https://github.com/rutvi23/ticket-flow/blob/main/client/src/AuthContext.jsx): `client/src/AuthContext.jsx`
- [API client](https://github.com/rutvi23/ticket-flow/blob/main/client/src/api.js): `client/src/api.js`
- [Ticket views](https://github.com/rutvi23/ticket-flow/blob/main/client/src/pages/Tickets.jsx): `client/src/pages/Tickets.jsx`
- [Ticket detail](https://github.com/rutvi23/ticket-flow/blob/main/client/src/pages/TicketDetail.jsx): `client/src/pages/TicketDetail.jsx`
- [Ticket form](https://github.com/rutvi23/ticket-flow/blob/main/client/src/pages/TicketForm.jsx): `client/src/pages/TicketForm.jsx`
- [Category view](https://github.com/rutvi23/ticket-flow/blob/main/client/src/pages/Categories.jsx): `client/src/pages/Categories.jsx`
- [Dashboard view](https://github.com/rutvi23/ticket-flow/blob/main/client/src/pages/Dashboard.jsx): `client/src/pages/Dashboard.jsx`

### REST API

- [Express app](https://github.com/rutvi23/ticket-flow/blob/main/server/src/app.js): `server/src/app.js`
- [Auth routes](https://github.com/rutvi23/ticket-flow/blob/main/server/src/routes/auth.js): `server/src/routes/auth.js`
- [Ticket routes](https://github.com/rutvi23/ticket-flow/blob/main/server/src/routes/tickets.js): `server/src/routes/tickets.js`
- [Category routes](https://github.com/rutvi23/ticket-flow/blob/main/server/src/routes/categories.js): `server/src/routes/categories.js`
- [Comment routes](https://github.com/rutvi23/ticket-flow/blob/main/server/src/routes/comments.js): `server/src/routes/comments.js`
- [Stats routes](https://github.com/rutvi23/ticket-flow/blob/main/server/src/routes/stats.js): `server/src/routes/stats.js`

### Ticket domain

- [Authentication](https://github.com/rutvi23/ticket-flow/blob/main/server/src/controllers/authController.js): `server/src/controllers/authController.js`
- [Ticket operations](https://github.com/rutvi23/ticket-flow/blob/main/server/src/controllers/ticketController.js): `server/src/controllers/ticketController.js`
- [Comments](https://github.com/rutvi23/ticket-flow/blob/main/server/src/controllers/commentController.js): `server/src/controllers/commentController.js`
- [Categories](https://github.com/rutvi23/ticket-flow/blob/main/server/src/controllers/categoryController.js): `server/src/controllers/categoryController.js`
- [Statistics](https://github.com/rutvi23/ticket-flow/blob/main/server/src/controllers/statsController.js): `server/src/controllers/statsController.js`
- [JWT / roles](https://github.com/rutvi23/ticket-flow/blob/main/server/src/middleware/auth.js): `server/src/middleware/auth.js`
- [Request validation](https://github.com/rutvi23/ticket-flow/blob/main/server/src/middleware/validate.js): `server/src/middleware/validate.js`
- [Ticket access](https://github.com/rutvi23/ticket-flow/blob/main/server/src/utils/access.js): `server/src/utils/access.js`
- [Status rules](https://github.com/rutvi23/ticket-flow/blob/main/server/src/utils/transitions.js): `server/src/utils/transitions.js`

### Persistence

- [MySQL pool](https://github.com/rutvi23/ticket-flow/blob/main/server/src/config/db.js): `server/src/config/db.js`
- [MySQL database](https://github.com/rutvi23/ticket-flow/blob/main/server/schema.sql): `server/schema.sql`

### Other components

- **Customer / agent**

## Connections

- Customer / agent → App routes: uses (evidence: `README.md`)
- App routes → Auth context: checks identity (evidence: `client/src/App.jsx`)
- App routes → Ticket views: routes to (evidence: `client/src/App.jsx`)
- App routes → Ticket detail: routes to (evidence: `client/src/App.jsx`)
- App routes → Ticket form: routes to (evidence: `client/src/App.jsx`)
- App routes → Category view: routes to (evidence: `client/src/App.jsx`)
- App routes → Dashboard view: routes to (evidence: `client/src/App.jsx`)
- Auth context → API client: calls (evidence: `client/src/AuthContext.jsx`)
- Ticket views → API client: calls (evidence: `client/src/pages/Tickets.jsx`)
- Ticket detail → API client: calls (evidence: `client/src/pages/TicketDetail.jsx`)
- Ticket form → API client: calls (evidence: `client/src/pages/TicketForm.jsx`)
- Category view → API client: calls (evidence: `client/src/pages/Categories.jsx`)
- Dashboard view → API client: calls (evidence: `client/src/pages/Dashboard.jsx`)
- API client → Express app: sends REST requests (evidence: `README.md`)
- Express app → Auth routes: mounts (evidence: `server/src/app.js`)
- Express app → Ticket routes: mounts (evidence: `server/src/app.js`)
- Express app → Category routes: mounts (evidence: `server/src/app.js`)
- Express app → Comment routes: mounts (evidence: `server/src/app.js`)
- Express app → Stats routes: mounts (evidence: `server/src/app.js`)
- Auth routes → Authentication: dispatches (evidence: `server/src/routes/auth.js`)
- Ticket routes → Ticket operations: dispatches (evidence: `server/src/routes/tickets.js`)
- Ticket routes → Comments: dispatches (evidence: `server/src/routes/tickets.js`)
- Category routes → Categories: dispatches (evidence: `server/src/routes/categories.js`)
- Comment routes → Comments: dispatches (evidence: `server/src/routes/comments.js`)
- Stats routes → Statistics: dispatches (evidence: `server/src/routes/stats.js`)
- Auth routes → JWT / roles: authenticates (evidence: `server/src/routes/auth.js`)
- Ticket routes → JWT / roles: authenticates (evidence: `server/src/routes/tickets.js`)
- Category routes → Request validation: validates (evidence: `server/src/routes/categories.js`)
- Ticket routes → Request validation: validates (evidence: `server/src/routes/tickets.js`)
- Ticket operations → Ticket access: checks access (evidence: `server/src/controllers/ticketController.js`)
- Comments → Ticket access: checks access (evidence: `server/src/controllers/commentController.js`)
- Ticket operations → Status rules: checks status change (evidence: `server/src/controllers/ticketController.js`)
- Authentication → MySQL pool: queries (evidence: `server/src/controllers/authController.js`)
- Ticket operations → MySQL pool: queries (evidence: `server/src/controllers/ticketController.js`)
- Comments → MySQL pool: queries (evidence: `server/src/controllers/commentController.js`)
- Categories → MySQL pool: queries (evidence: `server/src/controllers/categoryController.js`)
- Statistics → MySQL pool: queries (evidence: `server/src/controllers/statsController.js`)
- Ticket access → MySQL pool: loads tickets (evidence: `server/src/utils/access.js`)
- MySQL pool → MySQL database: connects
