You can self-host AFFiNE, the open-source workspace that puts Notion-style docs and a Miro-style whiteboard in one app, with two downloaded files and docker compose up -d. The project had about 78,000 GitHub stars and picked up 584 more on the day we checked, November 25, 2026. Most guides you will find predate version 0.27.4, which dropped the .env file and moved the data folders.
We read the release files, the license and AFFiNE's self-hosting docs (last updated November 19, 2026) for this guide. We did not run the stack ourselves, so there are no performance numbers here.
RelatedWeKnora Setup: Self-Host Tencent's Open Source RAG Platform
- The latest stable release is v0.27.4, published August 18, 2026. Its Compose file starts AFFiNE, a one-time migration job, Redis, and Postgres with pgvector.
- Plan for 4 CPU cores, 2 GB of RAM and about 1.5 GB of free disk. The docs raise that to 4 GB of RAM if any doc will pass 10,000 words.
- Each self-hosted workspace gets 10 seats. More than that needs a Team license.
- Moving from an older install? Do not overwrite your Compose file. The new one can start on an empty database and make it look like your notes are gone.
The exact steps, start to finish
- Check that Docker Compose v2 is installed. If this prints a version, you are ready. If it errors, install Docker first.
docker compose version - Make a folder you will not move later. Your notes live inside it.
# Linux or macOS mkdir affine cd affine mkdir -p config # Windows, PowerShell or cmd.exe mkdir affine cd affine mkdir config - Download the current Compose file. On Windows use
curl.exe, because plaincurlin Windows PowerShell is a different command.# Linux or macOS curl -L -o docker-compose.yml \ https://github.com/toeverything/AFFiNE/releases/latest/download/docker-compose.yml # Windows, PowerShell or cmd.exe curl.exe -L -o docker-compose.yml https://github.com/toeverything/AFFiNE/releases/latest/download/docker-compose.yml - Download the example config into the config folder.
# Linux or macOS curl -L -o config/config.json \ https://github.com/toeverything/AFFiNE/releases/latest/download/config.json.example # Windows, PowerShell or cmd.exe curl.exe -L -o config/config.json https://github.com/toeverything/AFFiNE/releases/latest/download/config.json.example - Set the address people will open. In
config/config.json, editserver.externalUrl. Leave it alone for a local test, or put your final HTTPS address there."externalUrl": "http://localhost:3010" - Start it and check the containers. The migration container should finish, while AFFiNE, Postgres and Redis keep running.
docker compose up -d docker compose ps - Create the admin account straight away. Open
http://localhost:3010/admin. The first visit shows the form that creates the administrator, so do this before anyone else can reach the server. - Make your first doc. Go to
http://localhost:3010, sign in, create a workspace and write something. To use the desktop app, download it, open the workspace list in the top left corner, add your server and enter its address.
What changed in AFFiNE 0.27.4, and why old guides break
Older tutorials tell you to fill in DB_PASSWORD, DB_DATA_LOCATION and friends. A new install does not read them. Even AFFiNE's own overview page still lists those variables in its production checklist, so trust the Docker Compose page over it.
| Older .env layout | 0.27.4 layout | |
|---|---|---|
| Settings | .env | config/config.json or the Admin Panel |
| Database folder | DB_DATA_LOCATION | ./data/postgres |
| Uploads folder | UPLOAD_LOCATION | ./data/storage |
| Config folder | CONFIG_LOCATION | ./config |
| Database login | User and password from .env | User affine, no password |
The missing password looks alarming. The Compose file sets POSTGRES_HOST_AUTH_METHOD: trust, and it also publishes no port for Postgres, so only containers on the same Compose network can connect. Keep it that way: do not add a ports entry to the database service.
Versions have to match as well. The release notes say a 0.27 client only syncs with a 0.27 or newer server, and a 0.27 server only accepts clients from 0.26 up. Update your phone and desktop apps along with the server.
Putting AFFiNE behind HTTPS with Caddy or nginx
Sync runs over WebSocket, so whatever proxy you pick has to pass it through. The docs' Caddy version is the short one:
<external_url> {
reverse_proxy http://<ip-or-localhost>:3010
}
For nginx, the important lines from the docs are these. Their HTTPS example leaves them out, so copy them into the 443 block too.
client_max_body_size 100m;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
Afterwards go to Admin, Settings, Server and set the external URL to the same host. AFFiNE uses it to build invitation and public doc links.
Adding your own AI key
AI works on a bring-your-own-key basis. Open a workspace, then Settings, Integrations, AI BYOK, Add key, and press Test key before saving. OpenAI, Anthropic, Gemini and FAL are the choices. Chat and writing need one of the first three, while transcription and workspace indexing want a Gemini key stored on the server.
One thing to check in the file you downloaded: the release's example config sets "allowCustomEndpoint": true, although the docs describe custom endpoints as something an administrator must explicitly enable. If you only use official providers, change it to false and apply it:
docker compose up -d
Backing up before you upgrade anything
A full backup is three things: a database dump, ./data/storage, and your config plus Compose file. Run these in a Linux, macOS or WSL shell, since the quoting does not survive cmd.exe:
RelatedMacro Setup: Self-Host the Open Source Slack and Linear Rival
docker exec affine_postgres sh -c 'pg_dump --format=custom --file=/tmp/affine.backup --username="$POSTGRES_USER" "$POSTGRES_DB"'
docker cp affine_postgres:/tmp/affine.backup ./affine.backup
# check that the archive can be read
docker exec affine_postgres sh -c 'pg_restore --list /tmp/affine.backup >/dev/null'
Then compare the new Compose file with yours before replacing it. Swap in the tag you are moving to:
AFFINE_VERSION=v0.xx.x
wget -O docker-compose.yml.new "https://github.com/toeverything/AFFiNE/releases/download/${AFFINE_VERSION}/docker-compose.yml"
diff -u docker-compose.yml docker-compose.yml.new
mv docker-compose.yml.new docker-compose.yml
docker compose pull
docker compose up -d
Fixing 'role "affine" does not exist' and a missing workspace
role "affine" does not exist. Your database was created under a different DB_USERNAME, and the new Compose file connects as affine. Go back to the old Compose file, dump the database with it, and restore into a fresh folder. The docs warn against creating an affine role only to silence the error.
AFFiNE asks for a new administrator after an upgrade. It has usually started on a new, empty database folder. Stop, and point the Compose file at your old path. Until you have verified everything, do not delete .env or run docker compose down --volumes.
The page never loads. Read the last 200 log lines from the server and the migration job:
docker compose logs --tail=200 affine affine_migration
Login works in the browser but not in the app. There is an open bug report from October 31 about exactly this on the Linux and Android apps, so the browser is the fallback for now.
License limits, and when Notion or Miro is the easier choice
The code is not all under one license. Most of the repository is MIT, but packages/backend and packages/common/native fall under AFFiNE's Enterprise Edition license, whose text ties production use to a subscription. The docs meanwhile grant every self-hosted workspace up to 10 seats. A family or side project sits inside what the docs describe. A company should ask AFFiNE before relying on it.
| AFFiNE, self-hosted | Notion | Miro | |
|---|---|---|---|
| Idea the README credits | Docs and whiteboard merged | Everything is a block | Edgeless visual whiteboard |
| Source code | Public, MIT plus EE backend | Not open source | Not open source |
| Backups and updates | Your job | Handled for you | Handled for you |
Self-host it if you already keep a server running and want notes on your own disk. If you would be learning Docker, backups and HTTPS just to take notes, the docs themselves call a managed workspace the simpler option, and they are right.
- Repotoeverything/AFFiNE on GitHub README and license files
- ReleaseAFFiNE v0.27.4 Compose file, example config, breaking changes
- DocsDocker Compose install and after installation setup commands and admin account
- DocsRequirements and user quota hardware and the 10-seat limit
- DocsUpgrade and backup and restore the 0.27.4 layout change
- DocsDomain and HTTPS and AI keys proxy examples and BYOK
- DependencyInstall Docker Compose Docker's own guide
