# mlamine300/open-tickets architecture

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

- Interactive diagram: https://gitdiagram.com/mlamine300/open-tickets
- Repository: https://github.com/mlamine300/open-tickets

## Overview

OpenTickets is a claims-management platform for handling tickets between company agencies and internal services. Users enter through the React application, which exposes ticket creation, tracking, search and dashboards; API routes dispatch requests to domain controllers, which apply ticket and organization rules and persist data in MongoDB. Separate branches cover authentication, administration, custom forms, useful links, announcements and BI reporting. The README documents these capabilities; unsampled modules are represented by their exact tree paths, but their internal calls are not inferred.

Main entry points: [`backend/src/app.ts`](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/app.ts) (Express application), [`frontend/src/App.tsx`](https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/App.tsx) (Application routes), [`backend/src/controllers/ticketController.ts`](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/ticketController.ts) (Ticket workflows), [`backend/src/controllers/biController.ts`](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/biController.ts) (BI reporting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["Application routes<br/>[App.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_ticket_ui["Ticket pages<br/>[TicketsPage.tsx]"]
  node_forms_ui["Form pages<br/>[AddFormPage.tsx]"]
  node_org_ui["Organisation pages"]
  node_users_ui["User administration"]
  node_links_ui["Useful links pages"]
  node_alert_ui["Announcement page<br/>[AlertPage.tsx]"]
  node_search_ui["Ticket search<br/>[SearchPage.tsx]"]
end

subgraph group_api["API and workflows"]
  node_api["Express application<br/>[app.ts]"]
  node_ticket_routes["Ticket routes<br/>[ticketRoutes.ts]"]
  node_ticket_logic["Ticket workflows"]
  node_forms_logic["Custom forms<br/>[formControllers.ts]"]
  node_org_logic["Organisation management"]
  node_comments_logic["Ticket comments"]
  node_motifs_logic["Claim categories<br/>[motifController.ts]"]
  node_links_logic["Useful links"]
  node_info_logic["Announcements and info<br/>[infoController.ts]"]
end

subgraph group_security["Identity and access"]
  node_auth_routes["Authentication routes<br/>[authRoutes.ts]"]
  node_auth_logic["Authentication<br/>[authController.ts]"]
  node_auth_guard["JWT access checks<br/>[authMiddleware.ts]"]
  node_user_logic["User management<br/>[userController.ts]"]
end

subgraph group_data["Persistence and analytics"]
  node_mongo[("MongoDB<br/>[db.ts]")]
  node_ticket_model[("Ticket records<br/>[Ticket.ts]")]
  node_user_model[("User records<br/>[User.ts]")]
  node_org_model[("Organisation records<br/>[Organisation.ts]")]
  node_bi_routes["BI routes<br/>[biRoutes.ts]"]
  node_bi_logic["BI reporting<br/>[biController.ts]"]
  node_comments_model[("Comment records<br/>[Comment.ts]")]
  node_links_model[("Useful-link records<br/>[UsefulLinks.ts]")]
end

node_user(("User"))
node_socket(("Socket.IO clients"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_ticket_ui
node_app -->|"routes to"| node_forms_ui
node_app -->|"routes to"| node_org_ui
node_app -->|"routes to"| node_users_ui
node_app -->|"routes to"| node_links_ui
node_app -->|"routes to"| node_alert_ui
node_app -->|"routes to"| node_search_ui
node_app -->|"listens for notifications"| node_socket
node_api -->|"connects"| node_mongo
node_api -->|"mounts"| node_ticket_routes
node_ticket_routes -->|"dispatches"| node_ticket_logic
node_ticket_logic -->|"queries"| node_ticket_model
node_ticket_logic -->|"queries"| node_comments_model
node_ticket_logic -->|"resolves organisations"| node_org_model
node_ticket_logic -->|"gets form fields"| node_forms_logic
node_api -->|"mounts"| node_auth_routes
node_auth_routes -->|"dispatches"| node_auth_logic
node_auth_routes -->|"protects profile routes"| node_auth_guard
node_auth_logic -->|"reads and updates"| node_user_model
node_auth_logic -->|"looks up organisation"| node_org_model
node_auth_guard -->|"loads user"| node_user_model
node_api -->|"mounts"| node_bi_routes
node_bi_routes -->|"dispatches"| node_bi_logic
node_bi_logic -->|"aggregates"| node_ticket_model
node_bi_logic -->|"joins organisation data"| node_org_model
node_bi_logic -->|"joins user data"| node_user_model
node_bi_logic -->|"joins comment data"| node_comments_model
node_api -->|"mounts links routes"| node_links_logic
node_links_logic -->|"reads and writes"| node_links_model
node_links_logic -->|"admin checks"| node_auth_guard
node_api -->|"mounts organisation routes"| node_org_logic
node_api -->|"mounts comment routes"| node_comments_logic
node_api -->|"mounts motif routes"| node_motifs_logic
node_api -->|"mounts info routes"| node_info_logic
node_api -->|"mounts user routes"| node_user_logic
node_api -->|"accepts connections"| node_socket

click node_app "https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/App.tsx"
click node_dashboard "https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/page/Dashboard.tsx"
click node_ticket_ui "https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/page/tickets/TicketsPage.tsx"
click node_forms_ui "https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/page/forms/AddFormPage.tsx"
click node_org_ui "https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/page/organisations/AddOrganisation.tsx"
click node_users_ui "https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/page/users/AddEditUserPage.tsx"
click node_links_ui "https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/page/usefulLinks/AddUsefulLinkPage.tsx"
click node_alert_ui "https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/page/alert/AlertPage.tsx"
click node_search_ui "https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/page/search/SearchPage.tsx"
click node_api "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/app.ts"
click node_ticket_routes "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/routes/ticketRoutes.ts"
click node_ticket_logic "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/ticketController.ts"
click node_forms_logic "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/formControllers.ts"
click node_org_logic "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/organisationController.ts"
click node_comments_logic "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/commentController.ts"
click node_motifs_logic "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/motifController.ts"
click node_links_logic "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/useFulLinksController.ts"
click node_info_logic "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/infoController.ts"
click node_auth_routes "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/routes/authRoutes.ts"
click node_auth_logic "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/authController.ts"
click node_auth_guard "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/middlewares/authMiddleware.ts"
click node_user_logic "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/userController.ts"
click node_mongo "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/config/db.ts"
click node_ticket_model "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/models/Ticket.ts"
click node_user_model "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/models/User.ts"
click node_org_model "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/models/Organisation.ts"
click node_bi_routes "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/routes/biRoutes.ts"
click node_bi_logic "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/biController.ts"
click node_comments_model "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/models/Comment.ts"
click node_links_model "https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/models/UsefulLinks.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_dashboard,node_ticket_ui,node_forms_ui,node_org_ui,node_users_ui,node_links_ui,node_alert_ui,node_search_ui,node_user,node_socket toneBlue
class node_api,node_ticket_routes,node_ticket_logic,node_forms_logic,node_org_logic,node_comments_logic,node_motifs_logic,node_links_logic,node_info_logic toneAmber
class node_auth_routes,node_auth_logic,node_auth_guard,node_user_logic toneMint
class node_mongo,node_ticket_model,node_user_model,node_org_model,node_bi_routes,node_bi_logic,node_comments_model,node_links_model toneRose
```

## Components

### Web application

- [Application routes](https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Dashboard](https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/page/Dashboard.tsx): `frontend/src/page/Dashboard.tsx`
- [Ticket pages](https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/page/tickets/TicketsPage.tsx): `frontend/src/page/tickets/TicketsPage.tsx`
- [Form pages](https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/page/forms/AddFormPage.tsx): `frontend/src/page/forms/AddFormPage.tsx`
- [Organisation pages](https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/page/organisations/AddOrganisation.tsx): `frontend/src/page/organisations/AddOrganisation.tsx`
- [User administration](https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/page/users/AddEditUserPage.tsx): `frontend/src/page/users/AddEditUserPage.tsx`
- [Useful links pages](https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/page/usefulLinks/AddUsefulLinkPage.tsx): `frontend/src/page/usefulLinks/AddUsefulLinkPage.tsx`
- [Announcement page](https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/page/alert/AlertPage.tsx): `frontend/src/page/alert/AlertPage.tsx`
- [Ticket search](https://github.com/mlamine300/open-tickets/blob/websocket/frontend/src/page/search/SearchPage.tsx): `frontend/src/page/search/SearchPage.tsx`

### API and workflows

- [Express application](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/app.ts): `backend/src/app.ts`
- [Ticket routes](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/routes/ticketRoutes.ts): `backend/src/routes/ticketRoutes.ts`
- [Ticket workflows](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/ticketController.ts): `backend/src/controllers/ticketController.ts`
- [Custom forms](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/formControllers.ts): `backend/src/controllers/formControllers.ts`
- [Organisation management](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/organisationController.ts): `backend/src/controllers/organisationController.ts`
- [Ticket comments](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/commentController.ts): `backend/src/controllers/commentController.ts`
- [Claim categories](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/motifController.ts): `backend/src/controllers/motifController.ts`
- [Useful links](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/useFulLinksController.ts): `backend/src/controllers/useFulLinksController.ts`
- [Announcements and info](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/infoController.ts): `backend/src/controllers/infoController.ts`

### Identity and access

- [Authentication routes](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/routes/authRoutes.ts): `backend/src/routes/authRoutes.ts`
- [Authentication](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/authController.ts): `backend/src/controllers/authController.ts`
- [JWT access checks](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/middlewares/authMiddleware.ts): `backend/src/middlewares/authMiddleware.ts`
- [User management](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/userController.ts): `backend/src/controllers/userController.ts`

### Persistence and analytics

- [MongoDB](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/config/db.ts): `backend/src/config/db.ts`
- [Ticket records](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/models/Ticket.ts): `backend/src/models/Ticket.ts`
- [User records](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/models/User.ts): `backend/src/models/User.ts`
- [Organisation records](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/models/Organisation.ts): `backend/src/models/Organisation.ts`
- [BI routes](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/routes/biRoutes.ts): `backend/src/routes/biRoutes.ts`
- [BI reporting](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/controllers/biController.ts): `backend/src/controllers/biController.ts`
- [Comment records](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/models/Comment.ts): `backend/src/models/Comment.ts`
- [Useful-link records](https://github.com/mlamine300/open-tickets/blob/websocket/backend/src/models/UsefulLinks.ts): `backend/src/models/UsefulLinks.ts`

### Other components

- **User**
- **Socket.IO clients**

## Connections

- User → Application routes: uses (evidence: `frontend/src/App.tsx`)
- Application routes → Dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Ticket pages: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Form pages: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Organisation pages: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → User administration: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Useful links pages: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Announcement page: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Ticket search: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Socket.IO clients: listens for notifications (evidence: `frontend/src/App.tsx`)
- Express application → MongoDB: connects (evidence: `backend/src/app.ts`)
- Express application → Ticket routes: mounts (evidence: `backend/src/app.ts`)
- Ticket routes → Ticket workflows: dispatches (evidence: `backend/src/routes/ticketRoutes.ts`)
- Ticket workflows → Ticket records: queries (evidence: `backend/src/controllers/ticketController.ts`)
- Ticket workflows → Comment records: queries (evidence: `backend/src/controllers/ticketController.ts`)
- Ticket workflows → Organisation records: resolves organisations (evidence: `backend/src/controllers/ticketController.ts`)
- Ticket workflows → Custom forms: gets form fields (evidence: `backend/src/controllers/ticketController.ts`)
- Express application → Authentication routes: mounts (evidence: `backend/src/app.ts`)
- Authentication routes → Authentication: dispatches (evidence: `backend/src/routes/authRoutes.ts`)
- Authentication routes → JWT access checks: protects profile routes (evidence: `backend/src/routes/authRoutes.ts`)
- Authentication → User records: reads and updates (evidence: `backend/src/controllers/authController.ts`)
- Authentication → Organisation records: looks up organisation (evidence: `backend/src/controllers/authController.ts`)
- JWT access checks → User records: loads user (evidence: `backend/src/middlewares/authMiddleware.ts`)
- Express application → BI routes: mounts (evidence: `backend/src/app.ts`)
- BI routes → BI reporting: dispatches (evidence: `backend/src/routes/biRoutes.ts`)
- BI reporting → Ticket records: aggregates (evidence: `backend/src/controllers/biController.ts`)
- BI reporting → Organisation records: joins organisation data (evidence: `backend/src/controllers/biController.ts`)
- BI reporting → User records: joins user data (evidence: `backend/src/controllers/biController.ts`)
- BI reporting → Comment records: joins comment data (evidence: `backend/src/controllers/biController.ts`)
- Express application → Useful links: mounts links routes (evidence: `backend/src/app.ts`)
- Useful links → Useful-link records: reads and writes (evidence: `backend/src/controllers/useFulLinksController.ts`)
- Useful links → JWT access checks: admin checks (evidence: `backend/src/routes/usefulLinksRoutes.ts`)
- Express application → Organisation management: mounts organisation routes (evidence: `backend/src/app.ts`)
- Express application → Ticket comments: mounts comment routes (evidence: `backend/src/app.ts`)
- Express application → Claim categories: mounts motif routes (evidence: `backend/src/app.ts`)
- Express application → Announcements and info: mounts info routes (evidence: `backend/src/app.ts`)
- Express application → User management: mounts user routes (evidence: `backend/src/app.ts`)
- Express application → Socket.IO clients: accepts connections (evidence: `backend/src/app.ts`)
