Logseq

A privacy-first, open-source knowledge graph platform combining Markdown, Org-mode, bidirectional linking, and local-first storage for building your second brain.

41.4Kstars
2.5Kforks
GNU Affero General Public License v3.0
Clojure

Logseq is a local-first, open-source knowledge management platform that gives individuals and teams complete ownership of their notes, tasks, and ideas without any cloud dependency. Built on ClojureScript and Electron, it combines the simplicity of Markdown and Org-mode with a powerful bidirectional knowledge graph, where every link you create between pages becomes a two-way connection you can traverse and query using Datalog.

The platform is designed for thinkers who value longevity and data sovereignty. Your notes are stored as plain text files on your own device — readable by any text editor long after Logseq itself evolves. The graph view visualizes how your ideas connect across hundreds of pages, turning a flat collection of notes into an interconnected web of knowledge that surfaces insights through association rather than search alone.

Logseq is in active transition to a new DB version that replaces the file-based storage with SQLite for richer property support and real-time collaboration. The DB version enables multi-device sync and live co-editing through an experimental RTC (Real-Time Collaboration) layer with end-to-end encryption, extending Logseq from a personal tool into a collaborative knowledge base for small teams.

With a growing ecosystem of community plugins, themes, and an official Plugin API, Logseq adapts to diverse workflows — from daily journaling and spaced repetition flashcards to PDF annotation, task management, and code documentation — all while keeping your data in formats you control.

What You Get

  • Bidirectional Knowledge Graph - Automatically creates two-way links between notes using double-bracket references like [[Page Name]], letting you traverse connections in both directions and discover unexpected relationships across your knowledge base.
  • Local-First Plain Text Storage - All notes are stored as Markdown or Org-mode files on your own device, ensuring permanent readability, complete privacy, and freedom from vendor lock-in regardless of what happens to the app.
  • Real-Time Collaboration (RTC) - The new DB version enables live co-editing of shared graphs with conflict resolution, end-to-end encryption per graph, and multi-device sync — bringing team knowledge management to a formerly personal-only tool.
  • Plugin API and Ecosystem - A documented Plugin API at plugins-doc.logseq.com enables community developers to extend Logseq with custom features including AI integrations, calendar sync, spaced repetition flashcards, and specialized export formats.
  • PDF Annotation - Annotate and highlight PDFs directly within Logseq, with every annotation linked back into your knowledge graph so insights from documents connect to your broader notes and research.
  • Embedded Clojure Evaluation (SCI) - Write real Clojure code inside note blocks using the embedded Small Clojure Interpreter, enabling dynamic queries, data transformations, and computed content that updates when your graph changes.
  • Task and Project Management - Built-in task system with checkboxes, priority tags, due dates, scheduled tasks, and recurring task support, all queryable via Datalog so you can surface tasks across your entire knowledge base.
  • Graph Visualization - Interactive visual graph shows how pages and blocks connect across your entire knowledge base, revealing clusters of related ideas and orphaned notes that need linking.

Common Use Cases

  • Researcher building a literature review - A PhD student links papers, annotations, quotes, and personal insights into a unified graph, using Datalog queries to surface all notes referencing a specific concept across hundreds of pages.
  • Developer maintaining project knowledge - A software engineer stores architecture decisions, API documentation, code snippets, and meeting notes as linked Markdown files that git-track alongside the codebase, queryable from the Logseq CLI.
  • Writer developing a long-form project - A novelist organizes characters, plot threads, worldbuilding details, and chapter outlines as interconnected pages, using the graph view to spot structural gaps and unresolved storylines.
  • Team running internal documentation - A small remote team uses Logseq’s RTC feature to co-edit a shared knowledge base in real time, keeping all documentation encrypted and self-hosted without depending on a third-party wiki service.
  • Daily journaler building a second brain - A knowledge worker uses dated journal pages as daily entry points, linking recurring themes and ideas across months to build a growing personal knowledge base that surfaces context from the past.
  • Student using spaced repetition - A learner uses the community flashcard plugin to convert highlighted notes into spaced repetition cards, integrating active recall directly into the knowledge management workflow.

Under The Hood

