# dracula-5/ai-ticketing-system architecture

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

- Interactive diagram: https://gitdiagram.com/dracula-5/ai-ticketing-system
- Repository: https://github.com/dracula-5/ai-ticketing-system

## Overview

AI Ticketing System combines tenant-scoped support ticketing and AI triage with SLA monitoring, negotiation, and a vendor marketplace. Users enter through the React application to create and manage tickets or browse products; the FastAPI backend handles requests, persists domain state, and supports real-time notifications and negotiation. The README also documents authentication, analytics, and marketplace workflows. Several routes and frontend pages are unsampled, so their connections are shown only where supported by the README or source index.

Main entry points: [`ai-ticketing-system/backend/app/main.py`](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/main.py) (FastAPI app), [`ai-ticketing-system/backend/app/db/database.py`](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/db/database.py) (SQL database), [`ai-ticketing-system/backend/app/routers/ticket.py`](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/routers/ticket.py) (Ticket routes), [`ai-ticketing-system/frontend/src/App.js`](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/frontend/src/App.js) (React routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_web["React routes<br/>[App.js]"]
  node_ticket_ui["Ticket screens"]
  node_market_ui["Marketplace screens"]
  node_http_client["API client<br/>[axios.js]"]
  node_auth_session["Auth session<br/>[authSession.js]"]
end

subgraph group_ticketing["Ticket operations"]
  node_ticket_routes["Ticket routes<br/>[ticket.py]"]
  node_triage["AI classification<br/>[priority.py]"]
  node_auto_router["Team routing<br/>[auto_router.py]"]
  node_sla["SLA monitoring<br/>[sla_monitor.py]"]
  node_ticket_bargain["Ticket bargaining<br/>[ticket.py]"]
end

subgraph group_marketplace["Marketplace"]
  node_market_routes["Marketplace routes<br/>[products.py]"]
  node_vendor_routes["Vendor management<br/>[vendors.py]"]
  node_orders["Orders<br/>[orders.py]"]
  node_negotiations["Live negotiation<br/>[negotiations.py]"]
end

subgraph group_platform["API and platform"]
  node_api["FastAPI app<br/>[main.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_security["JWT and tenancy<br/>[security.py]"]
  node_notify["Notification service"]
  node_notify_ws["Notification WebSocket<br/>[notification_ws.py]"]
  node_analytics["Live metrics<br/>[main.py]"]
  node_models["Domain models<br/>[models.py]"]
  node_database[("SQL database<br/>[database.py]")]
end

node_users(("Customers, staff"))

node_users -->|"uses"| node_web
node_web -->|"routes to"| node_ticket_ui
node_web -->|"routes to"| node_market_ui
node_ticket_ui -->|"calls API"| node_http_client
node_market_ui -.->|"calls API"| node_http_client
node_http_client -->|"REST requests"| node_api
node_web -.->|"stores session"| node_auth_session
node_api -->|"mounts routes"| node_auth
node_api -->|"mounts routes"| node_ticket_routes
node_api -->|"mounts routes"| node_market_routes
node_api -->|"mounts routes"| node_vendor_routes
node_api -->|"mounts routes"| node_orders
node_api -->|"mounts routes"| node_negotiations
node_users -->|"registers or logs in"| node_auth
node_auth -->|"creates tokens"| node_security
node_ticket_routes -->|"classifies tickets"| node_triage
node_ticket_routes -->|"routes tickets"| node_auto_router
node_api -->|"starts monitor"| node_sla
node_ticket_routes -->|"handles bargaining"| node_ticket_bargain
node_negotiations -->|"triggers alerts"| node_notify
node_notify -->|"broadcasts"| node_notify_ws
node_api -->|"serves metrics"| node_analytics
node_auth -->|"queries users"| node_database
node_ticket_routes -->|"reads and writes"| node_database
node_market_routes -.->|"persists listings"| node_database
node_orders -.->|"persists orders"| node_database
node_negotiations -->|"persists sessions"| node_database
node_notify -->|"creates notifications"| node_models
node_database -->|"maps entities"| node_models

click node_web "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/frontend/src/App.js"
click node_ticket_ui "https://github.com/dracula-5/ai-ticketing-system/tree/main/ai-ticketing-system/frontend/src/pages"
click node_market_ui "https://github.com/dracula-5/ai-ticketing-system/tree/main/ai-ticketing-system/frontend/src/pages"
click node_http_client "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/frontend/src/api/axios.js"
click node_auth_session "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/frontend/src/utils/authSession.js"
click node_api "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/main.py"
click node_auth "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/routers/auth.py"
click node_security "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/core/security.py"
click node_ticket_routes "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/routers/ticket.py"
click node_triage "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/ai/priority.py"
click node_auto_router "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/services/auto_router.py"
click node_sla "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/services/sla_monitor.py"
click node_ticket_bargain "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/routers/ticket.py"
click node_market_routes "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/routers/products.py"
click node_vendor_routes "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/routers/vendors.py"
click node_orders "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/routers/orders.py"
click node_negotiations "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/routers/negotiations.py"
click node_notify "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/services/notification_service.py"
click node_notify_ws "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/services/notification_ws.py"
click node_analytics "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/main.py"
click node_models "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/db/models.py"
click node_database "https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/db/database.py"

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_web,node_ticket_ui,node_market_ui,node_http_client,node_auth_session toneBlue
class node_ticket_routes,node_triage,node_auto_router,node_sla,node_ticket_bargain toneAmber
class node_market_routes,node_vendor_routes,node_orders,node_negotiations toneMint
class node_api,node_auth,node_security,node_notify,node_notify_ws,node_analytics,node_models,node_database toneRose
class node_users toneIndigo
```

## Components

### Web application

- [React routes](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/frontend/src/App.js): `ai-ticketing-system/frontend/src/App.js`
- [Ticket screens](https://github.com/dracula-5/ai-ticketing-system/tree/main/ai-ticketing-system/frontend/src/pages): `ai-ticketing-system/frontend/src/pages`
- [Marketplace screens](https://github.com/dracula-5/ai-ticketing-system/tree/main/ai-ticketing-system/frontend/src/pages): `ai-ticketing-system/frontend/src/pages`
- [API client](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/frontend/src/api/axios.js): `ai-ticketing-system/frontend/src/api/axios.js`
- [Auth session](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/frontend/src/utils/authSession.js): `ai-ticketing-system/frontend/src/utils/authSession.js`

### Ticket operations

- [Ticket routes](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/routers/ticket.py): `ai-ticketing-system/backend/app/routers/ticket.py`
- [AI classification](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/ai/priority.py): `ai-ticketing-system/backend/app/ai/priority.py`
- [Team routing](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/services/auto_router.py): `ai-ticketing-system/backend/app/services/auto_router.py`
- [SLA monitoring](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/services/sla_monitor.py): `ai-ticketing-system/backend/app/services/sla_monitor.py`
- [Ticket bargaining](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/routers/ticket.py): `ai-ticketing-system/backend/app/routers/ticket.py`

### Marketplace

- [Marketplace routes](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/routers/products.py): `ai-ticketing-system/backend/app/routers/products.py`
- [Vendor management](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/routers/vendors.py): `ai-ticketing-system/backend/app/routers/vendors.py`
- [Orders](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/routers/orders.py): `ai-ticketing-system/backend/app/routers/orders.py`
- [Live negotiation](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/routers/negotiations.py): `ai-ticketing-system/backend/app/routers/negotiations.py`

### API and platform

- [FastAPI app](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/main.py): `ai-ticketing-system/backend/app/main.py`
- [Authentication](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/routers/auth.py): `ai-ticketing-system/backend/app/routers/auth.py`
- [JWT and tenancy](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/core/security.py): `ai-ticketing-system/backend/app/core/security.py`
- [Notification service](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/services/notification_service.py): `ai-ticketing-system/backend/app/services/notification_service.py`
- [Notification WebSocket](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/services/notification_ws.py): `ai-ticketing-system/backend/app/services/notification_ws.py`
- [Live metrics](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/main.py): `ai-ticketing-system/backend/app/main.py`
- [Domain models](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/db/models.py): `ai-ticketing-system/backend/app/db/models.py`
- [SQL database](https://github.com/dracula-5/ai-ticketing-system/blob/main/ai-ticketing-system/backend/app/db/database.py): `ai-ticketing-system/backend/app/db/database.py`

### Other components

- **Customers, staff**

## Connections

- Customers, staff → React routes: uses
- React routes → Ticket screens: routes to (evidence: `ai-ticketing-system/frontend/src/App.js`)
- React routes → Marketplace screens: routes to (evidence: `ai-ticketing-system/frontend/src/App.js`)
- Ticket screens → API client: calls API (evidence: `ai-ticketing-system/frontend/src/pages/TicketDetails.js`)
- Marketplace screens → API client: calls API (evidence: `ai-ticketing-system/frontend/src/pages/TicketDetails.js`)
- API client → FastAPI app: REST requests
- React routes → Auth session: stores session
- FastAPI app → Authentication: mounts routes (evidence: `ai-ticketing-system/backend/app/main.py`)
- FastAPI app → Ticket routes: mounts routes (evidence: `ai-ticketing-system/backend/app/main.py`)
- FastAPI app → Marketplace routes: mounts routes (evidence: `ai-ticketing-system/backend/app/main.py`)
- FastAPI app → Vendor management: mounts routes (evidence: `ai-ticketing-system/backend/app/main.py`)
- FastAPI app → Orders: mounts routes (evidence: `ai-ticketing-system/backend/app/main.py`)
- FastAPI app → Live negotiation: mounts routes (evidence: `ai-ticketing-system/backend/app/main.py`)
- Customers, staff → Authentication: registers or logs in
- Authentication → JWT and tenancy: creates tokens (evidence: `ai-ticketing-system/backend/app/routers/auth.py`)
- Ticket routes → AI classification: classifies tickets (evidence: `ai-ticketing-system/backend/app/routers/ticket.py`)
- Ticket routes → Team routing: routes tickets (evidence: `ai-ticketing-system/backend/app/routers/ticket.py`)
- FastAPI app → SLA monitoring: starts monitor (evidence: `ai-ticketing-system/backend/app/main.py`)
- Ticket routes → Ticket bargaining: handles bargaining (evidence: `ai-ticketing-system/backend/app/routers/ticket.py`)
- Live negotiation → Notification service: triggers alerts (evidence: `ai-ticketing-system/backend/app/routers/negotiations.py`)
- Notification service → Notification WebSocket: broadcasts (evidence: `ai-ticketing-system/backend/app/services/notification_service.py`)
- FastAPI app → Live metrics: serves metrics (evidence: `ai-ticketing-system/backend/app/main.py`)
- Authentication → SQL database: queries users (evidence: `ai-ticketing-system/backend/app/routers/auth.py`)
- Ticket routes → SQL database: reads and writes (evidence: `ai-ticketing-system/backend/app/routers/ticket.py`)
- Marketplace routes → SQL database: persists listings
- Orders → SQL database: persists orders (evidence: `ai-ticketing-system/backend/app/routers/orders.py`)
- Live negotiation → SQL database: persists sessions (evidence: `ai-ticketing-system/backend/app/routers/negotiations.py`)
- Notification service → Domain models: creates notifications (evidence: `ai-ticketing-system/backend/app/services/notification_service.py`)
- SQL database → Domain models: maps entities (evidence: `ai-ticketing-system/backend/app/db/database.py`)
