Railway

Deploy Strapi | Open-source Headless CMS with DB and Meilisearch

Self Host Strapi: REST & GraphQL APIs, full-text search, admin panel

Deploy Strapi | Open-source Headless CMS with DB and Meilisearch

DB & Search

/var/lib/postgresql/data

Just deployed

/meili_data

Just deployed

/public/uploads

Strapi logo

This is a content writing task — no special skill needed. Here's the full Railway template overview:


Deploy and Host Strapi

Deploy a fully configured, self-hosted Strapi instance on Railway in one click. This template provisions Strapi from the railwayapp-templates/strapi GitHub repo alongside a managed PostgreSQL database for persistent storage and Meilisearch (getmeili/meilisearch:v1.9.0) for fast full-text search — all pre-wired with internal private networking, auto-generated secrets, and zero manual configuration. Strapi railway arch


Getting Started with Strapi on Railway

After deploying, open your Railway project's public domain at /admin — e.g. https://your-app.railway.app/admin. You'll be prompted to register the first administrator account; this is your superadmin. From there, use the Content-Type Builder to define your data models, then switch to Content Manager to start adding entries. Your REST API is immediately live at /api/[content-type] and requires an API token (generated under Settings → API Tokens) for authenticated access.

Strapi dashboard screenshot


About Hosting Strapi

Strapi is an open-source, Node.js-based headless CMS that decouples content management from content delivery. It exposes your content via REST or GraphQL APIs, letting you push data to any frontend — Next.js, React Native, Vue, or IoT devices — without being locked into a templating layer.

Key features:

  • REST and GraphQL APIs out of the box
  • Customisable content types via a visual builder
  • Role-based access control (RBAC) and API token management
  • Plugin ecosystem: i18n, media library, Meilisearch, and more
  • Self-hosted or Strapi Cloud — you own your data either way

Template architecture: Strapi (port 1337) connects to Postgres over Railway's private network for persistent content storage, and to Meilisearch (port 7700) for search indexing — no public exposure of either dependency required.


Why Deploy Strapi on Railway

Running Strapi on a VPS means managing Node.js versions, PM2 process managers, Nginx reverse proxies, SSL renewals, and database backups yourself. Railway removes that entire layer:

  • Private networking — Postgres and Meilisearch communicate with Strapi over internal hostnames, never the public internet
  • Auto-generated secretsAPP_KEYS, JWT_SECRET, ENCRYPTION_KEY, and all salts are provisioned securely on deploy
  • Managed Postgres — persistent storage with connection pooling, no pg module debugging required
  • Git-based deploys — push to your fork of the GitHub repo and Railway redeploys automatically
  • Instant rollbacks — every deploy is versioned

Common Use Cases

  • Marketing and editorial sites — manage blog posts, landing pages, and structured content served to a Next.js or Astro frontend
  • eCommerce backends — model product catalogues, inventory, and personalisation data via API, delivered omnichannel
  • Mobile app content layer — serve dynamic content to iOS/Android apps without rebuilding and resubmitting for copy changes
  • Multi-tenant SaaS platforms — use RBAC and API tokens to isolate content access per customer or team

Dependencies for Strapi

  • PostgreSQL — primary relational database for all Strapi content, user, and configuration data
  • Meilisearch (getmeili/meilisearch:v1.9.0) — typo-tolerant full-text search engine, integrated via the Strapi Meilisearch plugin

Environment Variables Reference

VariableDescriptionRequired
URLPublic base URL of your Strapi appYes
APP_KEYSComma-separated session security keysYes
JWT_SECRETSecret for user authentication tokensYes
ADMIN_JWT_SECRETJWT secret for admin panel authYes
API_TOKEN_SALTSalt for API token generationYes
ENCRYPTION_KEYKey for encrypting sensitive dataYes
DATABASE_URLInternal Postgres connection stringYes
DATABASE_PUBLIC_URLExternal Postgres connection stringYes
MEILISEARCH_HOSTInternal Meilisearch endpoint URLYes
MEILISEARCH_ADMIN_API_KEYMaster key for Meilisearch admin accessYes
PORTStrapi HTTP port (default: 1337)Yes
STRAPI_TELEMETRY_DISABLEDDisable usage telemetry reportingNo

