# vrunda2005/note-app architecture

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

- Interactive diagram: https://gitdiagram.com/vrunda2005/note-app
- Repository: https://github.com/vrunda2005/note-app

## Overview

TakeNote is a full-stack note-taking app whose main workflow is to authenticate, create and organize notes, edit or sketch content, then save changes to the server. Notes can also be encrypted in the browser, shared, exported, or processed by AI tools. The graph includes documented product capabilities whose implementation was not sampled, using their existing enclosing paths; their precise wiring is therefore not asserted. The sampled code confirms the notes and AI request paths, authentication checks, persistence calls, and Gemini fallback behavior.

Main entry points: [`src/hooks/useNotes.ts`](https://github.com/vrunda2005/note-app/blob/main/src/hooks/useNotes.ts) (Notes state and sync), [`src/lib/db.ts`](https://github.com/vrunda2005/note-app/blob/main/src/lib/db.ts) (Data access), [`src/app/page.tsx`](https://github.com/vrunda2005/note-app/blob/main/src/app/page.tsx) (Workspace page), [`src/components/NoteEditor.tsx`](https://github.com/vrunda2005/note-app/blob/main/src/components/NoteEditor.tsx) (Note editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Note workspace"]
  node_home["Workspace page<br/>[page.tsx]"]
  node_editor["Note editor<br/>[NoteEditor.tsx]"]
  node_richtext["Rich text editing<br/>[RichTextEditor.tsx]"]
  node_canvas["Sketch canvas<br/>[DrawCanvas.tsx]"]
  node_sidebar["Note manager<br/>[NotesSidebar.tsx]"]
  node_ai_panel["AI tools and analytics<br/>[AIToolsPanel.tsx]"]
end

subgraph group_identity["Account access"]
  node_auth_ui["Login and signup<br/>[page.tsx]"]
  node_auth_context["Auth state<br/>[AuthContext.tsx]"]
end

subgraph group_server["Application services"]
  node_signup["Signup endpoint<br/>[route.ts]"]
  node_login["Login endpoint<br/>[route.ts]"]
  node_session["Session endpoint<br/>[route.ts]"]
  node_notes_api["Notes endpoints<br/>[route.ts]"]
  node_note_item_api["Note update and delete<br/>[route.ts]"]
  node_sharing_api["Note sharing<br/>[route.ts]"]
  node_data[("Data access<br/>[db.ts]")]
end

subgraph group_intelligence["AI assistance"]
  node_ai_features["AI feature handlers<br/>[useAIFeatures.ts]"]
  node_ai_hook["AI request client<br/>[useAI.ts]"]
  node_ai_api["AI endpoint<br/>[route.ts]"]
  node_gemini_sdk["Gemini SDK loader<br/>[getGeminiSdk.ts]"]
end

subgraph group_state["Local and server state"]
  node_notes_hook["Notes state and sync<br/>[useNotes.ts]"]
  node_browser_store[("IndexedDB notes<br/>[storage.ts]")]
  node_encryption["Client encryption<br/>[encryption.ts]"]
end

node_user(("Note taker"))
node_gemini{{"Google Gemini"}}

node_user -->|"signs in"| node_auth_ui
node_auth_ui -->|"submits signup"| node_signup
node_auth_ui -->|"submits login"| node_login
node_auth_context -->|"checks session"| node_session
node_signup -->|"creates user"| node_data
node_login -->|"finds user"| node_data
node_session -->|"loads user"| node_data
node_user -->|"uses workspace"| node_home
node_home -->|"opens editing"| node_editor
node_home -->|"manages notes"| node_sidebar
node_editor -->|"edits text"| node_richtext
node_editor -->|"sketches"| node_canvas
node_home -->|"manages note state"| node_notes_hook
node_notes_hook -->|"fetches and creates"| node_notes_api
node_notes_hook -->|"updates and deletes"| node_note_item_api
node_notes_hook -->|"shares note"| node_sharing_api
node_notes_api -->|"reads and creates"| node_data
node_note_item_api -->|"reads and writes"| node_data
node_sharing_api -->|"reads and updates"| node_data
node_notes_hook -->|"migrates local notes"| node_browser_store
node_notes_hook -->|"encrypts and decrypts"| node_encryption
node_editor -->|"requests AI tasks"| node_ai_features
node_ai_panel -->|"starts analysis"| node_ai_features
node_ai_features -->|"calls task methods"| node_ai_hook
node_ai_hook -->|"posts text"| node_ai_api
node_ai_api -->|"loads SDK"| node_gemini_sdk
node_ai_api -.->|"generates content"| node_gemini
node_gemini_sdk -.->|"SDK client calls"| node_gemini

click node_home "https://github.com/vrunda2005/note-app/blob/main/src/app/page.tsx"
click node_editor "https://github.com/vrunda2005/note-app/blob/main/src/components/NoteEditor.tsx"
click node_richtext "https://github.com/vrunda2005/note-app/blob/main/src/components/RichTextEditor.tsx"
click node_canvas "https://github.com/vrunda2005/note-app/blob/main/src/components/DrawCanvas.tsx"
click node_sidebar "https://github.com/vrunda2005/note-app/blob/main/src/components/NotesSidebar.tsx"
click node_ai_panel "https://github.com/vrunda2005/note-app/blob/main/src/components/AIToolsPanel.tsx"
click node_auth_ui "https://github.com/vrunda2005/note-app/blob/main/src/app/login/page.tsx"
click node_auth_context "https://github.com/vrunda2005/note-app/blob/main/src/context/AuthContext.tsx"
click node_signup "https://github.com/vrunda2005/note-app/blob/main/src/app/api/auth/signup/route.ts"
click node_login "https://github.com/vrunda2005/note-app/blob/main/src/app/api/auth/login/route.ts"
click node_session "https://github.com/vrunda2005/note-app/blob/main/src/app/api/auth/me/route.ts"
click node_notes_api "https://github.com/vrunda2005/note-app/blob/main/src/app/api/notes/route.ts"
click node_note_item_api "https://github.com/vrunda2005/note-app/blob/main/src/app/api/notes/%5Bid%5D/route.ts"
click node_sharing_api "https://github.com/vrunda2005/note-app/blob/main/src/app/api/notes/%5Bid%5D/share/route.ts"
click node_data "https://github.com/vrunda2005/note-app/blob/main/src/lib/db.ts"
click node_notes_hook "https://github.com/vrunda2005/note-app/blob/main/src/hooks/useNotes.ts"
click node_browser_store "https://github.com/vrunda2005/note-app/blob/main/src/utils/storage.ts"
click node_encryption "https://github.com/vrunda2005/note-app/blob/main/src/utils/encryption.ts"
click node_ai_features "https://github.com/vrunda2005/note-app/blob/main/src/hooks/useAIFeatures.ts"
click node_ai_hook "https://github.com/vrunda2005/note-app/blob/main/src/hooks/useAI.ts"
click node_ai_api "https://github.com/vrunda2005/note-app/blob/main/src/app/api/ai/route.ts"
click node_gemini_sdk "https://github.com/vrunda2005/note-app/blob/main/src/lib/getGeminiSdk.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_home,node_editor,node_richtext,node_canvas,node_sidebar,node_ai_panel toneBlue
class node_auth_ui,node_auth_context toneAmber
class node_signup,node_login,node_session,node_notes_api,node_note_item_api,node_sharing_api,node_data toneMint
class node_ai_features,node_ai_hook,node_ai_api,node_gemini_sdk toneRose
class node_notes_hook,node_browser_store,node_encryption,node_user,node_gemini toneIndigo
```

## Components

### Note workspace

- [Workspace page](https://github.com/vrunda2005/note-app/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Note editor](https://github.com/vrunda2005/note-app/blob/main/src/components/NoteEditor.tsx): `src/components/NoteEditor.tsx`
- [Rich text editing](https://github.com/vrunda2005/note-app/blob/main/src/components/RichTextEditor.tsx): `src/components/RichTextEditor.tsx`
- [Sketch canvas](https://github.com/vrunda2005/note-app/blob/main/src/components/DrawCanvas.tsx): `src/components/DrawCanvas.tsx`
- [Note manager](https://github.com/vrunda2005/note-app/blob/main/src/components/NotesSidebar.tsx): `src/components/NotesSidebar.tsx`
- [AI tools and analytics](https://github.com/vrunda2005/note-app/blob/main/src/components/AIToolsPanel.tsx): `src/components/AIToolsPanel.tsx`

### Account access

- [Login and signup](https://github.com/vrunda2005/note-app/blob/main/src/app/login/page.tsx): `src/app/login/page.tsx`
- [Auth state](https://github.com/vrunda2005/note-app/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`

### Application services

- [Signup endpoint](https://github.com/vrunda2005/note-app/blob/main/src/app/api/auth/signup/route.ts): `src/app/api/auth/signup/route.ts`
- [Login endpoint](https://github.com/vrunda2005/note-app/blob/main/src/app/api/auth/login/route.ts): `src/app/api/auth/login/route.ts`
- [Session endpoint](https://github.com/vrunda2005/note-app/blob/main/src/app/api/auth/me/route.ts): `src/app/api/auth/me/route.ts`
- [Notes endpoints](https://github.com/vrunda2005/note-app/blob/main/src/app/api/notes/route.ts): `src/app/api/notes/route.ts`
- [Note update and delete](https://github.com/vrunda2005/note-app/blob/main/src/app/api/notes/%5Bid%5D/route.ts): `src/app/api/notes/[id]/route.ts`
- [Note sharing](https://github.com/vrunda2005/note-app/blob/main/src/app/api/notes/%5Bid%5D/share/route.ts): `src/app/api/notes/[id]/share/route.ts`
- [Data access](https://github.com/vrunda2005/note-app/blob/main/src/lib/db.ts): `src/lib/db.ts`

### AI assistance

- [AI feature handlers](https://github.com/vrunda2005/note-app/blob/main/src/hooks/useAIFeatures.ts): `src/hooks/useAIFeatures.ts`
- [AI request client](https://github.com/vrunda2005/note-app/blob/main/src/hooks/useAI.ts): `src/hooks/useAI.ts`
- [AI endpoint](https://github.com/vrunda2005/note-app/blob/main/src/app/api/ai/route.ts): `src/app/api/ai/route.ts`
- [Gemini SDK loader](https://github.com/vrunda2005/note-app/blob/main/src/lib/getGeminiSdk.ts): `src/lib/getGeminiSdk.ts`

### Local and server state

- [Notes state and sync](https://github.com/vrunda2005/note-app/blob/main/src/hooks/useNotes.ts): `src/hooks/useNotes.ts`
- [IndexedDB notes](https://github.com/vrunda2005/note-app/blob/main/src/utils/storage.ts): `src/utils/storage.ts`
- [Client encryption](https://github.com/vrunda2005/note-app/blob/main/src/utils/encryption.ts): `src/utils/encryption.ts`

### Other components

- **Note taker**
- **Google Gemini**

## Connections

- Note taker → Login and signup: signs in
- Login and signup → Signup endpoint: submits signup
- Login and signup → Login endpoint: submits login
- Auth state → Session endpoint: checks session
- Signup endpoint → Data access: creates user
- Login endpoint → Data access: finds user
- Session endpoint → Data access: loads user
- Note taker → Workspace page: uses workspace
- Workspace page → Note editor: opens editing
- Workspace page → Note manager: manages notes
- Note editor → Rich text editing: edits text
- Note editor → Sketch canvas: sketches
- Workspace page → Notes state and sync: manages note state
- Notes state and sync → Notes endpoints: fetches and creates
- Notes state and sync → Note update and delete: updates and deletes
- Notes state and sync → Note sharing: shares note
- Notes endpoints → Data access: reads and creates
- Note update and delete → Data access: reads and writes
- Note sharing → Data access: reads and updates
- Notes state and sync → IndexedDB notes: migrates local notes
- Notes state and sync → Client encryption: encrypts and decrypts
- Note editor → AI feature handlers: requests AI tasks
- AI tools and analytics → AI feature handlers: starts analysis
- AI feature handlers → AI request client: calls task methods
- AI request client → AI endpoint: posts text
- AI endpoint → Gemini SDK loader: loads SDK
- AI endpoint → Google Gemini: generates content
- Gemini SDK loader → Google Gemini: SDK client calls
