# won-life/aideep-web architecture

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

- Interactive diagram: https://gitdiagram.com/won-life/aideep-web
- Repository: https://github.com/won-life/aideep-web

## Overview

OnNode is a collaborative graph-workspace web app: users authenticate, complete onboarding, enter or create a workspace, and work with connected content nodes. The workspace combines graph editing, persisted node data, live collaboration, and meeting-bot status; account settings and demo chat are separate capabilities. The README is a generic Next.js starter and does not document product behavior, so feature coverage and relationships here rely on the file tree and the supplied SOURCE INDEX/excerpts; unsampled internals are represented at their exact paths without assuming unshown calls.

Main entry points: [`src/api/client.ts`](https://github.com/won-life/aideep-web/blob/main/src/api/client.ts) (HTTP client & refresh), [`src/api/ws.ts`](https://github.com/won-life/aideep-web/blob/main/src/api/ws.ts) (Workspace socket API), [`src/app/workspace/page.tsx`](https://github.com/won-life/aideep-web/blob/main/src/app/workspace/page.tsx) (Workspace entry), [`src/app/workspace/context.tsx`](https://github.com/won-life/aideep-web/blob/main/src/app/workspace/context.tsx) (Workspace state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity &amp; onboarding"]
  node_login["Login &amp; signup<br/>[LoginScreen.tsx]"]
  node_authsession["Session routing<br/>[useAuthSession.ts]"]
  node_oauthsignup["OAuth signup<br/>[useOAuthSignup.ts]"]
  node_onboarding["Onboarding flow<br/>[useOnboarding.ts]"]
  node_onboardingroute["Onboarding routing<br/>[onboardingEntry.ts]"]
end

subgraph group_workspace["Workspace graph"]
  node_workspacepage["Workspace entry<br/>[page.tsx]"]
  node_workspacecontext["Workspace state<br/>[context.tsx]"]
  node_sidebar["Workspace navigation<br/>[Sidebar.tsx]"]
  node_canvas["Graph canvas<br/>[GraphCanvas.tsx]"]
  node_graphnodes["Node data API<br/>[nodes.ts]"]
  node_editor["Node editor"]
  node_traversal["Graph traversal<br/>[traversal.ts]"]
  node_workspaceapi["Workspace API<br/>[workspace.ts]"]
end

subgraph group_collaboration["Live collaboration"]
  node_realtimehook["Workspace event handling<br/>[useWorkspaceWS.ts]"]
  node_websocket["Workspace socket API<br/>[ws.ts]"]
  node_awareness["Presence awareness"]
  node_yjs["Yjs provider<br/>[useYjsProvider.ts]"]
  node_socketprovider["Socket Yjs transport"]
end

subgraph group_account["Account &amp; settings"]
  node_settingspage["Settings screens"]
  node_settingsstate["Settings requests"]
  node_settingsapi["Settings API<br/>[settings.ts]"]
  node_httpclient["HTTP client &amp; refresh<br/>[client.ts]"]
  node_tokenstore[("Token persistence<br/>[tokenStorage.ts]")]
end

subgraph group_extensions["Chat &amp; meetings"]
  node_meetingwidget["Meeting bot controls"]
  node_meetingview["Meeting status view<br/>[useMeetingView.ts]"]
  node_meetingapi["Meeting API<br/>[meeting.ts]"]
  node_chat["AI chat panel<br/>[AiChatPanel.tsx]"]
  node_chatrequest["Demo chat request<br/>[demoChat.ts]"]
  node_chatroute["Demo chat route<br/>[route.ts]"]
  node_openai["OpenAI demo service<br/>[openaiDemoChat.ts]"]
end

node_user(("User"))
node_backend[("Application backend")]

node_user -->|"authenticates"| node_login
node_login -->|"checks session"| node_authsession
node_authsession -->|"chooses destination"| node_onboardingroute
node_authsession -->|"loads profile"| node_backend
node_oauthsignup -->|"completes signup"| node_backend
node_oauthsignup -->|"routes after signup"| node_onboardingroute
node_onboarding -->|"saves onboarding"| node_backend
node_onboarding -->|"uses entry state"| node_onboardingroute
node_onboardingroute -.->|"routes to workspace"| node_workspacepage
node_workspacepage -->|"reads workspace state"| node_workspacecontext
node_workspacepage -->|"renders graph"| node_canvas
node_workspacepage -->|"renders controls"| node_meetingwidget
node_workspacecontext -->|"uses workspace events"| node_websocket
node_workspacecontext -.->|"loads workspace"| node_backend
node_sidebar -->|"reads workspace state"| node_workspacecontext
node_sidebar -->|"manages workspaces"| node_workspaceapi
node_sidebar -->|"requests graph data"| node_graphnodes
node_canvas -.->|"loads and saves nodes"| node_graphnodes
node_canvas -.->|"uses graph traversal"| node_traversal
node_editor -->|"loads node data"| node_graphnodes
node_realtimehook -->|"subscribes to events"| node_websocket
node_realtimehook -->|"updates graph depth"| node_traversal
node_websocket -->|"exchanges live events"| node_backend
node_awareness -->|"uses socket events"| node_websocket
node_yjs -->|"uses socket API"| node_websocket
node_yjs -->|"creates provider"| node_socketprovider
node_meetingview -->|"finds descendants"| node_traversal
node_meetingwidget -.->|"requests bot actions"| node_meetingapi
node_chat -.->|"submits messages"| node_chatrequest
node_chatrequest -.->|"calls demo endpoint"| node_chatroute
node_chatroute -->|"dispatches request"| node_openai
node_settingspage -.->|"uses settings state"| node_settingsstate
node_settingsstate -->|"calls settings API"| node_settingsapi
node_settingsstate -->|"clears session"| node_httpclient
node_settingsapi -.->|"uses HTTP client"| node_httpclient
node_graphnodes -->|"uses HTTP client"| node_httpclient
node_httpclient -->|"reads and writes tokens"| node_tokenstore
node_httpclient -.->|"sends API requests"| node_backend

click node_login "https://github.com/won-life/aideep-web/blob/main/src/features/auth/LoginScreen.tsx"
click node_authsession "https://github.com/won-life/aideep-web/blob/main/src/features/auth/useAuthSession.ts"
click node_oauthsignup "https://github.com/won-life/aideep-web/blob/main/src/features/auth/useOAuthSignup.ts"
click node_onboarding "https://github.com/won-life/aideep-web/blob/main/src/features/onboarding/useOnboarding.ts"
click node_onboardingroute "https://github.com/won-life/aideep-web/blob/main/src/features/onboarding/onboardingEntry.ts"
click node_workspacepage "https://github.com/won-life/aideep-web/blob/main/src/app/workspace/page.tsx"
click node_workspacecontext "https://github.com/won-life/aideep-web/blob/main/src/app/workspace/context.tsx"
click node_sidebar "https://github.com/won-life/aideep-web/blob/main/src/components/layout/Sidebar.tsx"
click node_canvas "https://github.com/won-life/aideep-web/blob/main/src/features/graph/components/GraphCanvas.tsx"
click node_graphnodes "https://github.com/won-life/aideep-web/blob/main/src/features/graph/api/nodes.ts"
click node_editor "https://github.com/won-life/aideep-web/blob/main/src/features/editor/NodeEditorPanel.tsx"
click node_traversal "https://github.com/won-life/aideep-web/blob/main/src/features/graph/logic/traversal.ts"
click node_workspaceapi "https://github.com/won-life/aideep-web/blob/main/src/api/workspace.ts"
click node_realtimehook "https://github.com/won-life/aideep-web/blob/main/src/hooks/useWorkspaceWS.ts"
click node_websocket "https://github.com/won-life/aideep-web/blob/main/src/api/ws.ts"
click node_awareness "https://github.com/won-life/aideep-web/blob/main/src/hooks/useWorkspaceAwareness.ts"
click node_yjs "https://github.com/won-life/aideep-web/blob/main/src/hooks/useYjsProvider.ts"
click node_socketprovider "https://github.com/won-life/aideep-web/blob/main/src/lib/SocketIoYjsProvider.ts"
click node_meetingwidget "https://github.com/won-life/aideep-web/blob/main/src/features/meeting-bot/MeetingBotWidget.tsx"
click node_meetingview "https://github.com/won-life/aideep-web/blob/main/src/features/meeting-bot/useMeetingView.ts"
click node_meetingapi "https://github.com/won-life/aideep-web/blob/main/src/api/meeting.ts"
click node_chat "https://github.com/won-life/aideep-web/blob/main/src/features/chat/AiChatPanel.tsx"
click node_chatrequest "https://github.com/won-life/aideep-web/blob/main/src/features/chat/api/demoChat.ts"
click node_chatroute "https://github.com/won-life/aideep-web/blob/main/src/app/api/demo-chat/route.ts"
click node_openai "https://github.com/won-life/aideep-web/blob/main/src/features/chat/server/openaiDemoChat.ts"
click node_settingspage "https://github.com/won-life/aideep-web/blob/main/src/features/settings/PersonalSettingsScreen.tsx"
click node_settingsstate "https://github.com/won-life/aideep-web/blob/main/src/features/settings/usePersonalSettings.ts"
click node_settingsapi "https://github.com/won-life/aideep-web/blob/main/src/api/settings.ts"
click node_httpclient "https://github.com/won-life/aideep-web/blob/main/src/api/client.ts"
click node_tokenstore "https://github.com/won-life/aideep-web/blob/main/src/api/tokenStorage.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_login,node_authsession,node_oauthsignup,node_onboarding,node_onboardingroute,node_user toneBlue
class node_workspacepage,node_workspacecontext,node_sidebar,node_canvas,node_graphnodes,node_editor,node_traversal,node_workspaceapi,node_backend toneAmber
class node_realtimehook,node_websocket,node_awareness,node_yjs,node_socketprovider toneMint
class node_settingspage,node_settingsstate,node_settingsapi,node_httpclient,node_tokenstore toneRose
class node_meetingwidget,node_meetingview,node_meetingapi,node_chat,node_chatrequest,node_chatroute,node_openai toneIndigo
```

## Components

### Identity & onboarding

- [Login & signup](https://github.com/won-life/aideep-web/blob/main/src/features/auth/LoginScreen.tsx): `src/features/auth/LoginScreen.tsx`
- [Session routing](https://github.com/won-life/aideep-web/blob/main/src/features/auth/useAuthSession.ts): `src/features/auth/useAuthSession.ts`
- [OAuth signup](https://github.com/won-life/aideep-web/blob/main/src/features/auth/useOAuthSignup.ts): `src/features/auth/useOAuthSignup.ts`
- [Onboarding flow](https://github.com/won-life/aideep-web/blob/main/src/features/onboarding/useOnboarding.ts): `src/features/onboarding/useOnboarding.ts`
- [Onboarding routing](https://github.com/won-life/aideep-web/blob/main/src/features/onboarding/onboardingEntry.ts): `src/features/onboarding/onboardingEntry.ts`

### Workspace graph

- [Workspace entry](https://github.com/won-life/aideep-web/blob/main/src/app/workspace/page.tsx): `src/app/workspace/page.tsx`
- [Workspace state](https://github.com/won-life/aideep-web/blob/main/src/app/workspace/context.tsx): `src/app/workspace/context.tsx`
- [Workspace navigation](https://github.com/won-life/aideep-web/blob/main/src/components/layout/Sidebar.tsx): `src/components/layout/Sidebar.tsx`
- [Graph canvas](https://github.com/won-life/aideep-web/blob/main/src/features/graph/components/GraphCanvas.tsx): `src/features/graph/components/GraphCanvas.tsx`
- [Node data API](https://github.com/won-life/aideep-web/blob/main/src/features/graph/api/nodes.ts): `src/features/graph/api/nodes.ts`
- [Node editor](https://github.com/won-life/aideep-web/blob/main/src/features/editor/NodeEditorPanel.tsx): `src/features/editor/NodeEditorPanel.tsx`
- [Graph traversal](https://github.com/won-life/aideep-web/blob/main/src/features/graph/logic/traversal.ts): `src/features/graph/logic/traversal.ts`
- [Workspace API](https://github.com/won-life/aideep-web/blob/main/src/api/workspace.ts): `src/api/workspace.ts`

### Live collaboration

- [Workspace event handling](https://github.com/won-life/aideep-web/blob/main/src/hooks/useWorkspaceWS.ts): `src/hooks/useWorkspaceWS.ts`
- [Workspace socket API](https://github.com/won-life/aideep-web/blob/main/src/api/ws.ts): `src/api/ws.ts`
- [Presence awareness](https://github.com/won-life/aideep-web/blob/main/src/hooks/useWorkspaceAwareness.ts): `src/hooks/useWorkspaceAwareness.ts`
- [Yjs provider](https://github.com/won-life/aideep-web/blob/main/src/hooks/useYjsProvider.ts): `src/hooks/useYjsProvider.ts`
- [Socket Yjs transport](https://github.com/won-life/aideep-web/blob/main/src/lib/SocketIoYjsProvider.ts): `src/lib/SocketIoYjsProvider.ts`

### Account & settings

- [Settings screens](https://github.com/won-life/aideep-web/blob/main/src/features/settings/PersonalSettingsScreen.tsx): `src/features/settings/PersonalSettingsScreen.tsx`
- [Settings requests](https://github.com/won-life/aideep-web/blob/main/src/features/settings/usePersonalSettings.ts): `src/features/settings/usePersonalSettings.ts`
- [Settings API](https://github.com/won-life/aideep-web/blob/main/src/api/settings.ts): `src/api/settings.ts`
- [HTTP client & refresh](https://github.com/won-life/aideep-web/blob/main/src/api/client.ts): `src/api/client.ts`
- [Token persistence](https://github.com/won-life/aideep-web/blob/main/src/api/tokenStorage.ts): `src/api/tokenStorage.ts`

### Chat & meetings

- [Meeting bot controls](https://github.com/won-life/aideep-web/blob/main/src/features/meeting-bot/MeetingBotWidget.tsx): `src/features/meeting-bot/MeetingBotWidget.tsx`
- [Meeting status view](https://github.com/won-life/aideep-web/blob/main/src/features/meeting-bot/useMeetingView.ts): `src/features/meeting-bot/useMeetingView.ts`
- [Meeting API](https://github.com/won-life/aideep-web/blob/main/src/api/meeting.ts): `src/api/meeting.ts`
- [AI chat panel](https://github.com/won-life/aideep-web/blob/main/src/features/chat/AiChatPanel.tsx): `src/features/chat/AiChatPanel.tsx`
- [Demo chat request](https://github.com/won-life/aideep-web/blob/main/src/features/chat/api/demoChat.ts): `src/features/chat/api/demoChat.ts`
- [Demo chat route](https://github.com/won-life/aideep-web/blob/main/src/app/api/demo-chat/route.ts): `src/app/api/demo-chat/route.ts`
- [OpenAI demo service](https://github.com/won-life/aideep-web/blob/main/src/features/chat/server/openaiDemoChat.ts): `src/features/chat/server/openaiDemoChat.ts`

### Other components

- **User**
- **Application backend**

## Connections

- User → Login & signup: authenticates
- Login & signup → Session routing: checks session (evidence: `src/app/login/page.tsx`)
- Session routing → Onboarding routing: chooses destination (evidence: `src/features/auth/useAuthSession.ts`)
- Session routing → Application backend: loads profile (evidence: `src/features/auth/useAuthSession.ts`)
- OAuth signup → Application backend: completes signup (evidence: `src/features/auth/useOAuthSignup.ts`)
- OAuth signup → Onboarding routing: routes after signup (evidence: `src/features/auth/useOAuthSignup.ts`)
- Onboarding flow → Application backend: saves onboarding (evidence: `src/features/onboarding/useOnboarding.ts`)
- Onboarding flow → Onboarding routing: uses entry state (evidence: `src/features/onboarding/useOnboarding.ts`)
- Onboarding routing → Workspace entry: routes to workspace
- Workspace entry → Workspace state: reads workspace state (evidence: `src/app/workspace/page.tsx`)
- Workspace entry → Graph canvas: renders graph (evidence: `src/app/workspace/page.tsx`)
- Workspace entry → Meeting bot controls: renders controls (evidence: `src/app/workspace/page.tsx`)
- Workspace state → Workspace socket API: uses workspace events (evidence: `src/app/workspace/context.tsx`)
- Workspace state → Application backend: loads workspace
- Workspace navigation → Workspace state: reads workspace state (evidence: `src/components/layout/Sidebar.tsx`)
- Workspace navigation → Workspace API: manages workspaces (evidence: `src/components/layout/Sidebar.tsx`)
- Workspace navigation → Node data API: requests graph data (evidence: `src/components/layout/Sidebar.tsx`)
- Graph canvas → Node data API: loads and saves nodes
- Graph canvas → Graph traversal: uses graph traversal
- Node editor → Node data API: loads node data (evidence: `src/app/workspace/node/[nodeId]/page.tsx`)
- Workspace event handling → Workspace socket API: subscribes to events (evidence: `src/hooks/useWorkspaceWS.ts`)
- Workspace event handling → Graph traversal: updates graph depth (evidence: `src/hooks/useWorkspaceWS.ts`)
- Workspace socket API → Application backend: exchanges live events (evidence: `src/api/ws.ts`)
- Presence awareness → Workspace socket API: uses socket events (evidence: `src/hooks/useWorkspaceAwareness.ts`)
- Yjs provider → Workspace socket API: uses socket API (evidence: `src/hooks/useYjsProvider.ts`)
- Yjs provider → Socket Yjs transport: creates provider (evidence: `src/hooks/useYjsProvider.ts`)
- Meeting status view → Graph traversal: finds descendants (evidence: `src/features/meeting-bot/useMeetingView.ts`)
- Meeting bot controls → Meeting API: requests bot actions
- AI chat panel → Demo chat request: submits messages
- Demo chat request → Demo chat route: calls demo endpoint
- Demo chat route → OpenAI demo service: dispatches request (evidence: `src/app/api/demo-chat/route.ts`)
- Settings screens → Settings requests: uses settings state
- Settings requests → Settings API: calls settings API (evidence: `src/features/settings/usePersonalSettings.ts`)
- Settings requests → HTTP client & refresh: clears session (evidence: `src/features/settings/usePersonalSettings.ts`)
- Settings API → HTTP client & refresh: uses HTTP client
- Node data API → HTTP client & refresh: uses HTTP client (evidence: `src/features/graph/api/nodes.ts`)
- HTTP client & refresh → Token persistence: reads and writes tokens (evidence: `src/api/client.ts`)
- HTTP client & refresh → Application backend: sends API requests
