Deploy Strapi

Strapi 5 with Postgres, admin created at deploy, uploads on a volume

Deploy Strapi

Deploy and Host Strapi on Railway

Strapi is an open-source headless CMS. You define content types, editors fill them in an admin panel, and your website or app reads them through a REST or GraphQL API.

This template runs Strapi 5.55.1 with Postgres, the first admin created at deploy and uploads on a volume.

About Hosting Strapi

A new Strapi asks whoever opens /admin first to register the admin account, so a fresh deploy on a public URL can be claimed by someone else before you get there. Here Strapi creates the admin from STRAPI_ADMIN_EMAIL (you enter it when deploying) and STRAPI_ADMIN_PASSWORD (generated) before it starts listening, and the admin registration refuses anyone else.

Railway serves your app over HTTPS through a proxy. Strapi 5.55 only trusts the proxy's headers when server.proxy.koa is set; the plain proxy: true that older guides use is ignored. The config here sets proxy.koa, so Strapi knows requests are secure and marks the admin session cookie as secure.

Strapi runs in production mode, where the Content-Type Builder is read-only, because content types are code files in the project. To add your own, copy the project folder into your own repo, run npm run develop locally, build the types in the admin panel, commit, and point the Strapi service at your repo. The steps are in the project's README. Content, users and API tokens live in Postgres and uploaded files on the volume, so they stay when you switch the source.

Strapi's end-user sign-up (/api/auth/local/register, for your app's users, not the admin panel) is on by default, as in any Strapi. If your app doesn't use it, turn it off in Settings > Users & Permissions plugin > Advanced settings.

Before publishing I tested it on Railway. The admin already existed at the first request, a stranger's attempt to register the first admin was refused, and the admin signed in with a secure session cookie and the Super Admin role. A full-access API token uploaded a file, which was then served from /uploads, and created an end user through the content API. After restarting Strapi and Postgres the admin signed in again, the file was served with the same content and the user was still there.

Idle, Strapi used 0.16 GB of RAM and Postgres about 0.1 GB, around $3 a month on Railway's usage pricing.

Common Use Cases

  • Content backend for a Next.js, Nuxt, Astro or mobile app, edited by people who don't write code
  • Blog, docs or marketing pages managed in an admin panel and published through the API
  • A small catalog or structured data store with roles, API tokens and media uploads

Dependencies for Strapi Hosting

Nothing beyond the template. To add content types you need Node.js 20 or newer on your computer and a Git repository of your own.

Deployment Dependencies

Implementation Details

STRAPI_ADMIN_URL                            # open this and sign in
STRAPI_ADMIN_EMAIL / STRAPI_ADMIN_PASSWORD  # the first admin (password generated)
PUBLIC_URL                                  # change it when you add a custom domain
curl -H "Authorization: Bearer " "$PUBLIC_URL/api/upload/files"

Create API tokens in Settings > API Tokens.

Why Deploy Strapi on Railway?

Strapi and Postgres run side by side on Railway's private network and uploads stay on a volume, so you get a working CMS on HTTPS in one deploy. The tradeoff is production mode: schema changes go through Git, while content editing happens in the admin panel.


Template Content

More templates in this category

View Template
Libredesk - Complete Setup
Complete self-hosted omnichannel customer support desk.

codestorm
2
View Template
Paperless-ngx
Paperless-ngx — document management with OCR and full-text search

INAPP
1
View Template
Instatic CMS - Postgres
Design, build and manage powerful static sites from state-of-the-art CMS

Instatic
167