Featured image of post Self-Hosting AFFiNE on Synology DS220+

Self-Hosting AFFiNE on Synology DS220+

AFFiNE is an open-source, Notion-like knowledge management tool that supports document editing, whiteboard collaboration, and AI assistants.

Official website: https://affine.pro/ GitHub: https://github.com/toeverything/AFFiNE

I’ve always been cautious about using Notion’s public cloud, so I stored important notes on my Synology NAS using Note Station. That was until I discovered AFFiNE.

Unlike Notion, AFFiNE supports self-hosting, which means you can run your own secure, private instance.
This post documents how I deployed AFFiNE on my Synology DS220+.

AFFiNE’s server requires PostgreSQL and Redis, and the official deployment method is via Docker Compose — a perfect chance to try Docker Compose on Synology DSM.

Official self-hosting guide: https://docs.affine.pro/self-host-affine


Setup Overview

Starting with DSM 7, Synology has replaced the classic Docker app with Container Manager, which fully supports Docker Compose.
We’ll use it for deployment.

Step 1: Preparation

  1. Download the latest docker-compose.yml file:
1
wget -O docker-compose.yml https://github.com/toeverything/affine/releases/latest/download/docker-compose.yml
  1. Download the .env example file:
1
wget -O .env https://github.com/toeverything/affine/releases/latest/download/default.env.example
  1. Create the following directories in DSM:
1
2
3
docker/affine/storage
docker/affine/config
docker/affine/db
  1. Edit the default.env.example file and find these lines:
1
2
3
4
5
6
# position of the database data to persist
DB_DATA_LOCATION=~/.affine/self-host/postgres/pgdata
# position of the upload data(images, files, etc.) to persist
UPLOAD_LOCATION=~/.affine/self-host/storage
# position of the configuration files to persist
CONFIG_LOCATION=~/.affine/self-host/config

Modify them as follows:

1
2
3
4
5
6
# position of the database data to persist
DB_DATA_LOCATION=./db
# position of the upload data(images, files, etc.) to persist
UPLOAD_LOCATION=./storage
# position of the configuration files to persist
CONFIG_LOCATION=./config
  1. Upload both docker-compose.yml and default.env.example files to your docker/affine directory in DSM. Rename default.env.example to .env.

Step 2: Deploy with Container Manager

Open Container Manager in DSM, go to the Project tab, and click Create.

Project name: affine
Path: docker/affine

If everything is set up correctly, you’ll see this confirmation message:

Click OK, then continue through the wizard by selecting Next → Finish.

Container Manager will start pulling the necessary images and automatically create the containers. Depending on your internet speed, this might take a while.

Once complete, go to the Containers page — you should see four new containers:

Step 3: Access AFFiNE

Deployment is done 🎉

Open your browser and visit:

http://your-synology-ip:3010/admin

Create your admin account. Then, in the desktop or mobile AFFiNE app, add your server:

http://your-synology-ip:3010

You now have a fully self-hosted, private AFFiNE workspace — secure, reliable, and completely under your control. 🚀