# mohanshankarbotcha/nexux architecture

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

- Interactive diagram: https://gitdiagram.com/mohanshankarbotcha/nexux
- Repository: https://github.com/mohanshankarbotcha/nexux

## Overview

NEXUS.AI is a local-first, multi-agent coding assistant with a React workspace UI and an embedded server for desktop use. The main workflow is: a developer opens a workspace and submits a coding task; the task API coordinates specialist agents, which use model providers and workspace tools; task results, events, and usage are persisted and presented in the client. The graph also includes provider setup, terminal, workspace browsing, telemetry, and desktop startup. Some subsystem links rely on README documentation or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`packages/server/src/api/app.ts`](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/api/app.ts) (HTTP API), [`packages/client/src/App.tsx`](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/client/src/App.tsx) (Workspace UI), [`packages/server/src/api/routes/task.ts`](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/api/routes/task.ts) (Task endpoint), [`packages/server/src/workspace/workspace-service.ts`](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/workspace/workspace-service.ts) (Workspace service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client workspaces"]
  node_clientapp["Workspace UI<br/>[App.tsx]"]
  node_chat["Chat workspace<br/>[ChatScreen.tsx]"]
  node_workspaceui["Workspace editor"]
  node_terminalui["Terminal view<br/>[TerminalScreen.tsx]"]
  node_providerui["Provider setup"]
  node_usageui["Usage telemetry<br/>[UsageScreen.tsx]"]
  node_clientapi["API client<br/>[api.ts]"]
end

subgraph group_api["Server API"]
  node_serverapi["HTTP API<br/>[app.ts]"]
  node_taskroute["Task endpoint<br/>[task.ts]"]
  node_workspaceroute["Workspace endpoint<br/>[workspace.ts]"]
  node_providerroute["Provider endpoint<br/>[provider.ts]"]
  node_sessionroute["Session endpoint<br/>[session.ts]"]
  node_usageroute["Usage endpoint<br/>[usage.ts]"]
end

subgraph group_agents["Agent runtime"]
  node_coordinator["Agent coordinator<br/>[coordinator.ts]"]
  node_baseagent["Agent execution<br/>[base-agent.ts]"]
  node_modelrouter["Model routing<br/>[model-router.ts]"]
  node_openai["OpenAI provider<br/>[openai-provider.ts]"]
  node_gemini["Gemini provider<br/>[gemini-provider.ts]"]
end

subgraph group_workspace["Workspace services"]
  node_toolregistry["Tool dispatch<br/>[tool-registry.ts]"]
  node_terminaltool["Terminal execution<br/>[terminal.ts]"]
  node_workspaceengine["Workspace service"]
  node_context["Task context<br/>[context-engine.ts]"]
end

subgraph group_shared["Shared services"]
  node_filecache["File cache<br/>[file-cache.ts]"]
  node_storage[("Local persistence<br/>[storage-engine.ts]")]
end

subgraph group_desktop["Desktop host"]
  node_desktopapp["Electron host<br/>[main.ts]"]
  node_servermanager["Embedded server<br/>[server-manager.ts]"]
end

node_developer(("Developer"))
node_openai_service{{"OpenAI service"}}
node_gemini_service{{"Gemini service"}}

node_developer -->|"uses workspaces"| node_clientapp
node_clientapp -->|"shows chat"| node_chat
node_clientapp -->|"shows editor"| node_workspaceui
node_clientapp -->|"shows terminal"| node_terminalui
node_clientapp -->|"configures providers"| node_providerui
node_clientapp -->|"shows telemetry"| node_usageui
node_chat -->|"submits tasks"| node_clientapi
node_workspaceui -->|"requests workspace data"| node_clientapi
node_terminalui -->|"runs commands"| node_clientapi
node_providerui -->|"saves credentials"| node_clientapi
node_usageui -->|"requests usage"| node_clientapi
node_clientapi -.->|"sends HTTP requests"| node_serverapi
node_serverapi -->|"routes tasks"| node_taskroute
node_serverapi -->|"routes workspace"| node_workspaceroute
node_serverapi -->|"routes providers"| node_providerroute
node_serverapi -->|"routes sessions"| node_sessionroute
node_serverapi -->|"routes usage"| node_usageroute
node_taskroute -->|"starts agent workflow"| node_coordinator
node_taskroute -->|"persists task state"| node_storage
node_taskroute -->|"uses workspace"| node_workspaceengine
node_taskroute -->|"routes model choice"| node_modelrouter
node_taskroute -.->|"prepares task context"| node_context
node_coordinator -.->|"dispatches specialists"| node_baseagent
node_baseagent -->|"requests completions"| node_modelrouter
node_baseagent -->|"invokes tools"| node_toolregistry
node_baseagent -->|"records task data"| node_storage
node_modelrouter -->|"dispatches completion"| node_openai
node_modelrouter -->|"dispatches completion"| node_gemini
node_openai -.->|"calls provider API"| node_openai_service
node_gemini -.->|"calls provider API"| node_gemini_service
node_toolregistry -.->|"dispatches terminal"| node_terminaltool
node_workspaceroute -->|"serves workspace operations"| node_workspaceengine
node_workspaceroute -->|"executes commands"| node_terminaltool
node_context -->|"reads workspace"| node_workspaceengine
node_context -->|"reads cached files"| node_filecache
node_workspaceengine -->|"persists workspace data"| node_storage
node_workspaceengine -->|"uses file cache"| node_filecache
node_providerroute -->|"configures routing"| node_modelrouter
node_providerroute -->|"stores credentials"| node_storage
node_sessionroute -->|"reads session data"| node_storage
node_sessionroute -->|"uses workspace service"| node_workspaceengine
node_usageroute -->|"reads usage records"| node_storage
node_desktopapp -->|"starts embedded server"| node_servermanager
node_servermanager -->|"hosts API"| node_serverapi

click node_clientapp "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/client/src/App.tsx"
click node_chat "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/client/src/components/screens/ChatScreen.tsx"
click node_workspaceui "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/client/src/components/screens/WorkspaceScreen.tsx"
click node_terminalui "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/client/src/components/screens/TerminalScreen.tsx"
click node_providerui "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/client/src/components/screens/ProviderSetupScreen.tsx"
click node_usageui "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/client/src/components/screens/UsageScreen.tsx"
click node_clientapi "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/client/src/services/api.ts"
click node_serverapi "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/api/app.ts"
click node_taskroute "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/api/routes/task.ts"
click node_workspaceroute "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/api/routes/workspace.ts"
click node_providerroute "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/api/routes/provider.ts"
click node_sessionroute "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/api/routes/session.ts"
click node_usageroute "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/api/routes/usage.ts"
click node_coordinator "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/agent/coordinator.ts"
click node_baseagent "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/agent/base-agent.ts"
click node_modelrouter "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/providers/model-router.ts"
click node_openai "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/providers/openai-provider.ts"
click node_gemini "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/providers/gemini-provider.ts"
click node_toolregistry "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/tools/tool-registry.ts"
click node_terminaltool "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/tools/terminal.ts"
click node_workspaceengine "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/workspace/workspace-service.ts"
click node_context "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/context/context-engine.ts"
click node_filecache "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/cache/file-cache.ts"
click node_storage "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/storage/storage-engine.ts"
click node_desktopapp "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/desktop/src/main.ts"
click node_servermanager "https://github.com/mohanshankarbotcha/nexux/blob/main/packages/desktop/src/server-manager.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_clientapp,node_chat,node_workspaceui,node_terminalui,node_providerui,node_usageui,node_clientapi toneBlue
class node_serverapi,node_taskroute,node_workspaceroute,node_providerroute,node_sessionroute,node_usageroute toneAmber
class node_coordinator,node_baseagent,node_modelrouter,node_openai,node_gemini toneMint
class node_toolregistry,node_terminaltool,node_workspaceengine,node_context toneRose
class node_filecache,node_storage,node_developer,node_openai_service,node_gemini_service toneIndigo
class node_desktopapp,node_servermanager toneTeal
```

## Components

### Client workspaces

- [Workspace UI](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/client/src/App.tsx): `packages/client/src/App.tsx`
- [Chat workspace](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/client/src/components/screens/ChatScreen.tsx): `packages/client/src/components/screens/ChatScreen.tsx`
- [Workspace editor](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/client/src/components/screens/WorkspaceScreen.tsx): `packages/client/src/components/screens/WorkspaceScreen.tsx`
- [Terminal view](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/client/src/components/screens/TerminalScreen.tsx): `packages/client/src/components/screens/TerminalScreen.tsx`
- [Provider setup](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/client/src/components/screens/ProviderSetupScreen.tsx): `packages/client/src/components/screens/ProviderSetupScreen.tsx`
- [Usage telemetry](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/client/src/components/screens/UsageScreen.tsx): `packages/client/src/components/screens/UsageScreen.tsx`
- [API client](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/client/src/services/api.ts): `packages/client/src/services/api.ts`

### Server API

- [HTTP API](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/api/app.ts): `packages/server/src/api/app.ts`
- [Task endpoint](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/api/routes/task.ts): `packages/server/src/api/routes/task.ts`
- [Workspace endpoint](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/api/routes/workspace.ts): `packages/server/src/api/routes/workspace.ts`
- [Provider endpoint](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/api/routes/provider.ts): `packages/server/src/api/routes/provider.ts`
- [Session endpoint](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/api/routes/session.ts): `packages/server/src/api/routes/session.ts`
- [Usage endpoint](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/api/routes/usage.ts): `packages/server/src/api/routes/usage.ts`

### Agent runtime

- [Agent coordinator](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/agent/coordinator.ts): `packages/server/src/agent/coordinator.ts`
- [Agent execution](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/agent/base-agent.ts): `packages/server/src/agent/base-agent.ts`
- [Model routing](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/providers/model-router.ts): `packages/server/src/providers/model-router.ts`
- [OpenAI provider](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/providers/openai-provider.ts): `packages/server/src/providers/openai-provider.ts`
- [Gemini provider](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/providers/gemini-provider.ts): `packages/server/src/providers/gemini-provider.ts`

### Workspace services

- [Tool dispatch](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/tools/tool-registry.ts): `packages/server/src/tools/tool-registry.ts`
- [Terminal execution](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/tools/terminal.ts): `packages/server/src/tools/terminal.ts`
- [Workspace service](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/workspace/workspace-service.ts): `packages/server/src/workspace/workspace-service.ts`
- [Task context](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/context/context-engine.ts): `packages/server/src/context/context-engine.ts`

### Shared services

- [File cache](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/cache/file-cache.ts): `packages/server/src/cache/file-cache.ts`
- [Local persistence](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/server/src/storage/storage-engine.ts): `packages/server/src/storage/storage-engine.ts`

### Desktop host

- [Electron host](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/desktop/src/main.ts): `packages/desktop/src/main.ts`
- [Embedded server](https://github.com/mohanshankarbotcha/nexux/blob/main/packages/desktop/src/server-manager.ts): `packages/desktop/src/server-manager.ts`

### Other components

- **Developer**
- **OpenAI service**
- **Gemini service**

## Connections

- Developer → Workspace UI: uses workspaces (evidence: `README.md`)
- Workspace UI → Chat workspace: shows chat (evidence: `packages/client/src/App.tsx`)
- Workspace UI → Workspace editor: shows editor (evidence: `README.md`)
- Workspace UI → Terminal view: shows terminal (evidence: `README.md`)
- Workspace UI → Provider setup: configures providers (evidence: `README.md`)
- Workspace UI → Usage telemetry: shows telemetry (evidence: `README.md`)
- Chat workspace → API client: submits tasks (evidence: `README.md`)
- Workspace editor → API client: requests workspace data (evidence: `README.md`)
- Terminal view → API client: runs commands
- Provider setup → API client: saves credentials (evidence: `README.md`)
- Usage telemetry → API client: requests usage
- API client → HTTP API: sends HTTP requests (evidence: `README.md`)
- HTTP API → Task endpoint: routes tasks (evidence: `packages/server/src/api/app.ts`)
- HTTP API → Workspace endpoint: routes workspace (evidence: `packages/server/src/api/app.ts`)
- HTTP API → Provider endpoint: routes providers (evidence: `packages/server/src/api/app.ts`)
- HTTP API → Session endpoint: routes sessions (evidence: `packages/server/src/api/app.ts`)
- HTTP API → Usage endpoint: routes usage (evidence: `packages/server/src/api/app.ts`)
- Task endpoint → Agent coordinator: starts agent workflow (evidence: `packages/server/src/api/routes/task.ts`)
- Task endpoint → Local persistence: persists task state (evidence: `packages/server/src/api/routes/task.ts`)
- Task endpoint → Workspace service: uses workspace (evidence: `packages/server/src/api/routes/task.ts`)
- Task endpoint → Model routing: routes model choice (evidence: `packages/server/src/api/routes/task.ts`)
- Task endpoint → Task context: prepares task context
- Agent coordinator → Agent execution: dispatches specialists (evidence: `README.md`)
- Agent execution → Model routing: requests completions (evidence: `packages/server/src/agent/base-agent.ts`)
- Agent execution → Tool dispatch: invokes tools (evidence: `packages/server/src/agent/base-agent.ts`)
- Agent execution → Local persistence: records task data (evidence: `packages/server/src/agent/base-agent.ts`)
- Model routing → OpenAI provider: dispatches completion (evidence: `packages/server/src/providers/model-router.ts`)
- Model routing → Gemini provider: dispatches completion (evidence: `packages/server/src/providers/model-router.ts`)
- OpenAI provider → OpenAI service: calls provider API
- Gemini provider → Gemini service: calls provider API
- Tool dispatch → Terminal execution: dispatches terminal
- Workspace endpoint → Workspace service: serves workspace operations (evidence: `packages/server/src/api/routes/workspace.ts`)
- Workspace endpoint → Terminal execution: executes commands (evidence: `packages/server/src/api/routes/workspace.ts`)
- Task context → Workspace service: reads workspace (evidence: `packages/server/src/context/context-engine.ts`)
- Task context → File cache: reads cached files (evidence: `packages/server/src/context/context-engine.ts`)
- Workspace service → Local persistence: persists workspace data (evidence: `packages/server/src/workspace/workspace-service.ts`)
- Workspace service → File cache: uses file cache (evidence: `packages/server/src/workspace/workspace-service.ts`)
- Provider endpoint → Model routing: configures routing (evidence: `packages/server/src/api/routes/provider.ts`)
- Provider endpoint → Local persistence: stores credentials (evidence: `packages/server/src/api/routes/provider.ts`)
- Session endpoint → Local persistence: reads session data (evidence: `packages/server/src/api/routes/session.ts`)
- Session endpoint → Workspace service: uses workspace service (evidence: `packages/server/src/api/routes/session.ts`)
- Usage endpoint → Local persistence: reads usage records (evidence: `packages/server/src/api/routes/usage.ts`)
- Electron host → Embedded server: starts embedded server (evidence: `packages/desktop/src/main.ts`)
- Embedded server → HTTP API: hosts API (evidence: `packages/desktop/src/server-manager.ts`)
