I’ve written about AFFiNE a lot here at XDA because it’s genuinely one of the best PKM tools I’ve come across. However, I’d only ever used it locally on my PC. I’m still new to self-hosting, and actually used NotebookLM to help me learn the ropes. Ever since, I’ve been willing to experiment more with running my own servers, and since I use AFFiNE often, it was one of the first tools I wanted to switch to a self-hosted setup.

AFFiNE had already replaced Notion for me by and large, but now that I’m actually in control of where my data is stored, who can access it, and how it syncs, I can’t see myself ever going back. The app as a whole feels faster and smoother, too. For someone who usually spends hours a day in a PKM system, this level of control is a big deal. Now, Notion pales in comparison.

Self-hosting AFFiNE

Setting it up for the first time

I followed the official AFFiNE self-hosting guide, which you can get here. First, I verified that Docker was working by checking docker --version and docker compose version in PowerShell. Next, I created a dedicated folder for all the AFFiNE files, and inside that folder, I downloaded the official docker-compose.yml and env files from AFFiNE’s GitHub releases.

I edited the .env file to set a secure database password, while keeping all the other defaults, including folder paths and database names, unchanged. With Docker running, I executed docker compose up -d in PowerShell to pull the necessary images and start three services: Postgres, Redis, and AFFiNE itself. This process also ran a one-time database migration job so that the database was properly set up to store all my notes, pages, and app data.

Once the containers were running, I accessed the self-hosted server in my browser with the local host address, and created a new admin account directly in the app. After logging in, I was directed to the main dashboard where I was able to configure authorization, notifications, storage, and so on. Accessing the app is probably what took the longest to figure out. I couldn’t find a Workspace feature in the admin dashboard, but eventually realized all it took was removing /admin/accounts from the address and hitting enter.

You can reportedly import your existing local AFFiNE data (from the non-self-hosted desktop version) into your self-hosted setup using an import-config command. I recommend checking out the GitHub discussions or Reddit threads for guidance on how to do this. In my case, starting fresh was faster since my existing setup is already lightweight and easy to recreate, so I just created a new workspace.

AFFiNE is a block-based note-taker

With comprehensive formatting features

Just like Notion, AFFiNE uses a modular block-based system where every line of text or content you create is a “block”. They can be moved, duplicated, and nested, which is what gives you more flexibility over the way you structure your notes. Unlike many other free note-takers, the formatting options are robust. You get rich text options, inline code, and the ability to create custom styles and structures like highlighting, underscoring, and alignment options.

Where AFFiNE pulls ahead, in my opinion, is how much faster and responsive it is even when you have hundreds or thousands of blocks. Dragging my content around or creating linked blocks doesn’t slow the app down like I’ve sometimes experienced in Notion. And since I’m self-hosting now, I don’t worry about lag caused by server-side rendering or cloud sync delays.

Building and navigating your knowledge base

Tags, folders, and relational links

Beyond notes and formatting, AFFiNE excels at helping you organize and connect your information. You can assign tags to any page, which makes it easy to surface and retrieve that content at any point with the search function. Pages can exist in folders and subfolders for broad organization, and links can connect those pages across different topics or notes.

I like to use tags for things like priority levels and project types, and use a similar folder structure as I do locally to keep my documents sorted in a hierarchical order. And relational links are especially helpful for larger batches of writing or research.

The Canvas is great for visual thinkers

See your notes and documents laid out

One of the features that attracted me most to AFFiNE was its Edgeless Canvas. I’ve written before about how it effectively replaces Obsidian’s Canvas, because it’s basically a mini design tool. You can link and connect your AFFiNE pages on the canvas, create new frames to populate with content, use drawing and shape tools, or choose templates from the selection.

It’s minimal yet feature-rich at the same time, and the perfect way to get a visual overview of my notes or draw diagrams. This is a feature Notion lacks completely.

I’m not going back to Notion

I already loved AFFiNE before self-hosting it, but running it on my own server takes the experience to a new level. The app overall just feels faster and more responsive, plus there’s the extra layer of assurance of control. And I still have all the same tools I love about AFFiNE that make note-taking dynamic and kind of fun.

AFFiNE