# logseq/logseq architecture

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

- Interactive diagram: https://gitdiagram.com/logseq/logseq
- Repository: https://github.com/logseq/logseq
- Video tour (about a minute): https://gitdiagram.com/logseq/logseq/video

## Overview

Logseq is a privacy-focused knowledge-management and collaboration application for desktop, web, and mobile. Its central workflow is to open a graph, create and organize notes and tasks, then search and work with that knowledge; the README also highlights PDF annotation, Markdown/Org-mode support, plugins, and real-time collaboration. The tree and README support these product areas, but sampled sources are sparse for the main frontend and database runtime, so their internal call wiring is intentionally not detailed.

Main entry points: [`src/main/frontend`](https://github.com/logseq/logseq/tree/master/src/main/frontend) (Open graph), [`ios/App/App/AppViewController.swift`](https://github.com/logseq/logseq/blob/master/ios/App/App/AppViewController.swift) (Native mobile host), [`deps/db-sync/worker`](https://github.com/logseq/logseq/tree/master/deps/db-sync/worker) (Real-time sync), [`libs/src`](https://github.com/logseq/logseq/tree/master/libs/src) (Plugin API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User applications"]
  node_application["Logseq application"]
end

subgraph group_knowledge["Knowledge workflows"]
  node_graph["Open graph"]
  node_notes["Notes and pages"]
  node_tasks["Task management"]
  node_search["Search and queries"]
  node_pdf["PDF annotation"]
  node_formats["Markdown and Org"]
end

subgraph group_storage["Graph storage"]
  node_db[("Graph database")]
  node_fileworker["File worker<br/>[worker.js]"]
end

subgraph group_collaboration["Collaboration and extensions"]
  node_sync["Real-time sync"]
  node_plugins["Plugin API"]
  node_pluginstorage["Plugin storage"]
  node_embedding["Embedding service"]
end

subgraph group_platform["Native platform"]
  node_mobile["Native mobile host"]
  node_share["iOS share extension"]
end

node_user(("User"))
node_syncservice["Sync service"]

node_user -->|"uses"| node_application
node_application -->|"opens"| node_graph
node_graph -->|"creates and organizes"| node_notes
node_graph -->|"manages"| node_tasks
node_graph -->|"searches"| node_search
node_graph -->|"annotates"| node_pdf
node_graph -->|"supports"| node_formats
node_graph -->|"stores graph data"| node_db
node_graph -.->|"uses file operations"| node_fileworker
node_application -->|"supports extensions"| node_plugins
node_plugins -->|"requests storage"| node_pluginstorage
node_graph -->|"synchronizes"| node_sync
node_sync -->|"communicates with"| node_syncservice
node_user -->|"uses"| node_mobile
node_mobile -->|"hosts"| node_application
node_user -->|"shares content"| node_share
node_share -->|"passes shared data"| node_mobile
node_application -.->|"requests embeddings"| node_embedding

click node_application "https://github.com/logseq/logseq/tree/master/src/main/frontend"
click node_graph "https://github.com/logseq/logseq/tree/master/src/main/frontend"
click node_notes "https://github.com/logseq/logseq/tree/master/src/main/frontend"
click node_tasks "https://github.com/logseq/logseq/tree/master/src/main/frontend"
click node_search "https://github.com/logseq/logseq/tree/master/src/main/frontend"
click node_pdf "https://github.com/logseq/logseq/tree/master/src/main/frontend/extensions/pdf"
click node_formats "https://github.com/logseq/logseq/tree/master/src/main/frontend"
click node_db "https://github.com/logseq/logseq/tree/master/deps/db"
click node_fileworker "https://github.com/logseq/logseq/blob/master/resources/js/worker.js"
click node_sync "https://github.com/logseq/logseq/tree/master/deps/db-sync/worker"
click node_plugins "https://github.com/logseq/logseq/tree/master/libs/src"
click node_pluginstorage "https://github.com/logseq/logseq/blob/master/libs/src/modules/LSPlugin.Storage.ts"
click node_mobile "https://github.com/logseq/logseq/blob/master/ios/App/App/AppViewController.swift"
click node_share "https://github.com/logseq/logseq/blob/master/ios/App/ShareViewController/ShareViewController.swift"
click node_embedding "https://github.com/logseq/logseq/blob/master/sidecar/embedding_server.py"

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_application,node_user toneBlue
class node_graph,node_notes,node_tasks,node_search,node_pdf,node_formats toneAmber
class node_db,node_fileworker toneMint
class node_sync,node_plugins,node_pluginstorage,node_embedding toneRose
class node_mobile,node_share,node_syncservice toneIndigo
```

## Components

### User applications

- [Logseq application](https://github.com/logseq/logseq/tree/master/src/main/frontend): `src/main/frontend`

### Knowledge workflows

- [Open graph](https://github.com/logseq/logseq/tree/master/src/main/frontend): `src/main/frontend`
- [Notes and pages](https://github.com/logseq/logseq/tree/master/src/main/frontend): `src/main/frontend`
- [Task management](https://github.com/logseq/logseq/tree/master/src/main/frontend): `src/main/frontend`
- [Search and queries](https://github.com/logseq/logseq/tree/master/src/main/frontend): `src/main/frontend`
- [PDF annotation](https://github.com/logseq/logseq/tree/master/src/main/frontend/extensions/pdf): `src/main/frontend/extensions/pdf`
- [Markdown and Org](https://github.com/logseq/logseq/tree/master/src/main/frontend): `src/main/frontend`

### Graph storage

- [Graph database](https://github.com/logseq/logseq/tree/master/deps/db): `deps/db`
- [File worker](https://github.com/logseq/logseq/blob/master/resources/js/worker.js): `resources/js/worker.js`

### Collaboration and extensions

- [Real-time sync](https://github.com/logseq/logseq/tree/master/deps/db-sync/worker): `deps/db-sync/worker`
- [Plugin API](https://github.com/logseq/logseq/tree/master/libs/src): `libs/src`
- [Plugin storage](https://github.com/logseq/logseq/blob/master/libs/src/modules/LSPlugin.Storage.ts): `libs/src/modules/LSPlugin.Storage.ts`
- [Embedding service](https://github.com/logseq/logseq/blob/master/sidecar/embedding_server.py): `sidecar/embedding_server.py`

### Native platform

- [Native mobile host](https://github.com/logseq/logseq/blob/master/ios/App/App/AppViewController.swift): `ios/App/App/AppViewController.swift`
- [iOS share extension](https://github.com/logseq/logseq/blob/master/ios/App/ShareViewController/ShareViewController.swift): `ios/App/ShareViewController/ShareViewController.swift`

### Other components

- **User**
- **Sync service**

## Connections

- User → Logseq application: uses
- Logseq application → Open graph: opens
- Open graph → Notes and pages: creates and organizes
- Open graph → Task management: manages
- Open graph → Search and queries: searches
- Open graph → PDF annotation: annotates
- Open graph → Markdown and Org: supports
- Open graph → Graph database: stores graph data
- Open graph → File worker: uses file operations
- Logseq application → Plugin API: supports extensions
- Plugin API → Plugin storage: requests storage
- Open graph → Real-time sync: synchronizes
- Real-time sync → Sync service: communicates with
- User → Native mobile host: uses
- Native mobile host → Logseq application: hosts
- User → iOS share extension: shares content
- iOS share extension → Native mobile host: passes shared data
- Logseq application → Embedding service: requests embeddings
