# supremeai-bd/supremeai-public architecture

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

- Interactive diagram: https://gitdiagram.com/supremeai-bd/supremeai-public
- Repository: https://github.com/supremeai-bd/supremeai-public

## Overview

SupremeAI Studio is a shared React/TypeScript AI workspace for web, desktop, and Android. The primary flow starts with a user prompt in the app, passes through intent orchestration and chat state/services, and reaches the configured API runtime; users can also work with research, voice, and developer-workspace features. Separate branches cover account management, cross-device sync, and the admin control plane. Edges are limited to README statements and relationships visible in excerpts or the source index; unsampled feature internals are represented at their existing directory paths.

Main entry points: [`src/App.tsx`](https://github.com/supremeai-bd/supremeai-public/blob/main/src/App.tsx) (App Shell), [`src/services/apiClient.ts`](https://github.com/supremeai-bd/supremeai-public/blob/main/src/services/apiClient.ts) (API Client), [`src/stores/useChatStore.ts`](https://github.com/supremeai-bd/supremeai-public/blob/main/src/stores/useChatStore.ts) (Chat State), [`src/stores/useAuthStore.ts`](https://github.com/supremeai-bd/supremeai-public/blob/main/src/stores/useAuthStore.ts) (Auth State)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Workspace Client"]
  node_app["App Shell<br/>[App.tsx]"]
  node_chat_ui["Chat UI<br/>[ChatThread.tsx]"]
  node_workspace_ui["Developer Workspace"]
  node_model_ui["Model Selector<br/>[ModelMatrix.tsx]"]
end

subgraph group_services["AI Services"]
  node_intent["Intent Orchestrator"]
  node_chat_store["Chat State<br/>[useChatStore.ts]"]
  node_chat_service["Chat Service<br/>[chatService.ts]"]
  node_research["Research<br/>[researchService.ts]"]
  node_voice_hook["Live Voice"]
  node_speech["Speech Utilities<br/>[speechUtils.ts]"]
end

subgraph group_runtime["API Runtime"]
  node_api_client["API Client<br/>[apiClient.ts]"]
  node_edge_api["Pages API"]
  node_local_server["Local Web Server<br/>[server.ts]"]
  node_env["Runtime Config<br/>[env.ts]"]
  node_desktop_core["Desktop Runtime<br/>[lib.rs]"]
end

subgraph group_identity["Identity and Sync"]
  node_auth_store["Auth State<br/>[useAuthStore.ts]"]
  node_auth_service["Auth Service<br/>[authService.ts]"]
  node_customer_store["Customer State"]
  node_sync["Realtime Sync<br/>[realtimeSync.ts]"]
end

subgraph group_admin["Admin Studio"]
  node_control_router["Control Plane"]
  node_health["MCP Health"]
  node_admin_ui["Admin Studio"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"orchestrates intent"| node_intent
node_app -->|"renders"| node_chat_ui
node_app -->|"starts voice"| node_voice_hook
node_app -->|"initializes sync"| node_sync
node_intent -.->|"updates chat"| node_chat_store
node_chat_store -->|"calls"| node_chat_service
node_chat_store -->|"calls"| node_research
node_chat_store -.->|"routes requests"| node_env
node_chat_service -.->|"uses"| node_api_client
node_api_client -->|"reads config"| node_env
node_api_client -.->|"requests API"| node_edge_api
node_api_client -.->|"requests API"| node_local_server
node_voice_hook -->|"resolves speech"| node_speech
node_voice_hook -->|"reads config"| node_env
node_auth_store -->|"calls"| node_auth_service
node_auth_service -->|"uses"| node_api_client
node_auth_store -->|"updates"| node_customer_store
node_auth_store -->|"uses preferences bus"| node_sync
node_local_server -->|"queries health"| node_health
node_control_router -->|"collects health"| node_health
node_app -.->|"presents admin"| node_admin_ui
node_admin_ui -.->|"calls control plane"| node_control_router
node_app -->|"presents workspace"| node_workspace_ui
node_app -->|"presents models"| node_model_ui
node_desktop_core -->|"hosts shared frontend"| node_app

click node_app "https://github.com/supremeai-bd/supremeai-public/blob/main/src/App.tsx"
click node_chat_ui "https://github.com/supremeai-bd/supremeai-public/blob/main/src/components/ChatThread.tsx"
click node_workspace_ui "https://github.com/supremeai-bd/supremeai-public/tree/main/src/components/workspace"
click node_model_ui "https://github.com/supremeai-bd/supremeai-public/blob/main/src/components/ModelMatrix.tsx"
click node_intent "https://github.com/supremeai-bd/supremeai-public/blob/main/src/services/intentOrchestrator.ts"
click node_chat_store "https://github.com/supremeai-bd/supremeai-public/blob/main/src/stores/useChatStore.ts"
click node_chat_service "https://github.com/supremeai-bd/supremeai-public/blob/main/src/services/chatService.ts"
click node_research "https://github.com/supremeai-bd/supremeai-public/blob/main/src/services/researchService.ts"
click node_voice_hook "https://github.com/supremeai-bd/supremeai-public/blob/main/src/hooks/useLiveVoiceSession.ts"
click node_speech "https://github.com/supremeai-bd/supremeai-public/blob/main/src/utils/speechUtils.ts"
click node_api_client "https://github.com/supremeai-bd/supremeai-public/blob/main/src/services/apiClient.ts"
click node_edge_api "https://github.com/supremeai-bd/supremeai-public/tree/main/functions/api"
click node_local_server "https://github.com/supremeai-bd/supremeai-public/blob/main/server.ts"
click node_env "https://github.com/supremeai-bd/supremeai-public/blob/main/src/config/env.ts"
click node_auth_store "https://github.com/supremeai-bd/supremeai-public/blob/main/src/stores/useAuthStore.ts"
click node_auth_service "https://github.com/supremeai-bd/supremeai-public/blob/main/src/services/authService.ts"
click node_customer_store "https://github.com/supremeai-bd/supremeai-public/blob/main/src/stores/useCustomerStore.ts"
click node_sync "https://github.com/supremeai-bd/supremeai-public/blob/main/src/sync/realtimeSync.ts"
click node_control_router "https://github.com/supremeai-bd/supremeai-public/blob/main/src/server/controlPlaneRouter.ts"
click node_health "https://github.com/supremeai-bd/supremeai-public/blob/main/src/server/mcpHealthCollector.ts"
click node_admin_ui "https://github.com/supremeai-bd/supremeai-public/tree/main/src/components/admin"
click node_desktop_core "https://github.com/supremeai-bd/supremeai-public/blob/main/src-tauri/src/lib.rs"

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_chat_ui,node_workspace_ui,node_model_ui,node_user toneBlue
class node_intent,node_chat_store,node_chat_service,node_research,node_voice_hook,node_speech toneAmber
class node_api_client,node_edge_api,node_local_server,node_env,node_desktop_core toneMint
class node_auth_store,node_auth_service,node_customer_store,node_sync toneRose
class node_control_router,node_health,node_admin_ui toneIndigo
```

## Components

### Workspace Client

- [App Shell](https://github.com/supremeai-bd/supremeai-public/blob/main/src/App.tsx): `src/App.tsx`
- [Chat UI](https://github.com/supremeai-bd/supremeai-public/blob/main/src/components/ChatThread.tsx): `src/components/ChatThread.tsx`
- [Developer Workspace](https://github.com/supremeai-bd/supremeai-public/tree/main/src/components/workspace): `src/components/workspace`
- [Model Selector](https://github.com/supremeai-bd/supremeai-public/blob/main/src/components/ModelMatrix.tsx): `src/components/ModelMatrix.tsx`

### AI Services

- [Intent Orchestrator](https://github.com/supremeai-bd/supremeai-public/blob/main/src/services/intentOrchestrator.ts): `src/services/intentOrchestrator.ts`
- [Chat State](https://github.com/supremeai-bd/supremeai-public/blob/main/src/stores/useChatStore.ts): `src/stores/useChatStore.ts`
- [Chat Service](https://github.com/supremeai-bd/supremeai-public/blob/main/src/services/chatService.ts): `src/services/chatService.ts`
- [Research](https://github.com/supremeai-bd/supremeai-public/blob/main/src/services/researchService.ts): `src/services/researchService.ts`
- [Live Voice](https://github.com/supremeai-bd/supremeai-public/blob/main/src/hooks/useLiveVoiceSession.ts): `src/hooks/useLiveVoiceSession.ts`
- [Speech Utilities](https://github.com/supremeai-bd/supremeai-public/blob/main/src/utils/speechUtils.ts): `src/utils/speechUtils.ts`

### API Runtime

- [API Client](https://github.com/supremeai-bd/supremeai-public/blob/main/src/services/apiClient.ts): `src/services/apiClient.ts`
- [Pages API](https://github.com/supremeai-bd/supremeai-public/tree/main/functions/api): `functions/api`
- [Local Web Server](https://github.com/supremeai-bd/supremeai-public/blob/main/server.ts): `server.ts`
- [Runtime Config](https://github.com/supremeai-bd/supremeai-public/blob/main/src/config/env.ts): `src/config/env.ts`
- [Desktop Runtime](https://github.com/supremeai-bd/supremeai-public/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`

### Identity and Sync

- [Auth State](https://github.com/supremeai-bd/supremeai-public/blob/main/src/stores/useAuthStore.ts): `src/stores/useAuthStore.ts`
- [Auth Service](https://github.com/supremeai-bd/supremeai-public/blob/main/src/services/authService.ts): `src/services/authService.ts`
- [Customer State](https://github.com/supremeai-bd/supremeai-public/blob/main/src/stores/useCustomerStore.ts): `src/stores/useCustomerStore.ts`
- [Realtime Sync](https://github.com/supremeai-bd/supremeai-public/blob/main/src/sync/realtimeSync.ts): `src/sync/realtimeSync.ts`

### Admin Studio

- [Control Plane](https://github.com/supremeai-bd/supremeai-public/blob/main/src/server/controlPlaneRouter.ts): `src/server/controlPlaneRouter.ts`
- [MCP Health](https://github.com/supremeai-bd/supremeai-public/blob/main/src/server/mcpHealthCollector.ts): `src/server/mcpHealthCollector.ts`
- [Admin Studio](https://github.com/supremeai-bd/supremeai-public/tree/main/src/components/admin): `src/components/admin`

### Other components

- **User**

## Connections

- User → App Shell: uses
- App Shell → Intent Orchestrator: orchestrates intent (evidence: `src/App.tsx`)
- App Shell → Chat UI: renders (evidence: `src/App.tsx`)
- App Shell → Live Voice: starts voice (evidence: `src/App.tsx`)
- App Shell → Realtime Sync: initializes sync (evidence: `src/App.tsx`)
- Intent Orchestrator → Chat State: updates chat (evidence: `src/stores/useChatStore.ts`)
- Chat State → Chat Service: calls (evidence: `src/stores/useChatStore.ts`)
- Chat State → Research: calls (evidence: `src/stores/useChatStore.ts`)
- Chat State → Runtime Config: routes requests
- Chat Service → API Client: uses
- API Client → Runtime Config: reads config (evidence: `src/services/apiClient.ts`)
- API Client → Pages API: requests API
- API Client → Local Web Server: requests API
- Live Voice → Speech Utilities: resolves speech (evidence: `src/hooks/useLiveVoiceSession.ts`)
- Live Voice → Runtime Config: reads config (evidence: `src/hooks/useLiveVoiceSession.ts`)
- Auth State → Auth Service: calls (evidence: `src/stores/useAuthStore.ts`)
- Auth Service → API Client: uses (evidence: `src/services/authService.ts`)
- Auth State → Customer State: updates (evidence: `src/stores/useAuthStore.ts`)
- Auth State → Realtime Sync: uses preferences bus (evidence: `src/stores/useAuthStore.ts`)
- Local Web Server → MCP Health: queries health (evidence: `server.ts`)
- Control Plane → MCP Health: collects health (evidence: `src/server/controlPlaneRouter.ts`)
- App Shell → Admin Studio: presents admin (evidence: `src/App.tsx`)
- Admin Studio → Control Plane: calls control plane
- App Shell → Developer Workspace: presents workspace (evidence: `src/App.tsx`)
- App Shell → Model Selector: presents models (evidence: `src/App.tsx`)
- Desktop Runtime → App Shell: hosts shared frontend
