Back to articles
Technology Insight

Self-Hosting AFFiNE.pro: The Ultimate Knowledge Base and Visual Workspace Alternative to Notion and Miro on Your VPS

June 4, 2026

Introduction: The Quest for True Data Sovereignty

In the modern corporate landscape, knowledge is a company's most valuable asset. For years, businesses have relied on a fragmented ecosystem of SaaS tools to manage this capital. We use Notion for structured documents and databases, and we pivot to Miro or Mural when we need to brainstorm on an infinite whiteboard. While these proprietary platforms offer polished user experiences, they come with substantial tradeoffs: escalating subscription costs, vendor lock-in, and escalating data privacy concerns.

For organizations requiring absolute data sovereignty, strict compliance, or simply a more integrated workflow, the status quo is no longer sufficient. Enter AFFiNE.pro—a next-generation, open-source knowledge management platform that natively merges the structured, block-based writing of Notion with the freeform visual canvas of Miro. By self-hosting AFFiNE on your own Virtual Private Server (VPS), you eliminate third-party dependencies, gain total control over your intellectual property, and drastically reduce infrastructure overhead.

---

Why AFFiNE.pro Changes the Game

AFFiNE is not just another markdown editor; it represents a paradigm shift in how digital workspaces operate. Unlike traditional tools that force you to choose between text documents and visual boards, AFFiNE operates on a unique dual-mode architecture. With a single click, any document can transform into an infinite whiteboard, and vice versa.

1. The Fusion of Page Mode and Edgeless Mode

AFFiNE utilizes a block-based framework similar to Notion, allowing you to build complex pages, nested hierarchies, and structured databases. However, its true power lies in its Edgeless Mode. In this layout, your document becomes an open canvas where you can draw shapes, connect ideas, create mind maps, and arrange text blocks freely. This seamless transition bridges the gap between structured documentation and creative brainstorming.

2. Data Ownership and Local-First Architecture

Built with a local-first philosophy, AFFiNE ensures that data is stored and processed locally on the client side before synchronizing. When self-hosted on your VPS, you control the synchronization server. Your proprietary strategies, internal wikis, and customer data never touch third-party cloud infrastructure, making it an ideal choice for businesses navigating strict compliance frameworks like GDPR or HIPAA.

3. Cost Efficiency at Scale

SaaS licensing models charge per user, per month. As your organization grows, these recurring fees scale linearly. By shifting to a self-hosted AFFiNE instance on a standard VPS, your infrastructure costs remain predictable and flat, regardless of whether you have ten users or a hundred.

---

Prerequisites for VPS Deployment

Before initiating the installation process, ensure your infrastructure meets the following baseline requirements to guarantee optimal performance and security:

  • Virtual Private Server (VPS): A minimum of 2 vCPUs, 4GB RAM, and 40GB SSD storage (Ubuntu 22.04 LTS or 24.04 LTS recommended).
  • Domain Name: A dedicated domain or subdomain (e.g., affine.yourcompany.com) with A/AAAA records pointed to your VPS IP address.
  • Docker Infrastructure: Docker Engine (v20.10+) and Docker Compose (v2.0+) installed on the host machine.
  • Network Accessibility: Ports 80 and 443 open on your system firewall (UFW) to handle secure HTTP/HTTPS traffic.
---

Step-by-Step Deployment Guide via Docker Compose

Deploying AFFiNE via Docker Compose is the most reliable, maintainable method for production environments. It encapsulates the application logic, databases, and reverse proxy into isolated, easily updated containers.

Step 1: System Preparation

Connect to your VPS via SSH and update the core system packages to their latest stable releases:

sudo apt update && sudo apt upgrade -y

Create a dedicated directory to house your AFFiNE configuration files and navigate into it:

mkdir -p /opt/affine && cd /opt/affine

Step 2: Configuring the Docker Compose Environment

