---
title: "Deploy AFFiNE — Open-Source Knowledge Base Software"
description: "Notion and Miro alternative: docs, whiteboards and databases, self-hosted"
category: "Other"
url: https://railway.com/deploy/affine-3
---

# Deploy AFFiNE — Open-Source Knowledge Base Software

Notion and Miro alternative: docs, whiteboards and databases, self-hosted

**[Deploy AFFiNE — Open-Source Knowledge Base Software on Railway](https://railway.com/template/affine-3)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/affine-3/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** Other

## Template content

### AFFiNE https://play-lh.googleusercontent.com/XeZpj0lZh2NnySO6Hzg0ROrWn6Ci2lSMnXuu4UvMiP2CpNTka0s1Da-aCu3Zc41rHOuQO3O6IUYbDHEYV_B4=w240-h480-rw

- **Image:** ghcr.io/toeverything/affine:0.27.4@sha256:b649f5ce2384ffdf13c23bccf81d759e15973d59d0b0058af65d895a84373099
- **Start command:** `sh -c 'mkdir -p /root/.affine/config && { [ -s /root/.affine/config/private.key ] || openssl ecparam -name prime256v1 -genkey -noout -out /root/.affine/config/private.key; } && exec node ./dist/main.js'`
- **Health check:** /info
- **Public domain:** Yes

### Redis

- **Image:** redis:8.2.11@sha256:b0b01167ff47bc3868e56a967895a26be4230891a1f42a78ab61cdd227accc8d
- **Start command:** `/bin/sh -c 'rm -rf /data/lost+found && exec docker-entrypoint.sh redis-server --requirepass "$REDIS_PASSWORD" --save 60 1 --dir /data'`

### Postgres

- **Image:** pgvector/pgvector:0.8.7-pg17@sha256:7d0a41464797aeb9862dfdc0bbf1526b82cfd324cdd8036df19e3545f4a9ccb8

## Documentation

# Deploy and Host AFFiNE on Railway

AFFiNE is an open-source workspace that combines docs, whiteboards and databases in one app, often described as an alternative to Notion and Miro. Pages can switch between a writing view and an infinite canvas. The self-hosted server keeps your workspaces, real-time collaboration and file uploads on infrastructure you control.

## About Hosting AFFiNE

This template runs the official AFFiNE server image (version 0.27.4, pinned by digest) with PostgreSQL and Redis on Railway's private network. Postgres uses the pgvector image, which AFFiNE needs for its AI embedding tables. Database migrations run as a pre-deploy command before every release, so updates apply cleanly. Uploaded files and the server's signing key live on a volume, so logins and attachments survive redeploys. The public URL is set from the Railway domain automatically. After the first deploy, open the URL and create the admin account straight away: the first person to finish setup becomes the administrator.

## Common Use Cases

* A private team wiki and knowledge base with docs, whiteboards and databases
* Project planning with kanban boards, tables and linked pages
* Replacing hosted Notion or Miro when you want your data on your own server

## Dependencies for AFFiNE Hosting

* PostgreSQL with the pgvector extension (included, `pgvector/pgvector:0.8.7-pg17`)
* Redis for caching and background job queues (included, `redis:8.2.11`)

### Deployment Dependencies

* [AFFiNE on GitHub](https://github.com/toeverything/AFFiNE)
* [AFFiNE v0.27.4 release](https://github.com/toeverything/AFFiNE/releases/tag/v0.27.4)
* [AFFiNE self-hosting docs](https://docs.affine.pro/self-host-affine)
* [pgvector](https://github.com/pgvector/pgvector)

### Implementation Details

* Health check: `GET /info` on port 3010.
* Data: `/root/.affine` (uploads and `config/private.key`), Postgres data and Redis snapshots are each on their own volume.
* Email is optional. To send invites and password-reset emails, add `MAILER_HOST`, `MAILER_PORT`, `MAILER_USER`, `MAILER_PASSWORD` and `MAILER_SENDER` to the AFFiNE service, or set SMTP in the admin panel at `/admin`.
* AI features need your own provider key, which you can add in the admin panel. Full-text search indexing is turned off (`AFFINE_INDEXER_ENABLED=false`), as in upstream's Docker Compose file, because it needs a separate search engine.
* The AFFiNE desktop app can connect to this server: add its Railway URL as a self-hosted server.

## Why Deploy AFFiNE on Railway?


Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying AFFiNE on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.



## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/affine-3
