# garvthanvi/voice-note-taking architecture

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

- Interactive diagram: https://gitdiagram.com/garvthanvi/voice-note-taking
- Repository: https://github.com/garvthanvi/voice-note-taking

## Overview

NoteFlow is a voice-driven note-taking product with a React frontend and Express API. The principal flow records a spoken command, transcribes it, extracts intent, resolves the target note or todo, and executes an action with undo support. Users can also manage notes and labels directly, authenticate with password or Google OAuth, and connect external AI clients through MCP. Edges reflect the README and shown imports, route mounts, and calls; unsampled implementations are represented only where documented.

Main entry points: [`backend/src/app.ts`](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/app.ts) (API route mounting), [`backend/src/routes/voice.ts`](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/routes/voice.ts) (Voice command route), [`backend/src/mcp/http.ts`](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/mcp/http.ts) (MCP HTTP server), [`backend/src/routes/note.ts`](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/routes/note.ts) (Note and todo routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_web_entry["Web app entry<br/>[main.tsx]"]
  node_web_routes["Page routing<br/>[AppRoutes.tsx]"]
  node_auth_context["Session context<br/>[AuthContext.tsx]"]
  node_auth_form["Sign-in form<br/>[AuthForm.tsx]"]
  node_auth_api["Auth API client<br/>[authApi.ts]"]
end

subgraph group_notes["Notes and voice"]
  node_note_page["Notes workspace<br/>[Note.tsx]"]
  node_note_hook["Note pagination"]
  node_note_api["Note API client<br/>[noteApi.ts]"]
  node_label_hook["Label management<br/>[useLabels.ts]"]
  node_voice_ui["Voice controls<br/>[VoiceControl.tsx]"]
  node_voice_api["Voice API client<br/>[voiceApi.ts]"]
  node_voice_route["Voice command route<br/>[voice.ts]"]
  node_transcription["Audio transcription<br/>[transcribe.ts]"]
  node_intent["Intent extraction<br/>[extractIntent.ts]"]
  node_target["Target resolution<br/>[resolveTarget.ts]"]
  node_action["Action execution<br/>[executeAction.ts]"]
  node_undo["Voice undo<br/>[voiceUndo.ts]"]
  node_undo_store[("Undo state<br/>[undoStore.ts]")]
end

subgraph group_identity["Identity and access"]
  node_auth_routes["Account routes<br/>[auth.ts]"]
  node_auth_schema["Auth validation<br/>[auth.ts]"]
  node_auth_middleware["JWT authentication<br/>[auth.middleware.ts]"]
  node_oauth_routes["OAuth server routes<br/>[oauth.ts]"]
  node_oauth_logic["OAuth token logic<br/>[oauth.ts]"]
  node_mcp_tokens["MCP token utilities<br/>[mcpTokens.ts]"]
end

subgraph group_backend["API and persistence"]
  node_api_app["API route mounting<br/>[app.ts]"]
  node_note_routes["Note and todo routes<br/>[note.ts]"]
  node_label_routes["Label routes<br/>[label.ts]"]
  node_db[("PostgreSQL database<br/>[prisma.ts]")]
end

subgraph group_connectors["AI connectors"]
  node_mcp_http["MCP HTTP server<br/>[http.ts]"]
  node_mcp_auth["MCP request auth<br/>[auth.ts]"]
  node_mcp_tools["MCP note tools<br/>[tools.ts]"]
  node_mcp_client["Internal API client<br/>[client.ts]"]
end

node_user(("NoteFlow user"))
node_ai_client(("MCP client"))

node_user -->|"uses"| node_web_entry
node_web_entry -->|"renders"| node_web_routes
node_web_routes -->|"guards pages"| node_auth_context
node_user -->|"signs in"| node_auth_form
node_auth_form -->|"submits credentials"| node_auth_api
node_auth_context -->|"restores session"| node_auth_api
node_auth_api -.->|"calls account API"| node_auth_routes
node_auth_routes -->|"validates input"| node_auth_schema
node_auth_routes -->|"reads and writes"| node_db
node_web_routes -->|"routes to"| node_note_page
node_user -->|"manages notes"| node_note_page
node_note_page -.->|"loads notes"| node_note_hook
node_note_hook -->|"requests pages"| node_note_api
node_note_api -.->|"calls note API"| node_note_routes
node_note_routes -->|"requires auth"| node_auth_middleware
node_note_routes -->|"reads and writes"| node_db
node_note_page -.->|"manages labels"| node_label_hook
node_label_hook -.->|"calls label API"| node_label_routes
node_user -->|"records command"| node_voice_ui
node_voice_ui -.->|"uploads audio"| node_voice_api
node_voice_api -->|"sends command"| node_voice_route
node_voice_route -->|"transcribes audio"| node_transcription
node_voice_route -->|"extracts intent"| node_intent
node_voice_route -->|"resolves target"| node_target
node_voice_route -->|"executes action"| node_action
node_user -->|"requests undo"| node_undo
node_undo -.->|"uses undo state"| node_undo_store
node_api_app -->|"mounts routes"| node_auth_routes
node_api_app -->|"mounts routes"| node_note_routes
node_api_app -->|"mounts routes"| node_label_routes
node_api_app -->|"mounts routes"| node_voice_route
node_api_app -->|"mounts routes"| node_undo
node_api_app -->|"mounts OAuth"| node_oauth_routes
node_oauth_routes -->|"issues tokens"| node_oauth_logic
node_oauth_logic -->|"uses token helpers"| node_mcp_tokens
node_oauth_logic -->|"stores OAuth grants"| node_db
node_api_app -->|"mounts MCP"| node_mcp_http
node_ai_client -->|"connects over HTTP"| node_mcp_http
node_mcp_http -->|"authenticates requests"| node_mcp_auth
node_mcp_http -->|"dispatches tools"| node_mcp_tools
node_mcp_http -->|"creates API client"| node_mcp_client
node_mcp_client -->|"calls internal API"| node_note_routes
node_mcp_auth -->|"checks credentials"| node_mcp_tokens

click node_web_entry "https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/main.tsx"
click node_web_routes "https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/routes/AppRoutes.tsx"
click node_auth_context "https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/context/AuthContext.tsx"
click node_auth_form "https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/components/LoginSignup/AuthForm.tsx"
click node_auth_api "https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/api/authApi.ts"
click node_note_page "https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/pages/Note.tsx"
click node_note_hook "https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/hooks/useInfiniteNotes.ts"
click node_note_api "https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/api/noteApi.ts"
click node_label_hook "https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/hooks/useLabels.ts"
click node_voice_ui "https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/components/NotePage/VoiceControl.tsx"
click node_voice_api "https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/api/voiceApi.ts"
click node_voice_route "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/routes/voice.ts"
click node_transcription "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/lib/transcribe.ts"
click node_intent "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/lib/extractIntent.ts"
click node_target "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/lib/resolveTarget.ts"
click node_action "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/lib/executeAction.ts"
click node_undo "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/routes/voiceUndo.ts"
click node_undo_store "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/lib/undoStore.ts"
click node_auth_routes "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/routes/auth.ts"
click node_auth_schema "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/schemas/auth.ts"
click node_auth_middleware "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/middlewares/auth.middleware.ts"
click node_oauth_routes "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/routes/oauth.ts"
click node_oauth_logic "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/lib/oauth.ts"
click node_mcp_tokens "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/lib/mcpTokens.ts"
click node_api_app "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/app.ts"
click node_note_routes "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/routes/note.ts"
click node_label_routes "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/routes/label.ts"
click node_db "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/lib/prisma.ts"
click node_mcp_http "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/mcp/http.ts"
click node_mcp_auth "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/mcp/auth.ts"
click node_mcp_tools "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/mcp/tools.ts"
click node_mcp_client "https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/mcp/client.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_web_entry,node_web_routes,node_auth_context,node_auth_form,node_auth_api,node_user,node_ai_client toneBlue
class node_note_page,node_note_hook,node_note_api,node_label_hook,node_voice_ui,node_voice_api,node_voice_route,node_transcription,node_intent,node_target,node_action,node_undo,node_undo_store toneAmber
class node_auth_routes,node_auth_schema,node_auth_middleware,node_oauth_routes,node_oauth_logic,node_mcp_tokens toneMint
class node_api_app,node_note_routes,node_label_routes,node_db toneRose
class node_mcp_http,node_mcp_auth,node_mcp_tools,node_mcp_client toneIndigo
```

## Components

### Web application

- [Web app entry](https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/main.tsx): `frontend/src/main.tsx`
- [Page routing](https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/routes/AppRoutes.tsx): `frontend/src/routes/AppRoutes.tsx`
- [Session context](https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [Sign-in form](https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/components/LoginSignup/AuthForm.tsx): `frontend/src/components/LoginSignup/AuthForm.tsx`
- [Auth API client](https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/api/authApi.ts): `frontend/src/api/authApi.ts`

### Notes and voice

- [Notes workspace](https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/pages/Note.tsx): `frontend/src/pages/Note.tsx`
- [Note pagination](https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/hooks/useInfiniteNotes.ts): `frontend/src/hooks/useInfiniteNotes.ts`
- [Note API client](https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/api/noteApi.ts): `frontend/src/api/noteApi.ts`
- [Label management](https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/hooks/useLabels.ts): `frontend/src/hooks/useLabels.ts`
- [Voice controls](https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/components/NotePage/VoiceControl.tsx): `frontend/src/components/NotePage/VoiceControl.tsx`
- [Voice API client](https://github.com/garvthanvi/voice-note-taking/blob/main/frontend/src/api/voiceApi.ts): `frontend/src/api/voiceApi.ts`
- [Voice command route](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/routes/voice.ts): `backend/src/routes/voice.ts`
- [Audio transcription](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/lib/transcribe.ts): `backend/src/lib/transcribe.ts`
- [Intent extraction](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/lib/extractIntent.ts): `backend/src/lib/extractIntent.ts`
- [Target resolution](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/lib/resolveTarget.ts): `backend/src/lib/resolveTarget.ts`
- [Action execution](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/lib/executeAction.ts): `backend/src/lib/executeAction.ts`
- [Voice undo](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/routes/voiceUndo.ts): `backend/src/routes/voiceUndo.ts`
- [Undo state](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/lib/undoStore.ts): `backend/src/lib/undoStore.ts`

### Identity and access

- [Account routes](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/routes/auth.ts): `backend/src/routes/auth.ts`
- [Auth validation](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/schemas/auth.ts): `backend/src/schemas/auth.ts`
- [JWT authentication](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/middlewares/auth.middleware.ts): `backend/src/middlewares/auth.middleware.ts`
- [OAuth server routes](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/routes/oauth.ts): `backend/src/routes/oauth.ts`
- [OAuth token logic](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/lib/oauth.ts): `backend/src/lib/oauth.ts`
- [MCP token utilities](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/lib/mcpTokens.ts): `backend/src/lib/mcpTokens.ts`

### API and persistence

- [API route mounting](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Note and todo routes](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/routes/note.ts): `backend/src/routes/note.ts`
- [Label routes](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/routes/label.ts): `backend/src/routes/label.ts`
- [PostgreSQL database](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/lib/prisma.ts): `backend/src/lib/prisma.ts`

### AI connectors

- [MCP HTTP server](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/mcp/http.ts): `backend/src/mcp/http.ts`
- [MCP request auth](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/mcp/auth.ts): `backend/src/mcp/auth.ts`
- [MCP note tools](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/mcp/tools.ts): `backend/src/mcp/tools.ts`
- [Internal API client](https://github.com/garvthanvi/voice-note-taking/blob/main/backend/src/mcp/client.ts): `backend/src/mcp/client.ts`

### Other components

- **NoteFlow user**
- **MCP client**

## Connections

- NoteFlow user → Web app entry: uses (evidence: `frontend/src/main.tsx`)
- Web app entry → Page routing: renders (evidence: `frontend/src/main.tsx`)
- Page routing → Session context: guards pages
- NoteFlow user → Sign-in form: signs in
- Sign-in form → Auth API client: submits credentials (evidence: `frontend/src/components/LoginSignup/AuthForm.tsx`)
- Session context → Auth API client: restores session (evidence: `frontend/src/context/AuthContext.tsx`)
- Auth API client → Account routes: calls account API
- Account routes → Auth validation: validates input (evidence: `backend/src/routes/auth.ts`)
- Account routes → PostgreSQL database: reads and writes (evidence: `backend/src/routes/auth.ts`)
- Page routing → Notes workspace: routes to (evidence: `frontend/src/routes/AppRoutes.tsx`)
- NoteFlow user → Notes workspace: manages notes
- Notes workspace → Note pagination: loads notes
- Note pagination → Note API client: requests pages (evidence: `frontend/src/hooks/useInfiniteNotes.ts`)
- Note API client → Note and todo routes: calls note API
- Note and todo routes → JWT authentication: requires auth (evidence: `backend/src/routes/note.ts`)
- Note and todo routes → PostgreSQL database: reads and writes (evidence: `backend/src/routes/note.ts`)
- Notes workspace → Label management: manages labels
- Label management → Label routes: calls label API
- NoteFlow user → Voice controls: records command
- Voice controls → Voice API client: uploads audio
- Voice API client → Voice command route: sends command
- Voice command route → Audio transcription: transcribes audio
- Voice command route → Intent extraction: extracts intent
- Voice command route → Target resolution: resolves target
- Voice command route → Action execution: executes action
- NoteFlow user → Voice undo: requests undo
- Voice undo → Undo state: uses undo state
- API route mounting → Account routes: mounts routes (evidence: `backend/src/app.ts`)
- API route mounting → Note and todo routes: mounts routes (evidence: `backend/src/app.ts`)
- API route mounting → Label routes: mounts routes (evidence: `backend/src/app.ts`)
- API route mounting → Voice command route: mounts routes (evidence: `backend/src/app.ts`)
- API route mounting → Voice undo: mounts routes (evidence: `backend/src/app.ts`)
- API route mounting → OAuth server routes: mounts OAuth (evidence: `backend/src/app.ts`)
- OAuth server routes → OAuth token logic: issues tokens (evidence: `backend/src/routes/oauth.ts`)
- OAuth token logic → MCP token utilities: uses token helpers (evidence: `backend/src/lib/oauth.ts`)
- OAuth token logic → PostgreSQL database: stores OAuth grants (evidence: `backend/src/lib/oauth.ts`)
- API route mounting → MCP HTTP server: mounts MCP (evidence: `backend/src/app.ts`)
- MCP client → MCP HTTP server: connects over HTTP
- MCP HTTP server → MCP request auth: authenticates requests (evidence: `backend/src/mcp/http.ts`)
- MCP HTTP server → MCP note tools: dispatches tools (evidence: `backend/src/mcp/http.ts`)
- MCP HTTP server → Internal API client: creates API client (evidence: `backend/src/mcp/http.ts`)
- Internal API client → Note and todo routes: calls internal API (evidence: `backend/src/mcp/client.ts`)
- MCP request auth → MCP token utilities: checks credentials (evidence: `backend/src/mcp/auth.ts`)