Create a file named docker-compose.yml using your preferred text editor. This configuration provisions the core AFFiNE container alongside a PostgreSQL database for robust data persistence:

version: '3.8'

services:
  postgres:
    image: postgres:16-alpine
    container_name: affine_db
    environment:
      POSTGRES_USER: affine_admin
      POSTGRES_PASSWORD: StrongSecurePassword123!
      POSTGRES_DB: affine_prod
    volumes:
      - pg_data:/var/lib/postgresql/data
    restart: always
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U affine_admin -d affine_prod"]
      interval: 10s
      timeout: 5s
      retries: 5

  affine:
    image: ghcr.io/toeverything/affine-graphql:stable
    container_name: affine_app
    environment:
      - NODE_ENV=production
      - AFFINE_SERVER_HOST=0.0.0.0
      - AFFINE_SERVER_PORT=3010
      - DATABASE_URL=postgresql://affine_admin:StrongSecurePassword123!@postgres:5432/affine_prod
      # Replace with your actual domain
      - AFFINE_SERVER_EXTERNAL_URL=[https://affine.yourcompany.com](https://affine.yourcompany.com)
    ports:
      - "3010:3010"
    depends_on:
      postgres:
        condition: service_healthy
    volumes:
      - affine_data:/root/.affine
    restart: always

volumes:
  pg_data:
  affine_data:

Step 3: Launching the Services

With the configuration file established, pull the official container images and launch the infrastructure in detached mode:

sudo docker compose up -d

Verify that both containers are running optimally by inspecting the process status:

sudo docker compose ps
---

Securing Production with Nginx and SSL

Exposing raw application ports directly to the internet poses a security risk. To safeguard corporate communications, we implement Nginx as a reverse proxy coupled with an SSL/TLS certificate from Let's Encrypt to enforce HTTPS encryption.

1. Install Nginx

Install the web server natively on the host OS:

sudo apt install nginx -y

2. Configure the Reverse Proxy

Create an Nginx server block configuration for your domain at /etc/nginx/sites-available/affine:

server {
    listen 80;
    server_name affine.yourcompany.com;

    location / {
        proxy_pass [http://127.0.0.1:3010](http://127.0.0.1:3010);
        proxy_set_header Host $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;

        # WebSockets support for real-time collaboration
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
    }
}

Enable the site configuration by creating a symbolic link and restart Nginx:

sudo ln -s /etc/nginx/sites-available/affine /etc/nginx/sites-enabled/
sudo systemctl restart nginx

3. Provision SSL Certificates via Certbot

Automate the generation and renewal of your SSL certificates using Certbot:

sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d affine.yourcompany.com

Follow the interactive prompts to complete the setup. Certbot will automatically rewrite your Nginx configuration to enforce secure HTTPS connections globally.

---

Strategic Long-Term Maintenance

Self-hosting is a commitment that requires consistent operational maintenance to prevent data loss and ensure system resilience.

  1. Automated Backups: Schedule nightly cron jobs to dump your PostgreSQL database records and archive the affine_data storage volumes to a secure off-site location or object storage.
  2. Routine Updates: Periodically pull the latest Docker image tags to benefit from safety patches and performance optimizations. Execute docker compose pull && docker compose up -d during low-traffic maintenance windows.
  3. Performance Monitoring: Utilize tools like Prometheus and Grafana, or basic Linux monitoring utilities, to track memory and CPU allocation on your host machine as your organizational knowledge base scales.
---

Conclusion: A Sovereign Infrastructure for Modern Teams

By migrating your corporate knowledge base to a self-hosted instance of AFFiNE.pro, you break free from the constraints of rigid SaaS platforms. You effectively replace the database structuring capabilities of Notion and the dynamic visual ideation of Miro with a unified, local-first solution that runs entirely under your own supervision. This migration not only minimizes long-term operational costs but fundamentally secures your organization's intellectual property, laying a resilient foundation for long-term collaborative growth.