---
title: "Deploy AFFiNE | (Just Updated) Notion and Miro Alternative, Admin Login Pre-Created, Sign-up Closed"
description: "AFFiNE Notion and Miro alternative, docs, whiteboards and databases"
category: "Other"
url: https://railway.com/deploy/affine-or-just-updated-notion-and-miro-a
---

# Deploy AFFiNE | (Just Updated) Notion and Miro Alternative, Admin Login Pre-Created, Sign-up Closed

AFFiNE Notion and Miro alternative, docs, whiteboards and databases

**[Deploy AFFiNE | (Just Updated) Notion and Miro Alternative, Admin Login Pre-Created, Sign-up Closed on Railway](https://railway.com/template/affine-or-just-updated-notion-and-miro-a)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/affine-or-just-updated-notion-and-miro-a/manifest.json

- **Creator:** SuperSlowSloth
- **Category:** Other

## Template content

### database

- **Image:** pgvector/pgvector:pg16@sha256:484e838076e04939d27d3e176e91c86eea96236126023be8d3059761122e579f

### cache

- **Image:** redis:8.2.1-alpine@sha256:987c376c727652f99625c7d205a1cba3cb2c53b92b0b62aade2bd48ee1593232
- **Start command:** `/bin/sh -c 'chown -R redis:redis /data && exec docker-entrypoint.sh redis-server --requirepass "$REDIS_PASSWORD" --appendonly yes --dir /data'`

### affine

- **Image:** ghcr.io/bon5co/affine-railway:0.27.4@sha256:a3ce6787839da224dda7a47fb3d184347988fe04c525bed0d162e59a30de2172
- **Health check:** /info
- **Public domain:** Yes

## Documentation

# Deploy and Host AFFiNE on Railway

**Built for an LLM agent to deploy and use.** The deploy form has no fields to fill: the administrator login and the database and Redis credentials are generated, the administrator is created at boot, and public sign-up is closed, so the first visitor to the domain cannot take the workspace over. AFFiNE is an open-source, privacy-first workspace that combines docs, whiteboards and databases in one place, an alternative to Notion and Miro.

## About Hosting AFFiNE

This template runs three services: **affine**, the official `ghcr.io/toeverything/affine` image (0.27.4) pinned by digest through a thin wrapper, with a volume at `/root/.affine` for the server's signing key and uploaded blobs; **database**, a PostgreSQL 16 instance with the pgvector extension and a volume at `/var/lib/postgresql` that holds every document, user and setting; and **cache**, a Redis 8 instance with a volume at `/data` for queues and sessions. One public domain serves the web app and the API. The healthcheck is `GET /info`.

**What the wrapper fixes.** The stock image expects its database and Redis settings as environment variables, needs a one-shot predeploy step (signing key and database migrations) before the server starts, lets the first visitor to the setup page become the administrator, and allows anyone to register. The wrapper builds the settings from plain Railway variables, binds the server to Railway's injected `PORT`, runs the predeploy step, creates the administrator from `AFFINE_ADMIN_EMAIL` and `AFFINE_ADMIN_PASSWORD`, and turns sign-up off. Once the administrator exists the first-run endpoint refuses further calls, and a sign-in for an unknown address answers `SIGN_UP_FORBIDDEN`. The administrator is created only while no user exists, so a redeploy never touches existing data.

**Using it.** Open the domain and sign in with `AFFINE_ADMIN_EMAIL` and `AFFINE_ADMIN_PASSWORD`. Add more users from the admin panel; they cannot register themselves. Run it on a plan with at least 1 GB of memory: the server idles at about 375 MB.

### Agent contract

- Public URL: `https://RAILWAY_PUBLIC_DOMAIN` (the generated domain of the `affine` service)
- Private URL: `http://affine.railway.internal:8080`
- Credentials: the variables `AFFINE_ADMIN_EMAIL` and `AFFINE_ADMIN_PASSWORD` on the `affine` service (plain text)
- Auth: `POST /api/auth/sign-in` with JSON `{"email","password"}` sets session cookies; send the cookie jar on every call to `/graphql`, the API that the web app itself uses
- Health: `GET /info` returns 200 without credentials

```bash
#!/bin/sh
# needs: RAILWAY_PUBLIC_DOMAIN, AFFINE_ADMIN_EMAIL, AFFINE_ADMIN_PASSWORD (variables of the affine service); also curl, jq.
R="https://$RAILWAY_PUBLIC_DOMAIN"; J="content-type: application/json"; JAR=$(mktemp)
n=0; until [ "$(curl -s -o /dev/null -w '%{http_code}' "$R/info")" = 200 ]; do n=$((n+1)); [ "$n" -le 90 ] || break; sleep 5; done
curl -s -o /dev/null -w "health: %{http_code}\n" "$R/info"
# a stranger cannot register: the sign-in for an unknown address answers SIGN_UP_FORBIDDEN, and the first-run endpoint refuses once the administrator exists
curl -s -o /dev/null -w "public signup: %{http_code}\n" -H "$J" -d '{"email":"stranger@example.com","callbackUrl":"/magic-link"}' "$R/api/auth/sign-in"
curl -s -o /dev/null -w "first-run takeover: %{http_code}\n" -H "$J" -d '{"email":"x@example.com","password":"stranger-twelve-chars","name":"x"}' "$R/api/setup/create-admin-user"
# sign in: the cookies set here authenticate every call after this
curl -s -o /dev/null -w "login: %{http_code}\n" -c "$JAR" -H "$J" -d "$(jq -nc --arg e "$AFFINE_ADMIN_EMAIL" --arg p "$AFFINE_ADMIN_PASSWORD" '{email:$e,password:$p}')" "$R/api/auth/sign-in"
# GraphQL answers HTTP 200 with the refusal in the body, so the read and write checks print the result or the refusal status
echo "read with session: $(curl -s -b "$JAR" -H "$J" -d '{"query":"{ currentUser { email } }"}' "$R/graphql" | jq -r '.data.currentUser.email')"
echo "read without session: $(curl -s -H "$J" -d '{"query":"{ currentUser { email } }"}' "$R/graphql" | jq -c '.data.currentUser')"
# write-auth: updateProfile renames the signed-in user; without the session the server answers 401 Unauthorized in the body
echo "write with session: $(curl -s -b "$JAR" -H "$J" -d '{"query":"mutation{ updateProfile(input:{name:\"Agent\"}){ name } }"}' "$R/graphql" | jq -r '.data.updateProfile.name')"
echo "write without key: $(curl -s -H "$J" -d '{"query":"mutation{ updateProfile(input:{name:\"Agent\"}){ name } }"}' "$R/graphql" | jq -r '.errors[0].extensions.status')"
```

Expected output against a fresh deploy:

```text
health: 200
public signup: 403
first-run takeover: 403
login: 200
read with session: admin@RAILWAY_PUBLIC_DOMAIN
read without session: null
write with session: Agent
write without key: 401
```

The refusals are the contract: a request without a session is refused (`write without key: 401`, delivered in the body of an HTTP 200 reply because that is how GraphQL reports it), a registration from a stranger is refused (`public signup: 403`), and the first-run endpoint stays shut (`first-run takeover: 403`).

## 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.

- **Agent-ready** - no deployer fields, a contract block, and one script that proves the server is healthy, a stranger cannot register or take over setup, and the generated login can read and write.
- **Sign-up closed** - the administrator is created from a generated password; nobody else can register.
- **Data survives redeploys** - documents in PostgreSQL on a volume, uploads and the signing key on a volume, queues in Redis on a volume.
- **Pinned** - the upstream image is pinned by digest and the wrapper by tag and digest.

## Common Use Cases

- **Team knowledge base** - docs, wikis and databases in one self-hosted workspace instead of a Notion subscription.
- **Whiteboards and planning** - infinite canvas for diagrams and brainstorming, an alternative to Miro.
- **A workspace for AI agents** - create and read documents through the GraphQL API with a generated login.

## Dependencies for AFFiNE Hosting

- The affine service, a PostgreSQL service with pgvector and a Redis service, each with its volume, created by the template.

### Deployment Dependencies

- [AFFiNE repository](https://github.com/toeverything/AFFiNE)
- [Wrapper image source](https://github.com/bon5co/affine-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) — Self-hosted virtual tabletop for role-playing games (license required)
- [Double Commander in your browser](https://railway.com/deploy/double-commander-in-your-browser) — The Double Commander file manager in the cloud, from any device

Open this page in a browser: https://railway.com/deploy/affine-or-just-updated-notion-and-miro-a
