Usage & Enterprise Capabilities
AFFiNE is the leading open-source alternative to proprietary "everything workspaces" like Notion and Miro. It solves the fragmentation of digital tools by providing a single workspace where you can seamlessly transition between document drafting, whiteboard brainstorming, and structured database management. Every page in AFFiNE is a living canvas that can be viewed as a traditional text document, an infinite whiteboard, or a powerful database.
The platform is built on an offline-first architecture, ensuring that your work is never interrupted by a slow network connection. By using CRDTs (Conflict-free Replicated Data Types), AFFiNE delivers real-time collaboration that is both fast and resilient. Because it is fully open-source, organizations can self-host the entire stack, ensuring that their intellectual property remains entirely under their own control and sovereign.
Self-hosting AFFiNE provides teams with a world-class, multi-modal workspace that combines the best of document editing and visual collaboration while maintaining absolute data privacy.
Key Benefits
Multi-Modal Design: One page, three views (Paper, Whiteboard, Database).
Privacy First: You own the database, the server, and every byte of data.
Offline First: Work at lightning speed locally, sync whenever you're ready.
Collaboration Power: Real-time editing for teams without proprietary lock-in.
Extreme Portability: Export your work as standard Markdown or JSON at any time.
Production Architecture Overview
A production-grade AFFiNE self-hosted setup involves:
AFFiNE Server: The Node.js application backend.
PostgreSQL: The primary database for metadata and workspace organization.
Redis: Used for real-time synchronization and session management.
S3 / MinIO: Used for persistent storage of user-uploaded files and attachments.
NGINX / Caddy: A reverse proxy for SSL/TLS and load balancing.
Implementation Blueprint
Implementation Blueprint
Prerequisites
sudo apt update && sudo apt upgrade -y
sudo apt install docker.io docker-compose -y
sudo systemctl enable docker
sudo systemctl start dockerDocker Compose Production Setup
This configuration runs the core AFFiNE services with PostgreSQL and Redis.
version: '3'
services:
affine:
image: ghcr.io/toeverything/affine-graphql:latest
ports:
- "8080:8080"
environment:
- AFFINE_CONFIG_PATH=/root/.affine/config
- DATABASE_URL=postgres://affine:password@db:5432/affine
- REDIS_URL=redis://redis:6379
depends_on:
- db
- redis
volumes:
- affine_data:/root/.affine
restart: always
db:
image: postgres:15-alpine
environment:
- POSTGRES_USER=affine
- POSTGRES_PASSWORD=password
- POSTGRES_DB=affine
volumes:
- pg_data:/var/lib/postgresql/data
restart: always
redis:
image: redis:7-alpine
restart: always
volumes:
affine_data:
pg_data:Kubernetes Production Deployment (Recommended)
AFFiNE is designed for horizontal scalability and fits perfectly into Kubernetes.
# Deploy using a standard Deployment and Service
kubectl create deployment affine --image=ghcr.io/toeverything/affine-graphql:latest
kubectl expose deployment affine --port=8080Benefits:
Elastic Scalability: Scale your application pods as your team grows and your document count increases.
Reliable Persistence: Use Kubernetes PersistentVolumeClaims for your workspace data and S3 for attachments.
Zero-Downtime Updates: Deploy the latest AFFiNE features without interrupting your team's workflow.
Scaling Strategy
Object Storage: Always use a dedicated S3-compatible provider for file attachments in production environments.
Database Tuning: Regularly optimize your PostgreSQL instance for high-frequency metadata queries.
Caching: Leverage Redis for high-performance real-time synchronization states.
CDN Strategy: Serve AFFiNE's static frontend assets via a global CDN to improve loading times.
Backup & Safety
Database Dumps: Automate daily PostgreSQL backups and store them offsite securely.
Volume Snapshots: Regularly snapshot the persistent volumes containing your workspace data.
HTTPS Enforcement: Always run AFFiNE behind a secure reverse proxy to encrypt team collaboration.
Private Network: Keep your AFFiNE instance accessible only via your corporate VPN or a zero-trust network.