# not4rohith/byok-based-ai-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/not4rohith/byok-based-ai-assistant
- Repository: https://github.com/not4rohith/byok-based-ai-assistant

## Overview

This is a BYOK personal AI task manager with desktop and mobile clients backed by an HTTP service and MongoDB. Users organize tasks and lists, configure providers and models, and chat with an assistant that can select tools, manage tasks and goals, and use memory. The graph combines the principal UI-to-API-to-domain workflow with documented AI capabilities, chat persistence, sync, and analytics. Some feature links are based on README statements because their implementation files were not excerpted; those limits are reflected in the evidence citations.

Main entry points: [`backend/src/server.ts`](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/server.ts) (HTTP server), [`backend/src/services/task.service.ts`](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/task.service.ts) (Task management), [`apps/desktop/src/App.tsx`](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/apps/desktop/src/App.tsx) (Desktop task UI), [`backend/src/services/ai.service.ts`](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/ai.service.ts) (AI orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client applications"]
  node_desktop["Desktop task UI<br/>[App.tsx]"]
  node_task_views["Task views"]
  node_chat_ui["Chat interface<br/>[FullScreenChat.tsx]"]
  node_settings_ui["Settings UI<br/>[SettingsView.tsx]"]
  node_client_api["Desktop API client<br/>[client.ts]"]
  node_offline["Offline cache<br/>[offlineCache.ts]"]
  node_mobile["Mobile client<br/>[App.tsx]"]
  node_mobile_storage["Mobile storage<br/>[mobileStorage.ts]"]
end

subgraph group_api["Backend API and domains"]
  node_server["HTTP server<br/>[server.ts]"]
  node_task_routes["Task and list routes<br/>[tasks.router.ts]"]
  node_task_domain["Task management<br/>[task.service.ts]"]
  node_goal_domain["Goal management<br/>[goal.service.ts]"]
  node_memory_domain["Memory management<br/>[memory.service.ts]"]
  node_chat_routes["Chat routes<br/>[chat.router.ts]"]
  node_analytics["Productivity analytics"]
end

subgraph group_assistant["AI assistant"]
  node_ai_service["AI orchestration<br/>[ai.service.ts]"]
  node_router["Intent decision router<br/>[laya.router.ts]"]
  node_agent["Autonomous agent<br/>[aiAgentRunner.ts]"]
  node_prompts["Prompt modules"]
  node_tools["Assistant tools<br/>[registry.ts]"]
  node_providers["Provider fallback"]
end

subgraph group_persistence["Persistence and integrations"]
  node_chat_storage["Chat storage"]
  node_database[("MongoDB data<br/>[connection.ts]")]
  node_google_tasks["Google Tasks sync"]
  node_sync["Conflict resolution"]
end

node_user(("User"))

node_user -->|"uses"| node_desktop
node_user -->|"uses"| node_mobile
node_desktop -->|"renders"| node_task_views
node_desktop -->|"opens"| node_chat_ui
node_desktop -->|"opens"| node_settings_ui
node_desktop -->|"requests data"| node_client_api
node_client_api -->|"caches responses"| node_offline
node_mobile -->|"uses"| node_mobile_storage
node_mobile_storage -->|"sends API requests"| node_server
node_client_api -->|"sends API requests"| node_server
node_settings_ui -->|"configures providers"| node_client_api
node_server -->|"registers routes"| node_task_routes
node_task_routes -.->|"delegates tasks"| node_task_domain
node_server -->|"registers routes"| node_chat_routes
node_chat_routes -->|"invokes AI"| node_ai_service
node_chat_routes -->|"reads and saves chats"| node_chat_storage
node_ai_service -->|"classifies intent"| node_router
node_router -->|"selects prompt modules"| node_prompts
node_router -->|"selects tools"| node_tools
node_ai_service -->|"runs agent"| node_agent
node_agent -->|"manages tasks"| node_task_domain
node_agent -->|"manages goals"| node_goal_domain
node_agent -->|"extracts memory"| node_memory_domain
node_ai_service -->|"generates responses"| node_providers
node_providers -.->|"calls chosen provider"| node_user
node_task_domain -->|"reads and writes"| node_database
node_chat_storage -->|"persists sessions"| node_database
node_task_domain -->|"syncs tasks"| node_google_tasks
node_server -->|"initializes service"| node_goal_domain
node_server -->|"initializes service"| node_memory_domain
node_server -->|"registers sync"| node_sync
node_server -->|"registers analytics"| node_analytics
node_sync -.->|"resolves conflicts"| node_task_domain
node_analytics -.->|"summarizes activity"| node_task_domain

click node_desktop "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/apps/desktop/src/App.tsx"
click node_task_views "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/apps/desktop/src/components/GoogleTasksMobileView.tsx"
click node_chat_ui "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/apps/desktop/src/components/FullScreenChat.tsx"
click node_settings_ui "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/apps/desktop/src/components/SettingsView.tsx"
click node_client_api "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/apps/desktop/src/api/client.ts"
click node_offline "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/apps/desktop/src/api/offlineCache.ts"
click node_mobile "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/apps/mobile/App.tsx"
click node_mobile_storage "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/apps/mobile/src/services/mobileStorage.ts"
click node_server "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/server.ts"
click node_task_routes "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/routes/tasks.router.ts"
click node_task_domain "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/task.service.ts"
click node_goal_domain "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/goal.service.ts"
click node_memory_domain "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/memory.service.ts"
click node_chat_routes "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/routes/chat.router.ts"
click node_ai_service "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/ai.service.ts"
click node_router "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/ai/router/laya.router.ts"
click node_agent "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/aiAgentRunner.ts"
click node_prompts "https://github.com/not4rohith/byok-based-ai-assistant/tree/main/backend/src/ai/prompts"
click node_tools "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/ai/tools/registry.ts"
click node_providers "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/ai/provider-manager.ts"
click node_chat_storage "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/chatStorage.service.ts"
click node_database "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/db/connection.ts"
click node_google_tasks "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/googleTasks.service.ts"
click node_sync "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/syncConflictResolver.ts"
click node_analytics "https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/analytics.service.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_desktop,node_task_views,node_chat_ui,node_settings_ui,node_client_api,node_offline,node_mobile,node_mobile_storage,node_user toneBlue
class node_server,node_task_routes,node_task_domain,node_goal_domain,node_memory_domain,node_chat_routes,node_analytics toneAmber
class node_ai_service,node_router,node_agent,node_prompts,node_tools,node_providers toneMint
class node_chat_storage,node_database,node_google_tasks,node_sync toneRose
```

## Components

### Client applications

- [Desktop task UI](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/apps/desktop/src/App.tsx): `apps/desktop/src/App.tsx`
- [Task views](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/apps/desktop/src/components/GoogleTasksMobileView.tsx): `apps/desktop/src/components/GoogleTasksMobileView.tsx`
- [Chat interface](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/apps/desktop/src/components/FullScreenChat.tsx): `apps/desktop/src/components/FullScreenChat.tsx`
- [Settings UI](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/apps/desktop/src/components/SettingsView.tsx): `apps/desktop/src/components/SettingsView.tsx`
- [Desktop API client](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/apps/desktop/src/api/client.ts): `apps/desktop/src/api/client.ts`
- [Offline cache](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/apps/desktop/src/api/offlineCache.ts): `apps/desktop/src/api/offlineCache.ts`
- [Mobile client](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/apps/mobile/App.tsx): `apps/mobile/App.tsx`
- [Mobile storage](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/apps/mobile/src/services/mobileStorage.ts): `apps/mobile/src/services/mobileStorage.ts`

### Backend API and domains

- [HTTP server](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [Task and list routes](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/routes/tasks.router.ts): `backend/src/routes/tasks.router.ts`
- [Task management](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/task.service.ts): `backend/src/services/task.service.ts`
- [Goal management](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/goal.service.ts): `backend/src/services/goal.service.ts`
- [Memory management](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/memory.service.ts): `backend/src/services/memory.service.ts`
- [Chat routes](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/routes/chat.router.ts): `backend/src/routes/chat.router.ts`
- [Productivity analytics](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/analytics.service.ts): `backend/src/services/analytics.service.ts`

### AI assistant

- [AI orchestration](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/ai.service.ts): `backend/src/services/ai.service.ts`
- [Intent decision router](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/ai/router/laya.router.ts): `backend/src/ai/router/laya.router.ts`
- [Autonomous agent](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/aiAgentRunner.ts): `backend/src/services/aiAgentRunner.ts`
- [Prompt modules](https://github.com/not4rohith/byok-based-ai-assistant/tree/main/backend/src/ai/prompts): `backend/src/ai/prompts`
- [Assistant tools](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/ai/tools/registry.ts): `backend/src/ai/tools/registry.ts`
- [Provider fallback](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/ai/provider-manager.ts): `backend/src/ai/provider-manager.ts`

### Persistence and integrations

- [Chat storage](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/chatStorage.service.ts): `backend/src/services/chatStorage.service.ts`
- [MongoDB data](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/db/connection.ts): `backend/src/db/connection.ts`
- [Google Tasks sync](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/googleTasks.service.ts): `backend/src/services/googleTasks.service.ts`
- [Conflict resolution](https://github.com/not4rohith/byok-based-ai-assistant/blob/main/backend/src/services/syncConflictResolver.ts): `backend/src/services/syncConflictResolver.ts`

### Other components

- **User**

## Connections

- User → Desktop task UI: uses (evidence: `README.md`)
- User → Mobile client: uses (evidence: `README.md`)
- Desktop task UI → Task views: renders (evidence: `apps/desktop/src/App.tsx`)
- Desktop task UI → Chat interface: opens (evidence: `apps/desktop/src/App.tsx`)
- Desktop task UI → Settings UI: opens (evidence: `apps/desktop/src/App.tsx`)
- Desktop task UI → Desktop API client: requests data (evidence: `apps/desktop/src/App.tsx`)
- Desktop API client → Offline cache: caches responses (evidence: `apps/desktop/src/api/client.ts`)
- Mobile client → Mobile storage: uses (evidence: `apps/mobile/App.tsx`)
- Mobile storage → HTTP server: sends API requests (evidence: `apps/mobile/src/services/mobileStorage.ts`)
- Desktop API client → HTTP server: sends API requests (evidence: `apps/desktop/src/api/client.ts`)
- Settings UI → Desktop API client: configures providers (evidence: `README.md`)
- HTTP server → Task and list routes: registers routes (evidence: `backend/src/server.ts`)
- Task and list routes → Task management: delegates tasks
- HTTP server → Chat routes: registers routes (evidence: `backend/src/server.ts`)
- Chat routes → AI orchestration: invokes AI (evidence: `backend/src/routes/chat.router.ts`)
- Chat routes → Chat storage: reads and saves chats (evidence: `backend/src/routes/chat.router.ts`)
- AI orchestration → Intent decision router: classifies intent (evidence: `README.md`)
- Intent decision router → Prompt modules: selects prompt modules (evidence: `README.md`)
- Intent decision router → Assistant tools: selects tools (evidence: `README.md`)
- AI orchestration → Autonomous agent: runs agent (evidence: `README.md`)
- Autonomous agent → Task management: manages tasks (evidence: `README.md`)
- Autonomous agent → Goal management: manages goals (evidence: `README.md`)
- Autonomous agent → Memory management: extracts memory (evidence: `README.md`)
- AI orchestration → Provider fallback: generates responses (evidence: `README.md`)
- Provider fallback → User: calls chosen provider
- Task management → MongoDB data: reads and writes (evidence: `backend/src/services/task.service.ts`)
- Chat storage → MongoDB data: persists sessions (evidence: `backend/src/services/chatStorage.service.ts`)
- Task management → Google Tasks sync: syncs tasks (evidence: `backend/src/services/task.service.ts`)
- HTTP server → Goal management: initializes service (evidence: `backend/src/server.ts`)
- HTTP server → Memory management: initializes service (evidence: `backend/src/server.ts`)
- HTTP server → Conflict resolution: registers sync (evidence: `backend/src/server.ts`)
- HTTP server → Productivity analytics: registers analytics (evidence: `backend/src/server.ts`)
- Conflict resolution → Task management: resolves conflicts
- Productivity analytics → Task management: summarizes activity
