Self-hosted AFFiNE lets you run the AFFiNE server stack on infrastructure you control. Use this guide when you need control over data location, domain configuration, backups, user administration, and infrastructure policy while using AFFiNE as an open-source workspace for docs, whiteboards, knowledge management, and collaboration.
If you want the fastest managed experience, try AFFiNE online or download AFFiNE from the Download Page. If you want to operate AFFiNE on your own server, start with the steps below.
| Component | Purpose | Where to learn more |
|---|---|---|
| AFFiNE server | Runs the web application, API, sync, and collaboration services. | Docker Compose |
| Postgres | Stores AFFiNE application data and is the primary database to back up. | Postgres |
| Redis | Provides cache, background task, and sync infrastructure. | Redis |
| Blob storage | Stores uploaded images, files, and other workspace blobs. | Storage |
| Configuration | Stores custom server settings and operational configuration. | Configuration |
| Reverse proxy and HTTPS | Publishes your instance under a stable, secure domain. | Domain and HTTPS |
If you do not want to maintain Postgres, Redis, backups, upgrades, HTTPS, and server health yourself, a managed AFFiNE workspace is usually the simpler option.
Before using a self-hosted AFFiNE instance with real users, make sure you have:
DB_DATA_LOCATION, UPLOAD_LOCATION, and CONFIG_LOCATION values before the first start.DB_PASSWORD before initializing Postgres.<your-affine-domain>/admin.Docker Compose is the recommended way to self-host AFFiNE because it runs the AFFiNE server, migration job, Postgres, Redis, volumes, and configuration together in a repeatable setup.
For basic usage, plan for at least 4 CPU cores, 2 GB RAM, and enough storage for the server, Postgres data, uploaded blobs, and configuration. Use more memory and storage for large documents, many collaborators, or heavy uploads.
Back up the Postgres database, uploaded blobs when using filesystem storage, and modified configuration exported from the Admin Panel. Always verify that you can restore from the backup before relying on it.