AFFiNE Workspace
Next-gen knowledge base combining docs, whiteboards, and databases.
[i]Overview
AFFiNE is an open-source, next-generation knowledge management platform that combines the functionality of Notion, Miro, and Airtable into a single unified workspace. Built with a local-first approach, AFFiNE allows users to create and organize documents, whiteboards, and databases while maintaining complete control over their data. The platform features block-based editing, real-time collaboration, and the ability to seamlessly switch between different content types within the same workspace.
This Docker deployment sets up a complete AFFiNE workspace environment using three essential services: the main AFFiNE GraphQL server for the application logic and user interface, a PostgreSQL database for persistent data storage and complex relational queries, and Redis for high-performance caching and session management. The AFFiNE container serves the web interface on port 3010 and handles all workspace operations, while PostgreSQL manages structured data integrity and Redis provides fast access to frequently used information and real-time features.
This configuration is ideal for teams and organizations seeking a self-hosted alternative to proprietary productivity suites, developers wanting full control over their knowledge base infrastructure, and privacy-conscious users who prefer to keep their intellectual property on their own servers. The combination of AFFiNE's versatile editing capabilities with PostgreSQL's robust data management and Redis's performance optimization creates a powerful foundation for collaborative knowledge work.
[*]Key Features
- [+]Block-based editor supporting rich text, tables, databases, and whiteboard elements in unified documents
- [+]Real-time collaborative editing with conflict resolution and live cursor tracking
- [+]Dual-mode interface allowing seamless switching between page and whiteboard views
- [+]Local-first architecture with automatic synchronization and offline capability
- [+]Advanced database views with filtering, sorting, and multiple display formats (table, kanban, calendar)
- [+]Template system for creating reusable document and workspace structures
- [+]Full-text search across all content types including text, database entries, and whiteboard objects
- [+]Version history and change tracking for all workspace content
[#]Common Use Cases
- [1]Team knowledge bases combining technical documentation with visual brainstorming boards
- [2]Project management workflows using database views for task tracking and whiteboards for planning
- [3]Educational content creation with interactive lessons combining text, diagrams, and structured data
- [4]Personal productivity systems integrating note-taking, task management, and creative thinking
- [5]Software development teams managing requirements, architecture diagrams, and project documentation
- [6]Research organizations organizing literature reviews, data collection, and collaborative analysis
- [7]Small business operations managing processes, customer information, and strategic planning
[!]Prerequisites
- [!]Docker and Docker Compose installed with minimum 2GB RAM available for all services
- [!]Port 3010 available for AFFiNE web interface access
- [!]At least 5GB free disk space for PostgreSQL data, Redis cache, and AFFiNE configuration storage
- [!]DB_PASSWORD environment variable configured for PostgreSQL authentication
- [!]Basic understanding of workspace and collaboration tool concepts
- [!]Web browser with JavaScript enabled for accessing the AFFiNE interface
[!]
WARNING: For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
[$]docker-compose.yml
[docker-compose.yml]
1services: 2 affine: 3 image: ghcr.io/toeverything/affine-graphql:stable4 container_name: affine5 environment: 6 - NODE_ENV=production7 - AFFINE_CONFIG_PATH=/root/.affine/config8 - REDIS_SERVER_HOST=redis9 - DATABASE_URL=postgres://affine:${DB_PASSWORD}@db:5432/affine10 - NODE_OPTIONS="--import=./scripts/register.js"11 - AFFINE_SERVER_HOST=0.0.0.012 - AFFINE_SERVER_PORT=301013 volumes: 14 - affine-config:/root/.affine/config15 - affine-data:/root/.affine/storage16 ports: 17 - "3010:3010"18 depends_on: 19 - db20 - redis21 networks: 22 - affine-network23 restart: unless-stopped2425 db: 26 image: postgres:15-alpine27 container_name: affine-db28 environment: 29 - POSTGRES_USER=affine30 - POSTGRES_PASSWORD=${DB_PASSWORD}31 - POSTGRES_DB=affine32 volumes: 33 - postgres-data:/var/lib/postgresql/data34 networks: 35 - affine-network36 restart: unless-stopped3738 redis: 39 image: redis:7-alpine40 container_name: affine-redis41 volumes: 42 - redis-data:/data43 networks: 44 - affine-network45 restart: unless-stopped4647volumes: 48 affine-config: 49 affine-data: 50 postgres-data: 51 redis-data: 5253networks: 54 affine-network: 55 driver: bridge[$].env Template
[.env]
1# AFFiNE2DB_PASSWORD=secure_affine_password[i]Usage Notes
- [1]Web UI at http://localhost:3010
- [2]Combines docs, whiteboards, databases
- [3]Local-first with sync support
- [4]Notion/Miro alternative
- [5]Block-based editing
Individual Services(3 services)
Copy individual services to mix and match with your existing compose files.
affine
affine:
image: ghcr.io/toeverything/affine-graphql:stable
container_name: affine
environment:
- NODE_ENV=production
- AFFINE_CONFIG_PATH=/root/.affine/config
- REDIS_SERVER_HOST=redis
- DATABASE_URL=postgres://affine:${DB_PASSWORD}@db:5432/affine
- NODE_OPTIONS="--import=./scripts/register.js"
- AFFINE_SERVER_HOST=0.0.0.0
- AFFINE_SERVER_PORT=3010
volumes:
- affine-config:/root/.affine/config
- affine-data:/root/.affine/storage
ports:
- "3010:3010"
depends_on:
- db
- redis
networks:
- affine-network
restart: unless-stopped
db
db:
image: postgres:15-alpine
container_name: affine-db
environment:
- POSTGRES_USER=affine
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=affine
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- affine-network
restart: unless-stopped
redis
redis:
image: redis:7-alpine
container_name: affine-redis
volumes:
- redis-data:/data
networks:
- affine-network
restart: unless-stopped
[>]Quick Start
[terminal]
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 affine:5 image: ghcr.io/toeverything/affine-graphql:stable6 container_name: affine7 environment:8 - NODE_ENV=production9 - AFFINE_CONFIG_PATH=/root/.affine/config10 - REDIS_SERVER_HOST=redis11 - DATABASE_URL=postgres://affine:${DB_PASSWORD}@db:5432/affine12 - NODE_OPTIONS="--import=./scripts/register.js"13 - AFFINE_SERVER_HOST=0.0.0.014 - AFFINE_SERVER_PORT=301015 volumes:16 - affine-config:/root/.affine/config17 - affine-data:/root/.affine/storage18 ports:19 - "3010:3010"20 depends_on:21 - db22 - redis23 networks:24 - affine-network25 restart: unless-stopped2627 db:28 image: postgres:15-alpine29 container_name: affine-db30 environment:31 - POSTGRES_USER=affine32 - POSTGRES_PASSWORD=${DB_PASSWORD}33 - POSTGRES_DB=affine34 volumes:35 - postgres-data:/var/lib/postgresql/data36 networks:37 - affine-network38 restart: unless-stopped3940 redis:41 image: redis:7-alpine42 container_name: affine-redis43 volumes:44 - redis-data:/data45 networks:46 - affine-network47 restart: unless-stopped4849volumes:50 affine-config:51 affine-data:52 postgres-data:53 redis-data:5455networks:56 affine-network:57 driver: bridge58EOF5960# 2. Create the .env file61cat > .env << 'EOF'62# AFFiNE63DB_PASSWORD=secure_affine_password64EOF6566# 3. Start the services67docker compose up -d6869# 4. View logs70docker compose logs -f[>]One-Liner
Run this command to download and set up the recipe in one step:
[terminal]
1curl -fsSL https://docker.recipes/api/recipes/affine-workspace/run | bash[?]Troubleshooting
- [!]AFFiNE interface shows connection errors: Verify Redis and PostgreSQL containers are running and check DATABASE_URL environment variable format
- [!]Slow page loading and editing performance: Increase Redis memory allocation or check for Redis memory pressure warnings
- [!]Database connection failures on startup: Ensure DB_PASSWORD environment variable matches between affine and db services
- [!]Real-time collaboration features not working: Check Redis container logs for connection issues and verify REDIS_SERVER_HOST configuration
- [!]Workspace data not persisting after container restart: Verify affine-data and postgres-data volumes are properly mounted and accessible
- [!]Port 3010 access denied or connection refused: Check if port is already in use and verify AFFINE_SERVER_HOST is set to 0.0.0.0
Community Notes
Loading...
Loading notes...
## Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
## Components
affinepostgresqlredis
## Tags
#workspace#notion-alternative#affine#collaboration#knowledge-base
## Category
Productivity & CollaborationShortcuts: C CopyF FavoriteD Download