# ruchinmunjal/anchor architecture

> Architecture diagram of the GitHub repository ruchinmunjal/anchor, 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/ruchinmunjal/anchor
- Repository: https://github.com/ruchinmunjal/anchor

## Overview

Anchor is an offline-first, self-hosted note-taking application with web and mobile clients and a NestJS API. A typical user edits and organizes notes, then synchronizes changes across devices when online; the server also supports authentication, sharing, history, attachments, import/export, and administration. The tree identifies the main web and server subsystems, but most implementation excerpts are unavailable, so edges beyond the sampled controller calls and README-documented behavior are omitted. The mobile tree shows platform wrappers and an Android home-screen widget, not the main app implementation.

Main entry points: [`web/app/(app)/notes/page.tsx`](https://github.com/ruchinmunjal/anchor/blob/main/web/app/(app)/notes/page.tsx) (Notes workspace), [`web/features/notes/components/editor/rich-text-editor.tsx`](https://github.com/ruchinmunjal/anchor/blob/main/web/features/notes/components/editor/rich-text-editor.tsx) (Rich text editor), [`web/app/(auth)/login/page.tsx`](https://github.com/ruchinmunjal/anchor/blob/main/web/app/(auth)/login/page.tsx) (Sign-in screens), [`web/features/sync/use-sync.ts`](https://github.com/ruchinmunjal/anchor/blob/main/web/features/sync/use-sync.ts) (Offline edits and sync)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web Client"]
  node_web_notes["Notes workspace<br/>[page.tsx]"]
  node_editor["Rich text editor"]
  node_auth_ui["Sign-in screens<br/>[page.tsx]"]
  node_android_widget["Android notes widget"]
end

subgraph group_notes["Notes and Sync"]
  node_local_sync["Offline edits and sync<br/>[use-sync.ts]"]
  node_note_api["Notes API"]
  node_note_service["Note management<br/>[notes.service.ts]"]
  node_sync_api["Sync API<br/>[sync.controller.ts]"]
  node_sync_services["Sync processing"]
  node_note_history["Note history"]
  node_note_sharing["Note sharing"]
  node_attachments["Attachments"]
  node_tags["Tags<br/>[tags.controller.ts]"]
end

subgraph group_identity["Identity and Admin"]
  node_auth_api["Authentication API<br/>[auth.controller.ts]"]
  node_auth_service["Authentication<br/>[auth.service.ts]"]
  node_oidc["OIDC login<br/>[oidc.controller.ts]"]
  node_admin["Administration"]
end

subgraph group_services["Supporting Services"]
  node_import_export["Import and export"]
  node_settings["Settings"]
  node_database[("Application data<br/>[prisma.service.ts]")]
end

node_user(("Note taker"))

node_user -->|"uses"| node_web_notes
node_web_notes -->|"edits notes"| node_editor
node_editor -->|"saves offline"| node_local_sync
node_local_sync -->|"syncs online"| node_sync_api
node_sync_api -->|"dispatches"| node_sync_services
node_user -->|"manages notes"| node_note_api
node_note_api -->|"calls"| node_note_service
node_user -->|"organizes notes"| node_tags
node_user -->|"reviews versions"| node_note_history
node_user -->|"shares notes"| node_note_sharing
node_user -->|"adds files"| node_attachments
node_user -->|"signs in"| node_auth_ui
node_auth_ui -.->|"authenticates"| node_auth_api
node_auth_api -.->|"calls"| node_auth_service
node_user -->|"uses OIDC"| node_oidc
node_user -->|"administers users"| node_admin
node_user -->|"imports or exports"| node_import_export
node_android_widget -->|"surfaces notes"| node_user

click node_web_notes "https://github.com/ruchinmunjal/anchor/blob/main/web/app/(app)/notes/page.tsx"
click node_editor "https://github.com/ruchinmunjal/anchor/blob/main/web/features/notes/components/editor/rich-text-editor.tsx"
click node_local_sync "https://github.com/ruchinmunjal/anchor/blob/main/web/features/sync/use-sync.ts"
click node_note_api "https://github.com/ruchinmunjal/anchor/blob/main/server/src/notes/controllers/notes.controller.ts"
click node_note_service "https://github.com/ruchinmunjal/anchor/blob/main/server/src/notes/services/notes.service.ts"
click node_sync_api "https://github.com/ruchinmunjal/anchor/blob/main/server/src/sync/sync.controller.ts"
click node_sync_services "https://github.com/ruchinmunjal/anchor/tree/main/server/src/sync"
click node_note_history "https://github.com/ruchinmunjal/anchor/blob/main/server/src/notes/services/note-history.service.ts"
click node_note_sharing "https://github.com/ruchinmunjal/anchor/blob/main/server/src/notes/services/note-shares.service.ts"
click node_attachments "https://github.com/ruchinmunjal/anchor/blob/main/server/src/notes/services/note-attachments.service.ts"
click node_tags "https://github.com/ruchinmunjal/anchor/blob/main/server/src/tags/tags.controller.ts"
click node_auth_ui "https://github.com/ruchinmunjal/anchor/blob/main/web/app/(auth)/login/page.tsx"
click node_auth_api "https://github.com/ruchinmunjal/anchor/blob/main/server/src/auth/auth.controller.ts"
click node_auth_service "https://github.com/ruchinmunjal/anchor/blob/main/server/src/auth/auth.service.ts"
click node_oidc "https://github.com/ruchinmunjal/anchor/blob/main/server/src/auth/oidc/oidc.controller.ts"
click node_admin "https://github.com/ruchinmunjal/anchor/blob/main/server/src/admin/admin.controller.ts"
click node_import_export "https://github.com/ruchinmunjal/anchor/tree/main/server/src/import-export"
click node_settings "https://github.com/ruchinmunjal/anchor/blob/main/server/src/settings/settings.service.ts"
click node_database "https://github.com/ruchinmunjal/anchor/blob/main/server/src/prisma/prisma.service.ts"
click node_android_widget "https://github.com/ruchinmunjal/anchor/blob/main/mobile/android/app/src/main/kotlin/com/zhfahim/anchor/widget/NotesWidgetService.kt"

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_notes,node_editor,node_auth_ui,node_android_widget toneBlue
class node_local_sync,node_note_api,node_note_service,node_sync_api,node_sync_services,node_note_history,node_note_sharing,node_attachments,node_tags toneAmber
class node_auth_api,node_auth_service,node_oidc,node_admin toneMint
class node_import_export,node_settings,node_database toneRose
class node_user toneIndigo
```

## Components

### Web Client

- [Notes workspace](https://github.com/ruchinmunjal/anchor/blob/main/web/app/(app)/notes/page.tsx): `web/app/(app)/notes/page.tsx`
- [Rich text editor](https://github.com/ruchinmunjal/anchor/blob/main/web/features/notes/components/editor/rich-text-editor.tsx): `web/features/notes/components/editor/rich-text-editor.tsx`
- [Sign-in screens](https://github.com/ruchinmunjal/anchor/blob/main/web/app/(auth)/login/page.tsx): `web/app/(auth)/login/page.tsx`
- [Android notes widget](https://github.com/ruchinmunjal/anchor/blob/main/mobile/android/app/src/main/kotlin/com/zhfahim/anchor/widget/NotesWidgetService.kt): `mobile/android/app/src/main/kotlin/com/zhfahim/anchor/widget/NotesWidgetService.kt`

### Notes and Sync

- [Offline edits and sync](https://github.com/ruchinmunjal/anchor/blob/main/web/features/sync/use-sync.ts): `web/features/sync/use-sync.ts`
- [Notes API](https://github.com/ruchinmunjal/anchor/blob/main/server/src/notes/controllers/notes.controller.ts): `server/src/notes/controllers/notes.controller.ts`
- [Note management](https://github.com/ruchinmunjal/anchor/blob/main/server/src/notes/services/notes.service.ts): `server/src/notes/services/notes.service.ts`
- [Sync API](https://github.com/ruchinmunjal/anchor/blob/main/server/src/sync/sync.controller.ts): `server/src/sync/sync.controller.ts`
- [Sync processing](https://github.com/ruchinmunjal/anchor/tree/main/server/src/sync): `server/src/sync`
- [Note history](https://github.com/ruchinmunjal/anchor/blob/main/server/src/notes/services/note-history.service.ts): `server/src/notes/services/note-history.service.ts`
- [Note sharing](https://github.com/ruchinmunjal/anchor/blob/main/server/src/notes/services/note-shares.service.ts): `server/src/notes/services/note-shares.service.ts`
- [Attachments](https://github.com/ruchinmunjal/anchor/blob/main/server/src/notes/services/note-attachments.service.ts): `server/src/notes/services/note-attachments.service.ts`
- [Tags](https://github.com/ruchinmunjal/anchor/blob/main/server/src/tags/tags.controller.ts): `server/src/tags/tags.controller.ts`

### Identity and Admin

- [Authentication API](https://github.com/ruchinmunjal/anchor/blob/main/server/src/auth/auth.controller.ts): `server/src/auth/auth.controller.ts`
- [Authentication](https://github.com/ruchinmunjal/anchor/blob/main/server/src/auth/auth.service.ts): `server/src/auth/auth.service.ts`
- [OIDC login](https://github.com/ruchinmunjal/anchor/blob/main/server/src/auth/oidc/oidc.controller.ts): `server/src/auth/oidc/oidc.controller.ts`
- [Administration](https://github.com/ruchinmunjal/anchor/blob/main/server/src/admin/admin.controller.ts): `server/src/admin/admin.controller.ts`

### Supporting Services

- [Import and export](https://github.com/ruchinmunjal/anchor/tree/main/server/src/import-export): `server/src/import-export`
- [Settings](https://github.com/ruchinmunjal/anchor/blob/main/server/src/settings/settings.service.ts): `server/src/settings/settings.service.ts`
- [Application data](https://github.com/ruchinmunjal/anchor/blob/main/server/src/prisma/prisma.service.ts): `server/src/prisma/prisma.service.ts`

### Other components

- **Note taker**

## Connections

- Note taker → Notes workspace: uses
- Notes workspace → Rich text editor: edits notes
- Rich text editor → Offline edits and sync: saves offline
- Offline edits and sync → Sync API: syncs online
- Sync API → Sync processing: dispatches (evidence: `server/src/sync/sync.controller.ts`)
- Note taker → Notes API: manages notes (evidence: `server/src/notes/controllers/notes.controller.ts`)
- Notes API → Note management: calls (evidence: `server/src/notes/controllers/notes.controller.ts`)
- Note taker → Tags: organizes notes
- Note taker → Note history: reviews versions
- Note taker → Note sharing: shares notes
- Note taker → Attachments: adds files
- Note taker → Sign-in screens: signs in
- Sign-in screens → Authentication API: authenticates
- Authentication API → Authentication: calls
- Note taker → OIDC login: uses OIDC (evidence: `server/src/auth/oidc/oidc.controller.ts`)
- Note taker → Administration: administers users (evidence: `server/src/admin/admin.controller.ts`)
- Note taker → Import and export: imports or exports
- Android notes widget → Note taker: surfaces notes (evidence: `mobile/android/app/src/main/kotlin/com/zhfahim/anchor/widget/NotesWidgetService.kt`)
