---
title: "Deploy ApostropheCMS"
description: "Node.js CMS where editors change pages on the page itself"
category: "CMS"
url: https://railway.com/deploy/apostrophecms
---

# Deploy ApostropheCMS

Node.js CMS where editors change pages on the page itself

**[Deploy ApostropheCMS on Railway](https://railway.com/template/apostrophecms)**

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

- **Creator:** A3A
- **Category:** CMS
- **Total deploys:** 1

## Template content

### MongoDB https://cdn.simpleicons.org/mongodb/47A248.svg

- **Image:** mongo:8.0
- **Start command:** `docker-entrypoint.sh mongod --ipv6 --bind_ip ::,0.0.0.0 --setParameter diagnosticDataCollectionEnabled=false`

### apostrophe https://cdn.jsdelivr.net/gh/apostrophecms/apostrophe@main/logo.svg

- **Source:** https://github.com/gridalpha/apostrophe-railway
- **Health check:** /healthz
- **Public domain:** Yes

## Documentation

# Deploy and Host ApostropheCMS on Railway

ApostropheCMS is an open-source content management framework on Node.js, Express and MongoDB, known for in-context editing: an editor opens the live page, clicks the area they want to change, and edits it where it appears rather than in a separate admin form. Developers get a module system where a page type, widget or content type is one directory, and every content type gets a REST API automatically — so one project can serve server-rendered pages and act as a headless backend.

This template lets you deploy ApostropheCMS on Railway without assembling the pieces yourself. The `apostrophe` service builds an ApostropheCMS 4 project from a GitHub repository — the official Essentials starter kit plus a production Dockerfile — and reaches a managed `MongoDB` over the private network for pages, media records and sessions. A volume at `/app/data` holds uploads and their resized variants, the administrator is created on first boot, and the asset bundle is compiled into the image. To self-host ApostropheCMS beyond the defaults, fork `github.com/gridalpha/apostrophe-railway` and build your site there.

![Diagram of the Apostrophe and MongoDB services on Railway](https://res.cloudinary.com/rroe4rtk/image/upload/f_auto,q_auto/v1789536359/apostrophe-architecture.webp)

## Getting Started with ApostropheCMS on Railway

Set `ADMIN_PASSWORD` when you deploy — the only value the template needs — and optionally `ADMIN_USERNAME`, which defaults to `admin`. Open the generated Railway URL; the home page shows a short welcome block until you give it content. Go to `/login` and sign in. ApostropheCMS has no public registration, so this account is the only way in until you add users under **Users**.

Signed in, the admin bar appears on every page. Click **Edit** in the context bar to enter edit mode: dotted outlines mark each editable area and the round **+** handles insert a rich text, image, video or layout widget. Add an image widget and upload a file — that proves the volume is mounted and the media pipeline works, since Apostrophe writes the original plus resized copies under `/uploads/attachments/`. Press **Update** to publish the draft, use **Pages** for child pages and **Images** for the media library. Then open the public URL in a private window and confirm it renders anonymously.

![ApostropheCMS home page with rich text and an uploaded image](https://res.cloudinary.com/rroe4rtk/image/upload/f_auto,q_auto/v1789536361/apostrophe-home-page.webp)
![Editing an Apostrophe page in place with widget controls](https://res.cloudinary.com/rroe4rtk/image/upload/f_auto,q_auto/v1789536363/apostrophe-in-context-editing.webp)
![Apostrophe media library holding four uploaded images](https://res.cloudinary.com/rroe4rtk/image/upload/f_auto,q_auto/v1789536366/apostrophe-media-library.webp)
![Apostrophe page manager showing a three page site tree](https://res.cloudinary.com/rroe4rtk/image/upload/f_auto,q_auto/v1789536369/apostrophe-page-tree.webp)

## About Hosting ApostropheCMS

ApostropheCMS sits between a page builder marketers like and a framework developers can live in. Editors manipulate the real page; developers get plain JavaScript modules, Nunjucks or JSX templates, and a schema that generates the editing interface and the API from one field definition. Teams self-host it to own the content database, run the CMS beside their other infrastructure, or embed a CMS in a product they ship.

- In-context visual editing, with a draft and a published version of every document
- A page tree with nesting, reordering and per-document publish state
- A media library that resizes and crops images on upload
- Custom page types, piece types and widgets as project modules
- An automatic REST API over every content type
- Localization, and roles for admins, editors and contributors

`apostrophe` runs the Node application in cluster mode, serving the site and the admin interface on one public domain. `MongoDB` stores every document — pages, images, users and sessions — and is reachable only over the private network.

## Why Deploy ApostropheCMS on Railway

Railway removes the setup work between you and a running CMS:

- No Docker, MongoDB or volume configuration to write yourself
- Private networking between the app and its database
- Managed TLS, a public domain and custom domains
- Push to the repository and the site rebuilds and redeploys
- The first administrator is created on the first boot

## Common Use Cases

- **Marketing sites a non-technical team maintains.** Editors change copy, swap images and reorder sections on the live page without filing a ticket.
- **A headless backend for Astro or Next.** Use the REST API while keeping Apostrophe's editing experience for the writers.
- **Client work you hand over.** Build page types and widgets as modules, then give the client an interface they can use unsupervised.

## Dependencies for ApostropheCMS

- **apostrophe** — the app, built from `github.com/gridalpha/apostrophe-railway` (the `apostrophecms/starter-kit-essentials` starter plus a deployment Dockerfile) on `node:22-bookworm-slim`. Public, port 3000, volume at `/app/data`.
- **MongoDB** — Railway's managed `mongo:8.0`, holding all content and login sessions. Private only.

### Environment Variables Reference

| Variable | Description | Required |
|----------|-------------|----------|
| `ADMIN_PASSWORD` | Password for the administrator created on first boot | Yes |
| `ADMIN_USERNAME` | Login name for it, defaults to `admin` | No |
| `APOS_DB_URI` | MongoDB connection string, already wired up | Yes (pre-wired) |
| `APOS_BASE_URL` | Base URL; set it when you attach a custom domain | No |
| `APOS_SESSION_SECRET` | Signs session cookies; generated if unset | No |
| `APOS_CLUSTER_PROCESSES` | Worker processes, default `2` | No |
| `APOS_COOKIE_SECURE` | Set to `0` only if serving over plain HTTP | No |
| `PORT` | HTTP port, default `3000` | No |

### Deployment Dependencies

- Node.js 22 LTS or newer, MongoDB 8 or newer
- Source: 
- Upstream: 
- Docs: 

## Minimum Hardware Requirements for Self-Hosting ApostropheCMS

| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU | 2+ vCPU |
| RAM | 1 GB, single process | 2–4 GB, ~500 MB per cluster process |
| Storage | 1 GB for uploads | 5 GB+ depending on media |
| Runtime | Node.js 22 LTS | Node.js 22 LTS |
| Database | MongoDB 8 | MongoDB 8 with backups |

The admin interface is compiled with Vite during the image build, the memory peak; give the builder at least 2 GB. Each cluster process is a full copy of the app, so size `APOS_CLUSTER_PROCESSES` against memory, not CPU count.

## How to Self-Host ApostropheCMS Outside Railway

ApostropheCMS projects are scaffolded, not pulled as an image. These commands create one, add an administrator and run it in development:

```
npm create apostrophe@latest my-site
cd my-site
echo 'APOS_DB_URI=mongodb://localhost:27017/my-site' &gt; .env
npm install
node app @apostrophecms/user:add admin admin
npm run dev
```

For production, build the assets once and run with `NODE_ENV=production`, with MongoDB beside it in Docker:

```
docker run -d --name mongo -p 27017:27017 -v mongo-data:/data/db mongo:8.0
export APOS_DB_URI=mongodb://localhost:27017/my-site
export APOS_RELEASE_ID=$(git rev-parse --short HEAD)
npm run build
npm run serve
```

`APOS_RELEASE_ID` must match at build and run time: built assets are served from a path containing it.

## Is ApostropheCMS Free?

The ApostropheCMS core is open source under the MIT licence and free to self-host, with no user, site or page limits. Apostrophe Technologies sells licence tiers adding advanced workflow, multitenancy through Assembly and enterprise support, plus managed hosting. On Railway you pay only for the infrastructure the deployment uses.

## ApostropheCMS vs Strapi vs Payload CMS

| | ApostropheCMS | Strapi | Payload CMS |
|---|---|---|---|
| Licence | MIT | Community edition, source-available enterprise | MIT |
| Database | MongoDB, PostgreSQL, SQLite | PostgreSQL, MySQL, SQLite | PostgreSQL, MongoDB |
| Editing | In-context, on the live page | Admin forms only | Admin forms, live preview |
| Front end | Built-in templates or headless | Headless only | Headless or Next.js |

Apostrophe is the only one of the three with true in-context editing: pick it when the people editing are not developers, and a form-based headless CMS when the content is structured data an application consumes.

## FAQ

**What is ApostropheCMS?**

An open-source Node.js content management framework combining in-context visual editing with a module system and an automatic REST API for developers, on MongoDB.

**What does this Railway template deploy?**

An ApostropheCMS 4 application built from a public GitHub repository, with a volume for uploaded media, plus a managed MongoDB on the private network. The administrator is created on first boot from the variables you set.

**Why does the template include MongoDB, and where do uploads go?**

Apostrophe stores every document in MongoDB — pages, media records, users and sessions, which keeps you signed in across a redeploy. Uploads live on the volume at `/app/data`, served from `/uploads/` with the resized versions Apostrophe generates.

**Can I use ApostropheCMS as a headless CMS with Astro or Next.js?**

Yes. Every page type and piece type is exposed through a REST API automatically, and Apostrophe publishes an Astro integration that keeps in-context editing working with an external front end. Add your own types by dropping a directory under `modules/` in your fork.

**Can I run ApostropheCMS with more than one worker process?**

Yes. `APOS_CLUSTER_PROCESSES` sets how many processes the container forks; the default is 2. Each is a full copy of the app, so raise memory first.


## 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/apostrophecms
