---
title: "Deploy Leafen"
description: "Notion, rebuilt as open source. Self-hosted, AGPL-3.0."
category: "CMS"
url: https://railway.com/deploy/leafen
---

# Deploy Leafen

Notion, rebuilt as open source. Self-hosted, AGPL-3.0.

**[Deploy Leafen on Railway](https://railway.com/template/leafen)**

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

- **Creator:** My Projects
- **Category:** CMS
- **Total deploys:** 1

## Template content

### leafen-org/leafen:latest

- **Image:** ghcr.io/leafen-org/leafen:latest
- **Health check:** /api/leafen/v1/health
- **Public domain:** Yes

## Documentation

# Deploy and Host Leafen on Railway

Leafen is Notion, rebuilt as open source: pages and blocks, databases with every view, relations and formulas, comments, version history and a Notion importer, with an API and MCP so the AI agent you use can work in it too. AGPL-3.0, enterprise features included.

## About Hosting Leafen

Leafen is one Go server with one data folder, so hosting it is one container and one volume. This template runs the official image (ghcr.io/leafen-org/leafen), keeps everything in a volume at /data, serves HTTP on port 8090 behind Railway's HTTPS, and checks /api/leafen/v1/health. On first start it makes a one-time setup code (LEAFEN_SETUP_CODE in the service's variables, also printed as a setup link in the deploy logs): open the public address, enter the code under "Other ways", and name the first administrator.

## Common Use Cases

- A self-hosted Notion workspace for a team that wants to hold its own data
- A private wiki, task tracker and docs space that AI agents reach through MCP
- Moving a Notion workspace out of Notion with its pages, databases and relations

## Dependencies for Leafen Hosting

- A persistent volume mounted at /data
- About 1.5 GB of memory (LEAFEN_MEMORY_LIMIT tells Leafen the plan's size)

### Implementation Details

Railway mounts the volume as root, so the template sets RAILWAY_RUN_UID=0 to let the image write to /data. LEAFEN_PUBLIC_URL comes from RAILWAY_PUBLIC_DOMAIN so links and sign-in name the public https address. Source, docs and issues: https://github.com/leafen-org/leafen

## Why Deploy Leafen 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 Leafen 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

- [Libredesk - Complete Setup](https://railway.com/deploy/libredesk-complete-setup) — Complete self-hosted omnichannel customer support desk.
- [Paperless-ngx](https://railway.com/deploy/paperless-ngx-3) — Paperless-ngx — document management with OCR and full-text search
- [Instatic CMS - Postgres](https://railway.com/deploy/instatic-cms-postgres) — Design, build and manage powerful static sites from state-of-the-art CMS

Open this page in a browser: https://railway.com/deploy/leafen
