Relying on cloud apps means you don’t really own your notes. If your internet goes down or the company changes its policies, you may lose access.
In this article, you will learn how to create your own personal workspace using AFFINE. You will use Docker Compose to link three separate pieces of software together.
AFFINE core application.
A PostgreSQL database to store your notes and pages.
A Redis cache to make the app run faster and smoother.
By the end of this article, you’ll have a fully functional web app running on your own computer that works just like the cloud version of Notion.
Table of Contents
What is Affine?
AFFINE is an “all-in-one” workspace that combines the powers of writing, drawing and planning.
While tools like Notion focus on documents and Miro focuses on whiteboards, AFFINE lets you do both in one place. You can turn your written notes into a visual canvas with one click. It makes it perfect for brainstorming, tracking tasks and managing your personal knowledge.
The power of self-hosting
Although AFFINE offers a cloud version, hosting it yourself gives you three major advantages:
Total Ownership of Data: Your notes never leave your machine. You own the database.
Privacy in the AI Age: No big tech company can scan your private ideas and use them for AI training.
Real DevOps Skills: Learning how to manage Docker within WSL is a highly valuable skill for any advanced developer.
Conditions
To follow this article, make sure you have these tools ready on your machine:
Installing WSL 2: If you are using Windows you must have WSL installed (I am using Ubuntu for this guide).
Docker and Docker Compose: These are installed and running on your machine.
Linux Terminal Commands: You should be familiar with basic commands like
mkdir,cdandwget.
Step 1: Prepare your workspace
To begin, create a folder for your AFFINE files. It keeps your data in one organized place.
Then open your WSL terminal and run this command:
mkdir affine
cd affine

Step 2: Obtaining the official setup files
You will download the official configuration files directly from AFFINE. In your WSL terminal, run these two commands:
- Download the Docker Compose file:
wget -O docker-compose.yml
- Download the environment template:
wget -O .env

Step 3: Configuring Your Environment (.env)
gave .env The file is like a hidden settings sheet. It keeps your passwords and setup details private.
To edit this file, you can use nano, a simple text editor built into your Linux terminal. Follow these steps to update your settings:
Open the file with nano:
nano .envUpdate settings: Use your arrow keys to move around the file. Update these specific lines to match the locations below. It keeps your data safe inside your new.
affineFolder:DB_DATA_LOCATION=./postgres UPLOAD_LOCATION=./storage CONFIG_LOCATION=./config DB_USERNAME=affine DB_PASSWORD= DB_DATABASE=affine
Save and exit: Press Ctrl + O to save.
Step 4: Launching the System
Run this docker command to create your workspace:
docker compose up -d
Docker will download the AFFINE app and the Postgres database. gave -d flag means it will run silently in the background.

Step 5: Access the admin panel
Once the terminal says “start”, your private server is live!
Open your web browser and go to:
The first time you visit this page, you will need to create an admin account. This is your server’s master key.

Step 6: Configuration (Making it Yours)
There are two ways to configure your server.
Easy way: Admin panel
In your browser, go to admin/settings. You can change your server name or set up emails here.

Developer method: config file
You can make one too. config.json file within you ./config Folder
{
"$schema": "
"server": {
"name": "My Private Workspace"
}
}
Step 7: Adding the Desktop App (Optional)
You don’t need to use a browser. You can connect the official AFFINE desktop app.
Download the AFFINE desktop app.
Click the Workspace List panel in the upper left corner.
Click “Add Server” and enter.
http://localhost:3010.Log in with your account.


Step 8: Stop the server and secure backup
You should safely turn off your server before backing up your notes.
To do this, run this command:
docker compose down
Once it stops, you can safely copy your entire file. affine folder in a safe place.
Step 9: How to upgrade later
When AFFINE releases a new version, run these commands inside it. affine Folder:
- Download the latest blueprint:
wget -O docker-compose.yml
- Take new photos and start over:
docker compose pull
docker compose up -d
Common installation errors and troubleshooting
1. Docker is not running.
2. Docker is not connected to WSL.
- Accuracy: In Docker Desktop, go to Settings > Resources > WSL Integration And turn it on for your distro.
3. The port is already in use.
- Accuracy: open
docker-compose.yml. Change"3010:3010"To"4000:3010". Now you will visit.localhost:4000.
4. Denial of Permission
- Accuracy: If you cannot delete the folder, use the sudo command:
sudo rm -rf affine/.
The result
In this tutorial, you have successfully created a self-hosted, private workspace. You practiced using WSL, Docker Compose, and Postgres. These are valuable skills for any developer.
Your next steps:
Make a note in AFFINE of what you learned.
Shut down your server (
docker compose down) and copy your folder to the backup drive.If you want to access your server from your phone, explore Cloudflare Tunnels!
Self-hosting takes a bit of work, but the privacy is worth it.
Let’s connect! You can find my latest work on my Technical writing portfolio Or contact me. LinkedIn.