All secrets are auto-generated via Railway's secret(32) helper on first deploy.

Deployment Dependencies


Minimum Hardware Requirements for Strapi

Strapi's Node.js build process is memory-intensive. Recommended minimums for a stable self-hosted deployment:

ResourceMinimumRecommended
CPU1 vCPU2 vCPU
RAM1 GB2 GB
Storage10 GB20 GB+
Node.jsv20 LTSv22 LTS

The admin panel build (npm run build) requires at least 1 GB of RAM. Deployments on under-resourced instances will fail silently during build.


Self-Hosting Strapi Outside Railway

To run this template's stack on your own machine or VPS:

# Clone the Railway template repo
git clone https://github.com/railwayapp-templates/strapi
cd strapi

# Install dependencies
npm install

# Copy and configure environment variables
cp .env.example .env
# Edit .env with your Postgres and Meilisearch connection details

# Build the admin panel
NODE_ENV=production npm run build

# Start in production
NODE_ENV=production npm run start

For Meilisearch, run the official Docker image alongside it:

docker run -d \
  -p 7700:7700 \
  -e MEILI_MASTER_KEY=your_master_key \
  -e MEILI_ENV=production \
  -v $(pwd)/meili_data:/meili_data \
  getmeili/meilisearch:v1.9.0

Point MEILISEARCH_HOST=http://localhost:7700 and MEILISEARCH_ADMIN_API_KEY in your .env accordingly.


Strapi vs Contentful vs Sanity

StrapiContentfulSanity
Open sourceYesNoPartial
Self-hostableYesNoNo
PricingInfrastructure onlyFrom $300/moFree tier, then usage-based
DatabasePostgreSQL, MySQL, SQLiteHosted onlyHosted only
APIREST + GraphQLREST + GraphQLGROQ + REST
Plugin ecosystemCommunity pluginsMarketplace appsStudios

Strapi's primary advantage over Contentful and Sanity is full data ownership. When you self-host on Railway, you pay only for compute and storage — there are no per-seat or per-API-call fees at scale.


How Much Does Strapi Cost?

Strapi itself is free and open-source (MIT licence). Your only cost is the infrastructure you run it on — in this case, Railway's compute and storage. Strapi does offer a managed Strapi Cloud product with paid tiers starting around $29/month, and an Enterprise Edition that adds SSO, audit logs, and SLA-backed support for larger teams. For most projects, the self-hosted open-source version on Railway covers everything needed.


FAQ

What is Strapi? Strapi is a flexible, open-source headless CMS used for websites, mobile apps, and eCommerce platforms. It exposes content via REST or GraphQL APIs and offers advanced customisation, role-based access control, and robust security features including API tokens and data encryption.

What does this Railway template deploy? It deploys Strapi connected to a managed PostgreSQL database (for persistent content storage) and Meilisearch (for full-text search), all pre-configured with internal private networking and auto-generated secrets.

Why is Postgres included instead of SQLite? SQLite resets on redeploy in ephemeral environments. Postgres persists data across deployments and restarts, making it the correct choice for any production Strapi instance on Railway.

What is Meilisearch used for in this template? Meilisearch powers Strapi's search functionality via the official Meilisearch plugin. It indexes your content types and returns typo-tolerant results significantly faster than database-level LIKE queries.

Can I use this template for a production site? Yes. All secrets are auto-generated, Postgres is persistent, and Strapi runs in production mode (NODE_ENV=production). You should configure a custom domain and review RBAC settings before going live.

Does Strapi support GraphQL? Yes. Install the @strapi/plugin-graphql package and a /graphql endpoint becomes available alongside the default REST API.


Template Content

More templates in this category

View Template
Strapi
A popular self-hosted CMS

Milo
7.5K
Deploy
View Template
WordPress with Redis
Deploy WordPress with MariaDB and Redis

Noor Adn
View Template
Directus (docker/websocket/extensions) + PostGIS (docker/TCP) + S3/Local
Directus (Docker) + PostGIS (Docker/TCP) + S3

Protemplate