---
title: "Deploy Ghost — Self-Hosted Substack Alternative, 0% Fees"
description: "Self-host Ghost: newsletters & memberships. 0% fees, unlike Substack."
category: "CMS"
url: https://railway.com/deploy/ghost-substack-alternative
---

# Deploy Ghost — Self-Hosted Substack Alternative, 0% Fees

Self-host Ghost: newsletters & memberships. 0% fees, unlike Substack.

**[Deploy Ghost — Self-Hosted Substack Alternative, 0% Fees on Railway](https://railway.com/template/ghost-substack-alternative)**

- **Creator:** SilverBanana
- **Category:** CMS

## Template content

### MySQL https://devicons.railway.app/i/mysql.svg

- **Image:** mysql:9.4
- **Start command:** `docker-entrypoint.sh mysqld --innodb-use-native-aio=0 --disable-log-bin --performance_schema=0 --innodb-buffer-pool-size=1G`

### Ghost

- **Image:** ghost:alpine

## Documentation

# Deploy and Host Ghost on Railway

Ghost is the open-source publishing platform built for writers — ~50k GitHub stars, run by a
non-profit foundation, and used by Buffer, Airtable, Kickstarter, and 404 Media. A clean,
fast, SEO-first CMS with built-in newsletters, paid memberships, and (since v6.0) ActivityPub
syndication to Mastodon and Bluesky — all in one platform. This template deploys Ghost with a
MySQL database and a persistent volume for your content and images.

**Substack takes 10% of your subscription revenue forever.** A newsletter earning $5,000/month
hands Substack $500/month — roughly $6,000/year. Ghost takes **0% platform fees**: you keep
everything but Stripe's standard processing. Self-hosted on Railway for ~$5–10/month flat, you
own your site, your subscriber list, and your payment relationships.

---

## What This Template Deploys

| Service | Purpose |
|---|---|
| **Ghost** | The publishing platform — editor, themes, membership/subscription engine, and admin at `/ghost`, on port `2368` |
| **MySQL 8** | Ghost's required production database — posts, members, subscriptions, and settings |
| **Persistent Volume** | Mounted at `/var/lib/ghost/content` — images, themes, and uploads survive every redeploy |

Both services connect over Railway's private network with credentials injected automatically.
Ghost requires MySQL 8 in production (not SQLite), and content files persist on the volume — the
correct, durable setup for Ghost on Railway.

---

## About Hosting Ghost

Ghost is a Node.js application backed by MySQL, with content (images, themes) on disk. Running it
means a persistent server, a MySQL 8 database, a content volume, a public HTTPS endpoint, and an
external email provider for newsletters. The official self-host path is Docker Compose on a VPS
plus manual database, SSL, and email wiring. This template does the database, volume, and HTTPS
parts on Railway automatically.

> **Email — the part everyone gets wrong:** self-hosted Ghost needs an external email provider,
> and **Mailgun is the only first-class option for bulk newsletter sends** as of 2026. Set your
> Mailgun API details in config to send newsletters; without it, publishing works but email
> delivery won't. Railway Hobby blocks raw SMTP, so use HTTPS-based email.

Typical cost: **~$5–10/month** on Railway for Ghost and MySQL, plus Mailgun (free to 1,000
emails/month, then usage-based) and Stripe fees. Ghost(Pro) managed hosting is $15–199/month;
Substack takes 10% of revenue. Self-hosted Ghost on Railway is flat compute with a 0% platform fee.

---

## Deploy in Under 5 Minutes

1. Click **Deploy on Railway** — Ghost and MySQL build automatically (~3–4 minutes)
2. MySQL credentials are wired automatically via Railway reference variables
3. Set `url` to your Railway public domain (Ghost needs its exact external URL, or links break)
4. Open `[your-domain]/ghost` and create your admin account and publication
5. Add your Mailgun API key in config to enable newsletters, then pick a theme and publish

No VPS provisioning. No manual MySQL setup. No SSL configuration.

---

## Common Use Cases

- **Self-hosted alternative to Substack** — keep the 10% Substack takes on paid subscriptions;
  Ghost charges 0% platform fee, so a $5k/month newsletter saves ~$6,000/year
- **Paid newsletter and membership business** — built-in Stripe memberships, tiers, and paywalls
  with no per-subscriber platform cut and full ownership of your list
- **Fast, SEO-first blog or publication** — Ghost sites are among the fastest on the web, with
  clean SEO metadata, custom themes, and proper site structure (not just a newsletter feed)
- **Own your audience off Ghost(Pro)** — run the same Ghost at flat compute instead of
  $15–199/month managed hosting, with your data and design fully in your control
- **ActivityPub publishing to the fediverse** — Ghost 6.0 syndicates your posts to Mastodon,
  Bluesky, and Threads via ActivityPub, expanding reach without giving up ownership
- **Migrate from Substack or WordPress** — Ghost's built-in importers bring posts and
  subscribers across during migration

---

## Configuration

| Variable | Required | Description |
|---|---|---|
| `url` | ✅ Required | Your Railway public domain — Ghost builds all links from this; wrong value breaks the site |
| `database__client` | ✅ Pre-set | `mysql` — Ghost's production database driver |
| `database__connection__host` | ✅ Auto-injected | MySQL host via Railway reference variable |
| `database__connection__user` | ✅ Auto-injected | MySQL user from the Railway database service |
| `database__connection__password` | ✅ Auto-injected | MySQL password via Railway reference variable |
| `database__connection__database` | ✅ Auto-injected | MySQL database name |
| `mail__options__auth__user` | Recommended | Mailgun SMTP/API user — required for newsletter sends |
| `mail__options__auth__pass` | Recommended | Mailgun API key / password |
| `NODE_ENV` | ✅ Pre-set | `production` |

> Set `url` to your exact Railway domain immediately after deploy — Ghost generates every link,
> feed, and email URL from it, so a wrong value breaks navigation and login. Configure Mailgun for
> newsletters; on Railway Hobby, use HTTPS-based email (not raw SMTP, which is blocked).

---

## Ghost vs. Publishing Platforms

| | Ghost (Railway) | Substack | Ghost(Pro) | WordPress |
|---|---|---|---|---|
| **Platform fee on revenue** | ✅ 0% | ❌ 10% | ✅ 0% | ✅ 0% |
| **$5k/mo newsletter fee/yr** | ✅ $0 | ❌ ~$6,000 | ✅ $0 | ✅ $0 |
| **Monthly cost** | ~$5–10 flat | Free (takes 10%) | $15–199/mo | Hosting cost |
| **Built-in memberships** | ✅ Yes | ✅ Yes | ✅ Yes | ⚠️ Plugin |
| **Built-in newsletters** | ✅ Via Mailgun | ✅ Yes | ✅ Yes | ⚠️ Plugin |
| **ActivityPub (fediverse)** | ✅ v6.0 | ❌ No | ✅ Yes | ⚠️ Plugin |
| **Own your list & data** | ✅ Your instance | ❌ Substack | ✅ Yes | ✅ Yes |
| **Self-hostable** | ✅ Yes | ❌ No | ❌ No | ✅ Yes |
| **Open source** | ✅ MIT | ❌ No | ✅ MIT | ✅ GPL |

---

## Dependencies for Ghost Hosting

- Railway account — Hobby plan (~$5–10/month) covers Ghost and MySQL
- A Mailgun account for newsletter sends (free to 1,000 emails/month) — the only first-class
  bulk-email option Ghost supports
- A Stripe account for paid memberships (Ghost takes 0%; you pay standard Stripe fees)

### Deployment Dependencies

- [Ghost GitHub Repository](https://github.com/TryGhost/Ghost) — source and releases
- [Ghost Documentation](https://ghost.org/docs/) — configuration and theme reference
- [Ghost Self-Hosting Config](https://ghost.org/docs/config/) — full configuration options
- [Mailgun](https://www.mailgun.com/) — newsletter email delivery

### Implementation Details

This template deploys the official Ghost image with MySQL 8 over Railway's private network and a
persistent volume at `/var/lib/ghost/content` for images, themes, and uploads. Ghost requires
MySQL 8 in production (not SQLite), and content must persist on a volume — both configured here.

Set `url` to your Railway domain immediately: Ghost bakes it into every link, feed, and email, so
a wrong value causes broken navigation and login loops. Configure Mailgun for newsletters; member
sign-in emails can use any HTTPS provider since Railway blocks raw SMTP.

---

## Frequently Asked Questions

**How much does self-hosting Ghost save versus Substack?**
Substack takes 10% of paid subscription revenue forever. A newsletter earning $5,000/month pays
Substack ~$500/month — about $6,000/year. Ghost's platform fee is 0%; you pay only ~$5–10/month
Railway compute, Mailgun for email, and standard Stripe processing. Above roughly $290/month in
subscription revenue, Ghost is cheaper than Substack, and the gap widens as you grow.

**Why does newsletter email need Mailgun specifically?**
Ghost's bulk newsletter feature is built around Mailgun's API — as of 2026 it's the only
first-class provider for newsletter sends, despite community requests for Postmark and Resend.
Transactional emails (member magic links) can use any provider. Set your Mailgun credentials in
config to send newsletters; on Railway Hobby, use HTTPS-based email since raw SMTP is blocked.

**Is Ghost a website builder?**
No — Ghost is a publishing platform (blog, newsletter, memberships), not a drag-and-drop website
builder. It has no ecommerce, no visual page designer, and Stripe is the only payment processor.
If you want a fast publication with paid subscriptions, Ghost excels; if you need an online store
or complex marketing site, pair it with other tools or choose a different platform.

**Do I lose my posts and images if Railway redeploys?**
No. Posts, members, and settings live in the Railway-managed MySQL database, and images/themes
persist on the volume at `/var/lib/ghost/content`. Redeploys and updates don't affect your data.

**Can I migrate from Substack or WordPress?**
Yes. Ghost has built-in importers for both. The Substack importer pulls posts and subscribers in
one operation; paid subscribers re-confirm payment details in Stripe during migration (Substack's
payment processor isn't portable), which causes some expected churn.

**Does Ghost support paid memberships out of the box?**
Yes — Stripe-powered memberships, tiers, and paywalls are native, with a 0% platform fee and no
plugins. You keep all subscription revenue minus Stripe's standard processing.

---

## Why Deploy and Host Ghost 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 Ghost on Railway, you get a fast, SEO-first publishing platform — newsletters, paid
memberships, custom themes, and ActivityPub syndication — backed by MySQL and persistent content
storage at ~$5–10/month flat, with a 0% platform fee and full ownership of your audience.

## Similar templates

- [Libredesk - Complete Setup](https://railway.com/deploy/libredesk-complete-setup) — [Jul'26] Complete self-hosted omnichannel customer support desk.
- [Instatic CMS - Postgres](https://railway.com/deploy/instatic-cms-postgres) — Design, build and manage powerful static sites from state-of-the-art CMS
- [Strapi](https://railway.com/deploy/strapi) — A popular self-hosted CMS

Open this page in a browser: https://railway.com/deploy/ghost-substack-alternative
