SiYuan 3.8: Self-Host a Block-Based Notes App with Docker Compose

SiYuan links notes down to the single block. Here is how to run v3.8.11 with Docker Compose, what the Docker version can and cannot do, and what it used on a small test VM.

Share
SiYuan editor showing a note with a block reference and a code block
SiYuan v3.8.11 running on our test VM (demo data). Screenshot: uptime.bet

SiYuan is a note-taking and knowledge management app where every paragraph, heading and list item is its own block. You can link to any block, embed it somewhere else and see where it is used. The project sits at roughly 47,000 stars on GitHub, gets new builds almost daily (alpha and beta tags appeared while I was writing this), and has an official Docker image. That makes it a good candidate for a homelab, as long as you know about a few limits of the Docker version, which I cover below.

I ran the setup from this article on a small test VM (2 vCPU, about 1.8 GB RAM, no GPU) with SiYuan v3.8.11, the stable release from November 19, 2026. The whole thing is one container and one folder.

SiYuan editor with a document tree on the left and a note containing a block reference and a code block
SiYuan v3.8.11 running on our test VM (demo data). Screenshot: uptime.bet

What SiYuan can do

The core idea is block-level linking. Type a double parenthesis, pick a block from any note, and the reference shows up inline. The block you pointed at then shows a small counter, and the document tree shows how many references a note receives. In the screenshot further down you can see both: the "Homelab Notes" document has a "1" in the tree because another note points at one of its paragraphs.

Beyond that, the official README lists a Markdown WYSIWYG editor, custom block attributes, SQL queries you can embed in notes, flashcards with spaced repetition, a database view in table form, OCR, templates, JavaScript and CSS snippets, a plugin and theme marketplace, a documented HTTP API, and mobile apps. Export formats and some sync options differ depending on how you run it, more on that in the limits section.

It is licensed under AGPL-3.0. Most features are free, including for commercial use. A few are tied to a paid membership, and the official pricing page lists which ones, so check it before you plan around something like third-party cloud sync.

What you need

  • A Linux server with Docker and the Compose plugin
  • About 500 MB of disk for the image (the pulled image was around 477 MB on my VM), plus room for your notes and assets
  • A reverse proxy with HTTPS if you want to reach it from outside, for example Caddy, Nginx or Traefik

The image is published for amd64, arm64 and 32-bit arm, so a Raspberry Pi works too, although I only tested on x86_64.

Docker Compose setup, step by step

1. Create a project folder and the workspace

SiYuan keeps everything (notebooks, assets, settings, plugins, its search index) in one workspace folder. The container runs as user ID 1000 by default, so the folder on the host should belong to that user.

mkdir -p ~/siyuan/workspace
cd ~/siyuan
sudo chown -R 1000:1000 workspace

2. Set a lock screen password

SiYuan calls its login the "access auth code". If you start a Docker instance without one, anyone who can reach the port can read and edit your notes, so set it before the first start. The compose file below reads it from a .env file and stops with an error if it is empty.

echo "AuthCode=change-me-to-a-long-random-string" > .env
chmod 600 .env

Generate a real value instead of typing one, for example with openssl rand -hex 16.

3. Create docker-compose.yml

services:
  siyuan:
    image: b3log/siyuan:v3.8.11
    command: ['serve', '--workspace=/siyuan/workspace/', '--accessAuthCode=${AuthCode:?Set AuthCode}']
    ports:
      - "127.0.0.1:6806:6806"
    volumes:
      - ./workspace:/siyuan/workspace
    restart: unless-stopped
    environment:
      - TZ=Europe/Berlin
      - PUID=1000
      - PGID=1000

A few notes on this file. The image tag is pinned, so an update only happens when you change the number. Since version 3.7.0 the serve subcommand has to be passed explicitly, which older tutorials on the web leave out. PUID and PGID are optional and default to 1000. The port is bound to localhost on purpose, so the reverse proxy is the only way in from outside. Set TZ to your own time zone.

4. Start it

docker compose up -d
docker compose logs -f siyuan

On my VM the pull and start together took well under half a minute. The log contains a line saying the fixed port service is running on 6806. The image has no built-in Docker healthcheck, so docker compose ps only tells you the container is running, not that the app answers. A request to the root URL without logging in returned HTTP 401, which is the expected behavior with an auth code set.

5. Open it and log in

Open http://127.0.0.1:6806 on the server (or through an SSH tunnel) and enter your auth code. The login page shows the workspace name and a "Remember me for 30 days" checkbox.

SiYuan lock screen asking for the access password
The lock screen of SiYuan v3.8.11 on our test VM. Screenshot: uptime.bet

