# rabithua/rote architecture

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

- Interactive diagram: https://gitdiagram.com/rabithua/rote
- Repository: https://github.com/rabithua/rote

## Overview

Rote is a self-hostable note-taking and social publishing application with a separate web frontend and backend. The main workflow is recording or importing notes, attaching media, storing and synchronizing content, then browsing or sharing it; optional AI adds indexing, retrieval, and chat over notes and articles. The graph also preserves documented articles, open APIs, administration, and integrations. Some feature directories were not sampled, so their internal call paths are omitted rather than inferred.

Main entry points: [`server/utils/drizzle.ts`](https://github.com/rabithua/rote/blob/main/server/utils/drizzle.ts) (Database client), [`web/src`](https://github.com/rabithua/rote/tree/main/web/src) (Web application), [`server/imports/importService.ts`](https://github.com/rabithua/rote/blob/main/server/imports/importService.ts) (Import service), [`server/noteShares/routes.ts`](https://github.com/rabithua/rote/blob/main/server/noteShares/routes.ts) (Note sharing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_web["Web application"]
  node_notes["Notes and feed"]
  node_articles["Articles"]
  node_import_ui["Import tools"]
  node_ai_ui["AI conversations"]
end

subgraph group_api["Backend API"]
  node_server["HTTP server<br/>[server.ts]"]
  node_routes["REST routes"]
  node_auth["Authentication<br/>[jwtAuth.ts]"]
  node_mcp["MCP interface"]
end

subgraph group_content["Content services"]
  node_attachments["Media uploads"]
  node_imports["Import service<br/>[importService.ts]"]
  node_sync["Change sync<br/>[routes.ts]"]
  node_sharing["Note sharing<br/>[routes.ts]"]
end

subgraph group_memory["AI Memory"]
  node_embedding_jobs["Embedding worker<br/>[embeddingWorker.ts]"]
  node_embedding_query["Semantic retrieval<br/>[query.ts]"]
  node_ai_runtime["AI runtime"]
end

subgraph group_platform["Platform services"]
  node_db[("PostgreSQL data<br/>[schema.ts]")]
  node_db_client["Database client<br/>[drizzle.ts]"]
  node_resources["Resource storage<br/>[service.ts]"]
  node_admin["Admin controls"]
  node_billing["Billing<br/>[publicRoutes.ts]"]
end

node_user(("User"))

node_user -->|"records and browses"| node_web
node_web -->|"uses backend API"| node_server
node_server -->|"mounts routes"| node_routes
node_routes -->|"authenticates requests"| node_auth
node_db_client -->|"queries and persists"| node_db
node_imports -->|"persists imported data"| node_db_client
node_imports -->|"uses resource service"| node_resources
node_imports -->|"journals changes"| node_sync
node_sync -->|"reads sync state"| node_db_client
node_sharing -->|"requires authentication"| node_auth
node_sharing -.->|"uses shared-note repository"| node_db_client
node_embedding_jobs -.->|"processes indexing jobs"| node_db_client
node_embedding_query -->|"checks index state"| node_db_client
node_embedding_query -.->|"provides retrieval"| node_ai_runtime
node_admin -->|"configures optional AI"| node_ai_runtime
node_web -.->|"uploads media"| node_attachments
node_web -.->|"starts imports"| node_imports
node_web -.->|"manages shared notes"| node_sharing
node_mcp -.->|"exposes open interface"| node_routes
node_billing -->|"reads billing grants"| node_db
node_resources -->|"stores resource state"| node_db

click node_web "https://github.com/rabithua/rote/tree/main/web/src"
click node_notes "https://github.com/rabithua/rote/tree/main/web/src/pages/rote"
click node_articles "https://github.com/rabithua/rote/tree/main/web/src/pages/article"
click node_import_ui "https://github.com/rabithua/rote/tree/main/web/src/features/import"
click node_ai_ui "https://github.com/rabithua/rote/tree/main/web/src/features/ai-conversations"
click node_server "https://github.com/rabithua/rote/blob/main/server/server.ts"
click node_routes "https://github.com/rabithua/rote/tree/main/server/route/v2"
click node_auth "https://github.com/rabithua/rote/blob/main/server/middleware/jwtAuth.ts"
click node_db "https://github.com/rabithua/rote/blob/main/server/drizzle/schema.ts"
click node_db_client "https://github.com/rabithua/rote/blob/main/server/utils/drizzle.ts"
click node_attachments "https://github.com/rabithua/rote/tree/main/server/attachments"
click node_imports "https://github.com/rabithua/rote/blob/main/server/imports/importService.ts"
click node_sync "https://github.com/rabithua/rote/blob/main/server/sync/routes.ts"
click node_sharing "https://github.com/rabithua/rote/blob/main/server/noteShares/routes.ts"
click node_resources "https://github.com/rabithua/rote/blob/main/server/resources/service.ts"
click node_embedding_jobs "https://github.com/rabithua/rote/blob/main/server/utils/dbMethods/ai/embeddingWorker.ts"
click node_embedding_query "https://github.com/rabithua/rote/blob/main/server/embeddings/query.ts"
click node_ai_runtime "https://github.com/rabithua/rote/tree/main/server/utils/ai"
click node_admin "https://github.com/rabithua/rote/tree/main/web/src/pages/admin"
click node_mcp "https://github.com/rabithua/rote/tree/main/server/mcp"
click node_billing "https://github.com/rabithua/rote/blob/main/server/billing/publicRoutes.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,node_notes,node_articles,node_import_ui,node_ai_ui,node_user toneBlue
class node_server,node_routes,node_auth,node_mcp toneAmber
class node_attachments,node_imports,node_sync,node_sharing toneMint
class node_embedding_jobs,node_embedding_query,node_ai_runtime toneRose
class node_db,node_db_client,node_resources,node_admin,node_billing toneIndigo
```

## Components

### Web client

- [Web application](https://github.com/rabithua/rote/tree/main/web/src): `web/src`
- [Notes and feed](https://github.com/rabithua/rote/tree/main/web/src/pages/rote): `web/src/pages/rote`
- [Articles](https://github.com/rabithua/rote/tree/main/web/src/pages/article): `web/src/pages/article`
- [Import tools](https://github.com/rabithua/rote/tree/main/web/src/features/import): `web/src/features/import`
- [AI conversations](https://github.com/rabithua/rote/tree/main/web/src/features/ai-conversations): `web/src/features/ai-conversations`

### Backend API

- [HTTP server](https://github.com/rabithua/rote/blob/main/server/server.ts): `server/server.ts`
- [REST routes](https://github.com/rabithua/rote/tree/main/server/route/v2): `server/route/v2`
- [Authentication](https://github.com/rabithua/rote/blob/main/server/middleware/jwtAuth.ts): `server/middleware/jwtAuth.ts`
- [MCP interface](https://github.com/rabithua/rote/tree/main/server/mcp): `server/mcp`

### Content services

- [Media uploads](https://github.com/rabithua/rote/tree/main/server/attachments): `server/attachments`
- [Import service](https://github.com/rabithua/rote/blob/main/server/imports/importService.ts): `server/imports/importService.ts`
- [Change sync](https://github.com/rabithua/rote/blob/main/server/sync/routes.ts): `server/sync/routes.ts`
- [Note sharing](https://github.com/rabithua/rote/blob/main/server/noteShares/routes.ts): `server/noteShares/routes.ts`

### AI Memory

- [Embedding worker](https://github.com/rabithua/rote/blob/main/server/utils/dbMethods/ai/embeddingWorker.ts): `server/utils/dbMethods/ai/embeddingWorker.ts`
- [Semantic retrieval](https://github.com/rabithua/rote/blob/main/server/embeddings/query.ts): `server/embeddings/query.ts`
- [AI runtime](https://github.com/rabithua/rote/tree/main/server/utils/ai): `server/utils/ai`

### Platform services

- [PostgreSQL data](https://github.com/rabithua/rote/blob/main/server/drizzle/schema.ts): `server/drizzle/schema.ts`
- [Database client](https://github.com/rabithua/rote/blob/main/server/utils/drizzle.ts): `server/utils/drizzle.ts`
- [Resource storage](https://github.com/rabithua/rote/blob/main/server/resources/service.ts): `server/resources/service.ts`
- [Admin controls](https://github.com/rabithua/rote/tree/main/web/src/pages/admin): `web/src/pages/admin`
- [Billing](https://github.com/rabithua/rote/blob/main/server/billing/publicRoutes.ts): `server/billing/publicRoutes.ts`

### Other components

- **User**

## Connections

- User → Web application: records and browses
- Web application → HTTP server: uses backend API
- HTTP server → REST routes: mounts routes (evidence: `server/server.ts`)
- REST routes → Authentication: authenticates requests
- Database client → PostgreSQL data: queries and persists (evidence: `server/utils/drizzle.ts`)
- Import service → Database client: persists imported data (evidence: `server/imports/importService.ts`)
- Import service → Resource storage: uses resource service (evidence: `server/imports/importService.ts`)
- Import service → Change sync: journals changes (evidence: `server/imports/importService.ts`)
- Change sync → Database client: reads sync state (evidence: `server/sync/routes.ts`)
- Note sharing → Authentication: requires authentication (evidence: `server/noteShares/routes.ts`)
- Note sharing → Database client: uses shared-note repository
- Embedding worker → Database client: processes indexing jobs
- Semantic retrieval → Database client: checks index state (evidence: `server/embeddings/query.ts`)
- Semantic retrieval → AI runtime: provides retrieval
- Admin controls → AI runtime: configures optional AI
- Web application → Media uploads: uploads media
- Web application → Import service: starts imports
- Web application → Note sharing: manages shared notes
- MCP interface → REST routes: exposes open interface
- Billing → PostgreSQL data: reads billing grants (evidence: `server/billing/publicRoutes.ts`)
- Resource storage → PostgreSQL data: stores resource state (evidence: `server/resources/service.ts`)
