# sahadeok/nexdesk architecture

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

- Interactive diagram: https://gitdiagram.com/sahadeok/nexdesk
- Repository: https://github.com/sahadeok/nexdesk

## Overview

NexDesk is a multi-tenant IT service-management and operations platform. Its main workflow is that an end user or agent works with tickets in the dashboard; diagnosis and AI-assisted analysis support resolution, while agents can trigger automated healing. Separate product areas cover change management, knowledge, incident response, and business and operational intelligence. Supabase supplies persistent application data. The tree and sampled files show these stages, but many listed capabilities have unsampled implementations; their connections are omitted rather than inferred.

Main entry points: [`app/tickets/[id]/page.js`](https://github.com/sahadeok/nexdesk/blob/main/app/tickets/%5Bid%5D/page.js) (Ticket workspace), [`app/api/ticket-diagnosis/route.js`](https://github.com/sahadeok/nexdesk/blob/main/app/api/ticket-diagnosis/route.js) (Ticket diagnosis API), [`lib/agent-engine.js`](https://github.com/sahadeok/nexdesk/blob/main/lib/agent-engine.js) (Autonomous agent), [`lib/supabase.js`](https://github.com/sahadeok/nexdesk/blob/main/lib/supabase.js) (Supabase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_ticket_ui["Ticket workspace<br/>[page.js]"]
  node_new_ticket["Ticket creation<br/>[page.js]"]
  node_navigation["Role-aware navigation<br/>[GlobalNav.js]"]
  node_widget["Support widget"]
end

subgraph group_tickets["Ticket operations"]
  node_ticket_api["Ticket diagnosis API<br/>[route.js]"]
  node_frameworks["Framework detection"]
  node_ticket_routing["Ticket routing<br/>[ticketRouter.js]"]
  node_forensic_ui["Forensic agent panel<br/>[ForensicPilot.js]"]
  node_healing_api["Self-heal API<br/>[route.js]"]
  node_agent_engine["Autonomous agent<br/>[agent-engine.js]"]
  node_forensic_subagent["Forensic subagent"]
end

subgraph group_intelligence["AI intelligence"]
  node_knowledge["Knowledge assistance<br/>[knowledgeAgents.js]"]
  node_perception_api["Perception API<br/>[route.js]"]
  node_perception_engine["Perception engine"]
  node_nextgen_api["Next-gen API<br/>[route.js]"]
  node_nextgen_engine["Next-gen engine<br/>[nextGenEngine.js]"]
  node_business_api["Business intelligence API<br/>[route.js]"]
  node_business_engine["Business intelligence engine"]
end

subgraph group_operations["Operations and change"]
  node_change_api["Change request API<br/>[route.js]"]
  node_change_engine["Change intelligence engine<br/>[crEngine.js]"]
  node_ops_dashboard["Operations dashboards<br/>[page.js]"]
end

subgraph group_platform["Shared platform"]
  node_supabase_client["Supabase client<br/>[supabase.js]"]
  node_database[("Supabase data store")]
end

node_end_user(("End user"))
node_agent(("Support agent"))

node_end_user -.->|"creates ticket"| node_new_ticket
node_agent -->|"works tickets"| node_ticket_ui
node_agent -->|"navigates"| node_navigation
node_ticket_ui -.->|"requests diagnosis"| node_ticket_api
node_ticket_ui -->|"uses routing"| node_ticket_routing
node_ticket_ui -->|"renders"| node_forensic_ui
node_ticket_api -->|"detects frameworks"| node_frameworks
node_ticket_api -->|"reads and updates"| node_database
node_healing_api -->|"triggers agent"| node_agent_engine
node_healing_api -->|"records heal actions"| node_database
node_agent_engine -->|"uses analysis"| node_perception_engine
node_agent_engine -->|"delegates"| node_forensic_subagent
node_perception_api -->|"dispatches actions"| node_perception_engine
node_nextgen_api -->|"dispatches actions"| node_nextgen_engine
node_business_api -->|"uses engine"| node_business_engine
node_change_api -->|"uses engine"| node_change_engine
node_navigation -->|"loads profile"| node_supabase_client
node_ticket_ui -->|"uses client"| node_supabase_client
node_supabase_client -->|"connects"| node_database
node_knowledge -.->|"uses stored knowledge"| node_database
node_widget -.->|"may submit requests"| node_ticket_api

click node_ticket_ui "https://github.com/sahadeok/nexdesk/blob/main/app/tickets/%5Bid%5D/page.js"
click node_new_ticket "https://github.com/sahadeok/nexdesk/blob/main/app/tickets/new/page.js"
click node_navigation "https://github.com/sahadeok/nexdesk/blob/main/app/components/GlobalNav.js"
click node_widget "https://github.com/sahadeok/nexdesk/blob/main/public/nexdesk-widget-v3.js"
click node_ticket_api "https://github.com/sahadeok/nexdesk/blob/main/app/api/ticket-diagnosis/route.js"
click node_frameworks "https://github.com/sahadeok/nexdesk/blob/main/lib/frameworkDetector.js"
click node_ticket_routing "https://github.com/sahadeok/nexdesk/blob/main/lib/ticketRouter.js"
click node_forensic_ui "https://github.com/sahadeok/nexdesk/blob/main/components/agents/ForensicPilot.js"
click node_healing_api "https://github.com/sahadeok/nexdesk/blob/main/app/api/self-heal/route.js"
click node_agent_engine "https://github.com/sahadeok/nexdesk/blob/main/lib/agent-engine.js"
click node_knowledge "https://github.com/sahadeok/nexdesk/blob/main/lib/knowledgeAgents.js"
click node_perception_api "https://github.com/sahadeok/nexdesk/blob/main/app/api/perception-intelligence/route.js"
click node_perception_engine "https://github.com/sahadeok/nexdesk/blob/main/lib/perceptionEngine.js"
click node_nextgen_api "https://github.com/sahadeok/nexdesk/blob/main/app/api/nextgen-intelligence/route.js"
click node_nextgen_engine "https://github.com/sahadeok/nexdesk/blob/main/lib/nextGenEngine.js"
click node_business_api "https://github.com/sahadeok/nexdesk/blob/main/app/api/business-supremacy/route.js"
click node_business_engine "https://github.com/sahadeok/nexdesk/blob/main/lib/businessSupremacyEngine.js"
click node_change_api "https://github.com/sahadeok/nexdesk/blob/main/app/api/change-requests/route.js"
click node_change_engine "https://github.com/sahadeok/nexdesk/blob/main/lib/crEngine.js"
click node_ops_dashboard "https://github.com/sahadeok/nexdesk/blob/main/app/dashboard/ops-intelligence/page.js"
click node_supabase_client "https://github.com/sahadeok/nexdesk/blob/main/lib/supabase.js"
click node_forensic_subagent "https://github.com/sahadeok/nexdesk/blob/main/lib/forensicSubagent.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_ticket_ui,node_new_ticket,node_navigation,node_widget,node_end_user toneBlue
class node_ticket_api,node_frameworks,node_ticket_routing,node_forensic_ui,node_healing_api,node_agent_engine,node_forensic_subagent toneAmber
class node_knowledge,node_perception_api,node_perception_engine,node_nextgen_api,node_nextgen_engine,node_business_api,node_business_engine toneMint
class node_change_api,node_change_engine,node_ops_dashboard toneRose
class node_supabase_client,node_database,node_agent toneIndigo
```

## Components

### User experience

- [Ticket workspace](https://github.com/sahadeok/nexdesk/blob/main/app/tickets/%5Bid%5D/page.js): `app/tickets/[id]/page.js`
- [Ticket creation](https://github.com/sahadeok/nexdesk/blob/main/app/tickets/new/page.js): `app/tickets/new/page.js`
- [Role-aware navigation](https://github.com/sahadeok/nexdesk/blob/main/app/components/GlobalNav.js): `app/components/GlobalNav.js`
- [Support widget](https://github.com/sahadeok/nexdesk/blob/main/public/nexdesk-widget-v3.js): `public/nexdesk-widget-v3.js`

### Ticket operations

- [Ticket diagnosis API](https://github.com/sahadeok/nexdesk/blob/main/app/api/ticket-diagnosis/route.js): `app/api/ticket-diagnosis/route.js`
- [Framework detection](https://github.com/sahadeok/nexdesk/blob/main/lib/frameworkDetector.js): `lib/frameworkDetector.js`
- [Ticket routing](https://github.com/sahadeok/nexdesk/blob/main/lib/ticketRouter.js): `lib/ticketRouter.js`
- [Forensic agent panel](https://github.com/sahadeok/nexdesk/blob/main/components/agents/ForensicPilot.js): `components/agents/ForensicPilot.js`
- [Self-heal API](https://github.com/sahadeok/nexdesk/blob/main/app/api/self-heal/route.js): `app/api/self-heal/route.js`
- [Autonomous agent](https://github.com/sahadeok/nexdesk/blob/main/lib/agent-engine.js): `lib/agent-engine.js`
- [Forensic subagent](https://github.com/sahadeok/nexdesk/blob/main/lib/forensicSubagent.js): `lib/forensicSubagent.js`

### AI intelligence

- [Knowledge assistance](https://github.com/sahadeok/nexdesk/blob/main/lib/knowledgeAgents.js): `lib/knowledgeAgents.js`
- [Perception API](https://github.com/sahadeok/nexdesk/blob/main/app/api/perception-intelligence/route.js): `app/api/perception-intelligence/route.js`
- [Perception engine](https://github.com/sahadeok/nexdesk/blob/main/lib/perceptionEngine.js): `lib/perceptionEngine.js`
- [Next-gen API](https://github.com/sahadeok/nexdesk/blob/main/app/api/nextgen-intelligence/route.js): `app/api/nextgen-intelligence/route.js`
- [Next-gen engine](https://github.com/sahadeok/nexdesk/blob/main/lib/nextGenEngine.js): `lib/nextGenEngine.js`
- [Business intelligence API](https://github.com/sahadeok/nexdesk/blob/main/app/api/business-supremacy/route.js): `app/api/business-supremacy/route.js`
- [Business intelligence engine](https://github.com/sahadeok/nexdesk/blob/main/lib/businessSupremacyEngine.js): `lib/businessSupremacyEngine.js`

### Operations and change

- [Change request API](https://github.com/sahadeok/nexdesk/blob/main/app/api/change-requests/route.js): `app/api/change-requests/route.js`
- [Change intelligence engine](https://github.com/sahadeok/nexdesk/blob/main/lib/crEngine.js): `lib/crEngine.js`
- [Operations dashboards](https://github.com/sahadeok/nexdesk/blob/main/app/dashboard/ops-intelligence/page.js): `app/dashboard/ops-intelligence/page.js`

### Shared platform

- [Supabase client](https://github.com/sahadeok/nexdesk/blob/main/lib/supabase.js): `lib/supabase.js`
- **Supabase data store**

### Other components

- **End user**
- **Support agent**

## Connections

- End user → Ticket creation: creates ticket
- Support agent → Ticket workspace: works tickets
- Support agent → Role-aware navigation: navigates (evidence: `app/components/GlobalNav.js`)
- Ticket workspace → Ticket diagnosis API: requests diagnosis
- Ticket workspace → Ticket routing: uses routing (evidence: `app/tickets/[id]/page.js`)
- Ticket workspace → Forensic agent panel: renders (evidence: `app/tickets/[id]/page.js`)
- Ticket diagnosis API → Framework detection: detects frameworks (evidence: `app/api/ticket-diagnosis/route.js`)
- Ticket diagnosis API → Supabase data store: reads and updates (evidence: `app/api/ticket-diagnosis/route.js`)
- Self-heal API → Autonomous agent: triggers agent (evidence: `app/api/self-heal/route.js`)
- Self-heal API → Supabase data store: records heal actions (evidence: `app/api/self-heal/route.js`)
- Autonomous agent → Perception engine: uses analysis (evidence: `lib/agent-engine.js`)
- Autonomous agent → Forensic subagent: delegates (evidence: `lib/agent-engine.js`)
- Perception API → Perception engine: dispatches actions (evidence: `app/api/perception-intelligence/route.js`)
- Next-gen API → Next-gen engine: dispatches actions (evidence: `app/api/nextgen-intelligence/route.js`)
- Business intelligence API → Business intelligence engine: uses engine (evidence: `app/api/business-supremacy/route.js`)
- Change request API → Change intelligence engine: uses engine (evidence: `app/api/change-requests/route.js`)
- Role-aware navigation → Supabase client: loads profile (evidence: `app/components/GlobalNav.js`)
- Ticket workspace → Supabase client: uses client (evidence: `app/tickets/[id]/page.js`)
- Supabase client → Supabase data store: connects (evidence: `lib/supabase.js`)
- Knowledge assistance → Supabase data store: uses stored knowledge
- Support widget → Ticket diagnosis API: may submit requests