Architecture Logseq employs a layered architecture that separates concerns across a ClojureScript frontend, dedicated Web Workers for database operations, and platform-specific native layers for Electron and mobile. Application state bifurcates cleanly: document-level knowledge lives in DataScript, an in-memory Datalog database, while UI ephemera lives in Clojure atoms subscribed to via Rum’s reactive components. Execution flows from the core init function through a reitit router to page components, with all data mutations dispatched as transactions through a centralized pipeline that serializes writes to the worker thread. Worker isolation prevents race conditions across browser tabs through filesystem locking and native lock primitives. The DB version overlays a CRDTs-inspired RTC sync layer onto the existing DataScript model, with end-to-end encryption keys stored in platform keystores.

Tech Stack The primary runtime is ClojureScript compiled via shadow-cljs with Closure Compiler optimizations, targeting browser, Electron, and mobile simultaneously. Rum wraps React 19 for declarative UI, with DataScript serving as the reactive query source using Datalog for expressive bidirectional graph traversal. Persistence uses two distinct paths: the legacy file graph reads raw Markdown and Org-mode files via the File System Access API, while the DB version stores everything in SQLite using both better-sqlite3 for Node and SQLite WASM for the browser. The build chain is sophisticated: shadow-cljs handles ClojureScript, Webpack bundles JavaScript modules, Gulp orchestrates CSS via PostCSS with Tailwind, and Capacitor bridges to iOS and Android native layers. Testing spans cljs.test for unit coverage and Playwright for end-to-end browser automation.

Code Quality The test suite is comprehensive, spanning unit, integration, and end-to-end coverage across frontend, mobile, Electron, and shared library layers, with dedicated test namespaces for DB models, query DSL, property values, undo/redo, and security. Code follows consistent Clojure namespace conventions with explicit re-exports for clean public APIs. Error handling uses defensive nil-safe checks via idiomatic Clojure patterns rather than typed exceptions. clj-kondo enforces linting with parallel analysis, typos.toml enforces spelling discipline, and CI runs the full suite across targets. The multi-target build system — app, Electron, mobile, and DB worker — adds operational complexity but each target is well-isolated with its own compilation profile.

What Makes It Unique Logseq’s most distinctive technical contribution is treating every note property — dates, tags, links, and custom attributes — as a first-class node in a Datalog graph, enabling bidirectional queries that traditional SQL-backed tools cannot easily replicate. SCI (Small Clojure Interpreter) is embedded as a live macro evaluator inside note blocks, allowing users to write real Clojure code to query and transform their own knowledge graph inline. The DB version introduces a custom CRDT-inspired RTC protocol with per-graph end-to-end encryption, storing cryptographic keys in platform keystores such as Electron’s keychain and iOS Secure Enclave. A CLI distributable exposes graph operations headlessly, making Logseq scriptable from terminal pipelines — an unusual capability for a primarily GUI personal knowledge management tool.

Self-Hosting

Logseq is released under the GNU Affero General Public License v3.0 (AGPL-3.0), one of the strongest copyleft licenses available. In plain terms, you can use Logseq freely for personal or commercial purposes, and you can modify the source code. However, if you deploy a modified version over a network so that others can use it, you must release your modifications under the same AGPL-3.0 license. For most self-hosters running it for personal or internal team use without exposing a service to the public, this restriction is not practically relevant. The license does not restrict you from storing proprietary content inside Logseq — only the software itself is subject to copyleft, not your notes.

Running Logseq yourself is straightforward for the web app variant: the official Docker image can be pulled from GitHub Container Registry and launched locally or on a VPS behind Nginx with HTTPS. The desktop application is a self-contained Electron binary with no server component required — all data lives locally. However, the new DB version with Real-Time Collaboration (RTC) sync is more involved: it relies on Logseq’s own hosted sync infrastructure, which means true self-hosted multi-device sync for the DB version is not yet a supported community option. You are responsible for your own data backups; for the DB version, automated SQLite DB exports are the recommended approach, and for file graphs, standard filesystem backups of your Markdown files suffice.

Compared to a fully managed experience, self-hosting Logseq means you lose access to Logseq’s hosted sync service, which handles RTC conflict resolution and cross-device availability automatically. There is no enterprise tier with SLAs, dedicated support, or managed uptime — the project relies on community forums, Discord, and the GitHub issue tracker. Logseq Sync (the paid cloud offering) provides seamless multi-device synchronization as a hosted service, which removes the operational burden of managing backups and network access yourself. For individuals and small teams comfortable with plaintext files and manual backup strategies, the self-hosted path is fully viable; for organizations requiring guaranteed availability and formal support, the hosted sync option is worth considering.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack

No spam. Unsubscribe anytime.

Join 750+ subscribers
No spam. Unsubscribe anytime.

Search