AFFiNE: A Self-Hosted Alternative to Notion and Miro
Notion is powerful, but it holds your data hostage. Every document, database, and workspace lives on Notion's servers. If they change pricing, shut down, or get acquired, you lose access to your knowledge base. Several self-hosted alternatives exist -- Outline for documents, BookStack for wikis, AppFlowy for Notion-like pages -- but none of them combine documents, whiteboards, and databases in a single unified workspace the way Notion does.
Photo by Dan Taylor on Unsplash
AFFiNE is the closest thing to a self-hosted Notion that actually delivers on the promise. It combines a block-based document editor, an infinite whiteboard canvas (similar to Miro or Excalidraw), and structured databases in one application. Everything syncs in real-time, works offline with local-first storage, and can be self-hosted on your own infrastructure.

What AFFiNE Does
AFFiNE operates in three modes that blend together seamlessly:
Page Mode (Documents)
A block-based editor similar to Notion. You get the familiar slash-command interface for inserting content blocks:
- Rich text with markdown shortcuts
- Code blocks with syntax highlighting
- Embeds (images, videos, bookmarks)
- Toggle lists and callout blocks
- Table of contents
- Linked references between pages
Edgeless Mode (Whiteboard)
Switch any page to an infinite canvas where you can:
- Freely arrange text blocks, shapes, and connectors
- Draw freehand with pen tools
- Create mind maps and flowcharts
- Mix document content with visual elements
- Use frames to organize sections of the canvas
This is what separates AFFiNE from most Notion alternatives. The whiteboard is not a separate tool bolted on -- it is a different view of the same content. A document block can exist on a page and on a canvas simultaneously.
Database Mode
Structured data with multiple views:
- Table view (spreadsheet-like)
- Kanban board view
- List view
Databases can reference other pages, creating the same kind of relational structure that makes Notion's databases powerful.
Self-Hosting With Docker Compose
AFFiNE's self-hosted edition requires a PostgreSQL database and Redis for real-time collaboration.
services:
affine:
image: ghcr.io/toeverything/affine-graphql:stable
container_name: affine
ports:
- "3010:3010"
- "5555:5555"
environment:
NODE_ENV: production
AFFINE_SERVER_HOST: "0.0.0.0"
AFFINE_SERVER_PORT: "3010"
AFFINE_SERVER_EXTERNAL_URL: "https://affine.example.com"
# Database
DATABASE_URL: "postgresql://affine:${AFFINE_DB_PASSWORD}@affine-db:5432/affine"
# Redis
REDIS_SERVER_HOST: "affine-redis"
REDIS_SERVER_PORT: "6379"
# Storage
AFFINE_SERVER_STORAGE_PROVIDER: "fs"
# Auth
AFFINE_SERVER_MAILER_HOST: "smtp.example.com"
AFFINE_SERVER_MAILER_PORT: "587"
AFFINE_SERVER_MAILER_USERNAME: "[email protected]"
AFFINE_SERVER_MAILER_PASSWORD: "${SMTP_PASSWORD}"
AFFINE_SERVER_MAILER_SENDER: "[email protected]"
volumes:
- affine_config:/root/.affine/config
- affine_storage:/root/.affine/storage
depends_on:
affine-db:
condition: service_healthy
affine-redis:
condition: service_started
restart: unless-stopped
affine-db:
image: postgres:16-alpine
environment:
POSTGRES_DB: affine
POSTGRES_USER: affine
POSTGRES_PASSWORD: "${AFFINE_DB_PASSWORD}"
volumes:
- affine_db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U affine"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
affine-redis:
image: redis:7-alpine
volumes:
- affine_redis_data:/data
restart: unless-stopped
volumes:
affine_config:
affine_storage:
affine_db_data:
affine_redis_data:
Initial Setup
# Start the stack
docker compose up -d
# Run database migrations
docker exec affine sh -c "node ./scripts/self-host-predeploy.js"
# Restart after migrations
docker compose restart affine
Navigate to https://affine.example.com and create your account. The first account registered becomes the admin.
Reverse Proxy Configuration
AFFiNE uses WebSocket connections for real-time collaboration. Make sure your reverse proxy passes them through:
# Caddy
affine.example.com {
reverse_proxy affine:3010
}
# Nginx
server {
server_name affine.example.com;
location / {
proxy_pass http://affine:3010;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
AFFiNE vs Notion: Feature Comparison
| Feature | AFFiNE (Self-Hosted) | Notion |
|---|---|---|
| Block editor | Yes | Yes |
| Databases | Yes (basic) | Yes (advanced) |
| Whiteboard/canvas | Yes (built-in) | No (separate product) |
| Real-time collab | Yes | Yes |
| Offline support | Yes (local-first) | Partial |
| API | GraphQL | REST API |
| Integrations | Limited | Extensive |
| Templates | Growing library | Massive library |
| AI features | Optional (connect your own) | Built-in (paid) |
| Self-hosted | Yes | No |
| Data ownership | Full | Notion Inc. |
| Mobile apps | iOS and Android | iOS and Android |
| Pricing | Free (self-hosted) | Free tier / $8-10/user/mo |
Where AFFiNE Wins
Whiteboard integration is AFFiNE's strongest differentiator. Being able to switch between document and canvas view of the same content, or mix both on one page, is something Notion cannot do at all. If your workflow involves visual thinking -- mind maps, architecture diagrams, brainstorming -- AFFiNE is substantially better.
Local-first architecture means your content is available offline and syncs when you reconnect. Notion's offline support is limited to cached pages; AFFiNE stores the full workspace locally.
Data ownership is complete. Self-hosted AFFiNE means your documents never leave your server.
Where Notion Wins
Database maturity: Notion's databases are more powerful with advanced formulas, relations, rollups, and sophisticated views. AFFiNE's databases work but lack the depth.
Integration ecosystem: Notion connects to hundreds of tools. AFFiNE's integration story is still developing.
Template library: Notion has thousands of community templates. AFFiNE's template selection is growing but much smaller.
Stability: Notion is a mature, well-funded product. AFFiNE is younger and still evolving. Expect some rough edges in the self-hosted version.
Like what you're reading? Subscribe to Self-Hosted Weekly — free weekly guides in your inbox.
Daily Usage Tips
Keyboard Shortcuts
AFFiNE uses familiar shortcuts that Notion users will recognize:
/-- slash command to insert blocksCtrl+K-- quick search across all pagesCtrl+Shift+E-- toggle between page and edgeless modeCtrl+D-- duplicate blockCtrl+/-- toggle sidebar
Organizing Your Workspace
Use workspaces to separate concerns (personal vs work, project A vs project B). Each workspace has its own page tree and can be shared independently.
Use tags and favorites for cross-cutting organization. The page tree handles hierarchy; tags handle categorization.
Backing Up Your Data
The self-hosted data lives in PostgreSQL and the file storage volume. Back up both:
# Database backup
docker exec affine-db pg_dump -U affine affine > affine_backup.sql
# File storage (blobs, attachments)
docker cp affine:/root/.affine/storage ./affine-storage-backup
Automate this with a cron job. Database dumps are small; file storage grows with attachments and images.
Current Limitations
AFFiNE is actively developed and improving, but has limitations compared to Notion:
- Database formulas are less powerful than Notion's
- API documentation for self-hosted is limited
- Third-party integrations are sparse
- Performance with very large workspaces (thousands of pages) can degrade
- Self-hosted updates sometimes require manual migration steps
These are being addressed in active development. The project has significant backing and a regular release cadence.
The Bottom Line
AFFiNE is the most promising self-hosted Notion alternative available today. The combination of block-based documents, an integrated whiteboard canvas, and structured databases in a single local-first application fills a gap no other self-hosted tool covers. It is not yet at feature parity with Notion -- databases need more work, and the integration ecosystem is immature. But for teams that want data ownership, offline support, and the whiteboard capability that Notion lacks entirely, AFFiNE is worth deploying. Start with a small team or personal workspace, get comfortable with the workflow, and expand as the product matures.
