Self-Hosting AFFiNE.pro on a VPS: The Ultimate Privacy-First Knowledge Graph Alternative to Notion and Miro
Introduction: The Evolution of Knowledge Management
In the modern corporate landscape, information is a company’s most valuable asset. For years, organizations have relied on a fragmented ecosystem of SaaS tools to manage this asset. Typically, teams deploy Notion for structured documentation and wikis, alongside Miro or Mural for visual brainstorming and mind mapping. While effective, this dual-tool approach introduces significant friction, context switching, and data silos.
More critically, relying on third-party cloud providers raises severe concerns regarding data sovereignty, privacy, and long-term subscription costs. For businesses handling proprietary strategies, intellectual property, or sensitive client data, the cloud is a vulnerability. Enter AFFiNE.pro—a next-generation, open-source knowledge management platform that seamlessly unifies a structured docs workspace with an infinite digital whiteboard, built on a privacy-first, graph-oriented architecture. By self-hosting AFFiNE on your own Virtual Private Server (VPS), your organization can achieve complete data independence without sacrificing collaborative power.
---Why AFFiNE.pro is a Paradigm Shift
AFFiNE is not just another cloning project; it represents a fundamental shift in how digital workspaces operate. Traditional tools force you to choose between a page-based text editor (Notion) and a visual canvas (Miro). AFFiNE eliminates this dichotomy through its unique "All-in-One" canvas design.
The Page-to-Edgemode Metamorphosis
With a single click, any document in AFFiNE can transform from a standard, linearly structured text document into a free-form, infinite whiteboard block. This allows teams to outline a project using structured headings and tables, and immediately pivot to mind mapping, flowcharting, and visual brainstorming within the exact same workspace and data structure. There is no data migration or export required; the underlying knowledge graph simply renders the data differently.
Deep Knowledge Graph Architecture
Unlike Notion’s rigid hierarchical folder structure, AFFiNE utilizes a sophisticated knowledge graph. Concepts, blocks, pages, and media elements can be multi-linked and cross-referenced dynamically. This creates a neural network of corporate knowledge where information discovered in one project automatically contextualizes and enriches another, preventing the formation of isolated information graveyard folders.
---The Strategic Benefits of Self-Hosting on a VPS
While AFFiNE offers a managed cloud version, deploying it on a private VPS offers unparalleled advantages for enterprise and business users:
- Absolute Data Sovereignty: Your data remains entirely within your legal and physical boundaries. It is encrypted on your hardware, protecting your company from third-party data breaches, policy changes, or compliance violations (such as GDPR or HIPAA compliance challenges).
- Cost Optimization: Avoid escalating per-user monthly SaaS fees. A single, well-optimized VPS can support an entire team for a fixed, predictable infrastructure cost.
- Customization and Integration: Operating your own instance allows you to integrate AFFiNE deeply with internal databases, private LLMs, local backup routines, and custom authentication systems like OAuth2 or LDAP.
- Offline Resilience: A self-hosted local or intranet deployment ensures your team retains access to critical documentation even during major external internet outages.
System Requirements and Prerequisites
Before launching your deployment, ensure your VPS meets the following minimum specifications to guarantee smooth block rendering and collaborative performance:
Recommended Hardware Configuration for Teams (5-20 users):
- OS: Ubuntu 22.04 LTS or Ubuntu 24.04 LTS (Clean installation)
- CPU: minimum 2 vCPUs (Compute-optimized preferred)
- RAM: 4GB minimum (8GB recommended for heavy concurrent whiteboard usage)
- Storage: 40GB+ NVMe SSD (Scalable based on attachment and media needs)
Additionally, you will need a Fully Qualified Domain Name (FQDN) pointing to your VPS IP address (e.g., workspace.yourcompany.com) and standard network access over ports 80 and 443.
Step-by-Step Deployment Guide via Docker Compose
Utilizing Docker and Docker Compose is the most secure, stable, and reproducible method to host AFFiNE. Follow this systematic technical guide to launch your containerized instance.
Step 1: System Update and Docker Installation
Connect to your VPS via SSH and execute the following commands to update the system packages and install the latest Docker engine suite:
sudo apt update && sudo apt upgrade -y
sudo apt install curl iptables git -y
curl -fsSL [https://get.docker.com](https://get.docker.com) -o get-docker.sh && sudo sh get-docker.sh
Step 2: Designing the Architecture Matrix
Create a dedicated directory for your AFFiNE deployment to isolate configurations and persistent volumes:
mkdir -p /opt/affine-workspace && cd /opt/affine-workspace
Next, construct the configuration file. Create a file named docker-compose.yml using your preferred text editor (e.g., nano docker-compose.yml) and paste the optimized service stack structure below:
version: '3.8'
services:
affine:
image: ghcr.io/toeverything/affine-graphql:stable
container_name: affine_backend
environment:
- NODE_ENV=production
- AFFINE_CONFIG_PATH=/root/.affine/config
volumes:
- affine_data:/root/.affine
ports:
- "3010:3010"
restart: always
redis:
image: redis:7-alpine
container_name: affine_redis
command: redis-server --appendonly yes
volumes:
- redis_data:/data
restart: always
volumes:
affine_data:
redis_data:
Step 3: Initializing the Services
Launch the containers in detached mode to initiate pulling the images and spinning up the internal graph database engines:
sudo docker compose up -d
Verify that all services are executing flawlessly by inspecting container statuses: sudo docker compose ps.
Securing Your Workspace with Nginx and SSL
Exposing raw ports to the internet is a severe security vulnerability. To protect corporate communications, we will implement Nginx as a Reverse Proxy combined with a free TLS certificate from Let's Encrypt to enforce strict HTTPS encryption.
Step 1: Install Nginx and Certbot
sudo apt install nginx certbot python3-certbot-nginx -y
Step 2: Configure the Reverse Proxy
Create a dedicated server block configuration for AFFiNE: sudo nano /etc/nginx/sites-available/affine. Input the following configuration, replacing placeholder values with your real domain:
server {
listen 80;
server_name workspace.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 and test the configuration validity by running:
sudo ln -s /etc/nginx/sites-available/affine /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
Step 3: Deploy Automated SSL Encryption
Run Certbot to obtain and automatically install the SSL certificates, establishing an encrypted HTTPS tunnel:
sudo certbot --nginx -d workspace.yourcompany.com
Select the option to automatically redirect all HTTP traffic to HTTPS. Your self-hosted workspace is now fortified with enterprise-grade transport layer security.
---Best Practices for Enterprise Maintenance
Maintaining a self-hosted architecture requires proactive upkeep. Implement these foundational practices to guarantee high availability and data durability:
- Automated Backup Regimes: Schedule daily cron jobs to back up the
/opt/affine-workspacedirectory along with Docker volume structures. Offload these compressed backups to secure, offsite cold storage or an isolated S3-compatible object bucket. - Memory Optimization: Because digital whiteboards require extensive real-time state synchronization, regularly monitor Redis memory usage using tools like
docker statsto prevent memory exhaustion bottlenecks during peak collaboration hours. - Version Management: Do not use the
:latestimage tag blindly in production environments. Pin your deployments to stable releases (e.g.,:stable) and test updates in a staging environment before upgrading production environments to avoid database migration conflicts.
Conclusion: True Autonomy in Knowledge Management
By migrating from fragmented SaaS applications like Notion and Miro to a self-hosted instance of AFFiNE.pro, you do more than streamline your organization’s tech stack. You reassert control over your operational intelligence, protect your data lifecycle, and provide your team with an unconstrained tool designed for modern, multi-dimensional thinking. With a reliable VPS, Docker, and Nginx, your private, high-performance knowledge graph platform is ready to scale alongside your enterprise.