After logging in you get an empty notebook called "My Notebook" with a starter document and a small welcome box offering to import data, log in for sync, or open the user guide. There is no separate admin setup, because SiYuan is a single-user app with one lock code.

6. Put it behind HTTPS

Use a reverse proxy for notes.example.com that forwards to 127.0.0.1:6806. The official docs are specific about three things, and I would follow them exactly:

  • Proxy the WebSocket path /ws as well, not just regular requests.
  • Pass the original Host header including the port. In Nginx that means proxy_set_header Host $http_host; in both locations. The docs say that using $host can break the origin check and leave the page stuck on the logo.
  • Set X-Forwarded-For to the real client address and do not pass through a value sent by the client. The docs warn that otherwise a remote client may be treated as a local administrator.

Do not use URL rewriting, since the docs say it can break authentication.

Trying the block references

To check that the core feature works the way I describe it, I created two notes through the HTTP API and then opened them in the browser. The first one ("Homelab Notes") has a paragraph about nightly snapshots. The second one ("Weekly Review") references that paragraph with the text "backup routine". The result: the reference is underlined in the second note, the first note shows a counter next to the paragraph and next to its title, and the document tree shows a "1" behind the note name.

SiYuan note with reference counters next to the title and a paragraph
A note that is referenced from another one shows a counter (demo data). Screenshot: uptime.bet

SiYuan also has an API for this kind of automation. The kernel exposes endpoints for notebooks, documents, blocks and SQL queries, and I called them with my logged-in browser session. The API reference is in the repository.

Tips

Stop the container before you back up the workspace. SiYuan keeps a search index in its workspace, and the project's own Kubernetes notes say that a copy of the live index alone is not enough. A simple routine is docker compose stop, copy or snapshot the workspace folder, then docker compose start. Never run two instances against the same workspace folder.

Do not sync the workspace with Dropbox, Syncthing or a similar tool. The README says third-party sync disks are not supported and may corrupt data. SiYuan has its own sync, which uses a data repo key, and the README describes how to recover from a lost key. Read that section before you rely on sync.

If you want single sign-on instead of a lock code, current versions can use OIDC with custom providers, Google, Microsoft or GitHub. It is configured through environment variables starting with SIYUAN_OIDC_, for example SIYUAN_OIDC_ENABLED, SIYUAN_OIDC_PROVIDER and SIYUAN_OIDC_CLIENT_ID. I did not test OIDC, so check the README for the full list and the callback URL rules.

The access code can also be set with the SIYUAN_ACCESS_AUTH_CODE environment variable. The command line flag wins if both are set. Setting SIYUAN_ACCESS_AUTH_CODE_BYPASS=true turns the lock off completely, which is not something you want on a server that faces the internet.

To update, change the tag in the compose file, run docker compose pull and docker compose up -d. Back up first. The v3.8.11 release notes mention that database formats can be upgraded when you save new content in some database fields, and that older clients cannot open the newer formats, so update every device that touches the same data.

Resource usage

On the test VM, docker stats showed about 46 MiB of RAM right after the first start and about 163 MiB after I had logged in, opened the editor and created a few documents. CPU stayed around 1 percent. That is a single small test workspace, so a large notebook with many assets and a big index will use more.

Limits and security

  • Docker is browser only. The README says the Docker version does not support connections from the desktop and mobile apps, and that export to PDF, HTML and Word as well as Markdown file import are not supported there. Check this against your workflow first, because it is the biggest catch.
  • One user, one lock. There are no separate accounts with permissions. Whoever has the code (or passes your OIDC rules) has full access.
  • Do not expose it without a lock and HTTPS. Keep the port bound to localhost and let the reverse proxy handle TLS.
  • Plugins and snippets run code. The marketplace and the JavaScript snippets are powerful, so install only what you trust.
  • Some features need a paid membership. The project says most features are free, but not all of them.

How it compares

If you want a tree of notes with rich formatting and scripting, Trilium Notes is the closer sibling. For quick capture in a timeline, Memos is much simpler. SiYuan makes the most sense when you want links between individual blocks across notes and a Markdown-based editor, and you can live with the browser-only Docker version. If you need desktop and mobile apps that talk to your server, check the current state of that feature before you commit, because the README currently lists it as unsupported for Docker.

Conclusion

SiYuan is easy to run: one image, one folder, one password. The Compose file above worked on the first try on my test VM. The part to think about is whether the Docker limits fit you. If you mainly write in the browser and care about backlinks and block references, it is a strong option. If you want exports to Word or PDF from your server, or desktop and mobile clients connected to it, plan another route.

Sources