---
title: "Deploy Directus 12 Headless CMS (Postgres, Redis, S3)"
description: "Headless CMS and data platform: REST and GraphQL APIs, Studio, S3 files."
category: "CMS"
url: https://railway.com/deploy/directus-12-headless-cms-postgres-redis-
---

# Deploy Directus 12 Headless CMS (Postgres, Redis, S3)

Headless CMS and data platform: REST and GraphQL APIs, Studio, S3 files.

**[Deploy Directus 12 Headless CMS (Postgres, Redis, S3) on Railway](https://railway.com/template/directus-12-headless-cms-postgres-redis-)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/directus-12-headless-cms-postgres-redis-/manifest.json

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

## Template content

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2.11@sha256:b0b01167ff47bc3868e56a967895a26be4230891a1f42a78ab61cdd227accc8d
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### Directus https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/directus.svg

- **Source:** baranberkay96/directus-railway
- **Health check:** /server/ping
- **Public domain:** Yes

### Postgres https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/postgresql.svg

- **Image:** postgis/postgis:18-3.7@sha256:c5d1ba4292ff7b4471ff41cd515c677633797b72cdd2a7bb691cadaab91f1a1f

## Buckets

- **Bucket**

## Documentation

# Deploy and Host Directus with Railway

Directus turns a SQL database into REST and GraphQL APIs with a visual Studio for content, files, users and automations. This community template runs the official Directus 12 image with PostgreSQL (PostGIS), Redis and a Railway Bucket for files, a pinned version and an administrator created for you before the instance goes public.

## About Hosting Directus

Directus is a single Node.js service on top of a SQL database. In production it needs a stable `SECRET`, persistent file storage, a cache shared by replicas and a first administrator. Directus 12 lets the first visitor of a fresh instance create that administrator through its onboarding screen; this template creates it during the first start, with a generated password, before the public port opens. Uploads and installed extensions go to a Railway Bucket, so the Directus service keeps no local state: redeploys lose nothing and replicas work. Postgres includes PostGIS, so geometry fields and map layouts work.

## Common Use Cases

- Headless CMS for websites and apps built with Next.js, Nuxt, Astro, SvelteKit or mobile frameworks
- Back office and admin panel over an existing or new Postgres schema, with roles and permissions
- REST and GraphQL backend with file storage, image transformations and realtime WebSockets
- Internal data tools: dashboards (Insights), automations (Flows) and an MCP server for AI agents

## Dependencies for Directus Hosting

- Directus 12.6.1, official image `directus/directus`, pinned by digest
- PostgreSQL 18 with PostGIS 3.7 (`postgis/postgis`, pinned by digest)
- Redis 8.2 (Railway's Redis definition)
- Railway Bucket (S3-compatible) for uploads and extensions

### Deployment Dependencies

- Directus: https://directus.io
- Source and releases: https://github.com/directus/directus
- Self-hosting docs: https://directus.com/docs/self-hosting/overview
- Environment variables: https://directus.com/docs/configuration/general
- Licence: https://directus.com/license and https://directus.com/oig
- Railway Buckets: https://docs.railway.com/guides/storage-buckets

### Implementation Details

| Service | Role | Public | Storage |
|---|---|---|---|
| Directus | API, Studio, WebSockets, MCP; health `/server/ping` | Yes, port 8055 | none (files in the Bucket) |
| Postgres | Content, users, settings (PostGIS enabled) | No | Volume |
| Redis | Cache, rate limits, multi-replica sync | No | Volume |
| Bucket | Uploaded files and extensions | No | Railway Bucket |

**First login**

1. Wait until the Directus deployment is active.
2. Open `https://{your-domain}/admin` and sign in with `ADMIN_EMAIL` (default `admin@example.com`) and `ADMIN_PASSWORD` from the Directus service's Variables tab. There is no default or shared password.
3. Change the e-mail to your own under the user menu, or set `ADMIN_EMAIL` before the first deploy.

The administrator exists before the public port opens, so nobody else can complete the onboarding screen. If the start script cannot confirm that a user exists, it stops instead of serving an unclaimed instance.

**Lost admin password:** set `ADMIN_PASSWORD` (8-256 characters), set `DIRECTUS_RESET_ADMIN_PASSWORD=true`, redeploy, log in, then set it back to `false`. A password that is empty or too short never blocks the deploy: the admin is created with a random password and the log explains this reset.

**Licence (read this):** Directus is source-available under the Monospace Sustainable Core License 1.0 (MSCL), not an OSI open-source licence. Each version also becomes GPL-3.0 four years after release. In short:

- Without a licence key Directus runs on the free **Core** tier, limited to 3 seats (users with Studio access), 25 active collections, 5 active flows, 30 days of activity and revision history, no SSO and no custom permission rules. Telemetry stays on.
- Organisations under USD 5M annual revenue and 50 employees can get a free **Open Innovation Grant** key; larger organisations that need more than Core need a commercial licence.
- Offering Directus itself as a competing commercial service is not permitted.
- Enter a key under Settings > License (or set `LICENSE_KEY` on the Directus service).

This summary is not legal advice; read the licence and ask counsel if your use is unclear.

**E-mail:** password resets and invitations need a mail transport. Set `EMAIL_FROM` and `EMAIL_TRANSPORT` (`smtp`, `mailgun`, `sendgrid` or `ses`) with its `EMAIL_*` settings. Railway allows outbound SMTP only on Pro plans; on other plans use Mailgun or SendGrid (HTTP APIs).

**Custom domain:** set `PUBLIC_URL` to `https://{your-custom-domain}`.

**Resources and plans:** measured idle on Railway: Directus ~260 MiB, Postgres ~180 MiB, Redis ~25 MiB, near-zero CPU; roughly $5-7 per month idle plus Bucket storage ($0.015/GB-month). Every service fits the Trial plan (1 GB per service). Directus also started and served requests with a 0.5 GB limit (Free plan); heavy image transformations or large imports need more memory, so raise the limit if you see restarts.

**Scaling:** raise replicas on the Directus service. Files live in the Bucket and cache, locks and WebSockets are coordinated through Redis, so replicas need no extra setup. Keep the Core tier limits in mind; they count users, not replicas.

**Pinning and upgrades:** the Directus version is the `FROM` line in `services/directus/Dockerfile` (tag plus digest). Read the release notes, change both, back up Postgres, and redeploy; Directus migrates the database on start. The Postgres image is pinned in the service source; stay on PostgreSQL 18 unless you migrate the data.

### Why Deploy Directus on Railway?

Railway gives Directus a public HTTPS domain, private networking to Postgres and Redis, an S3-compatible Bucket, generated secrets and usage-based billing. Frontends in the same project can call the API privately at `http://${{Directus.RAILWAY_PRIVATE_DOMAIN}}:8055`, and upgrades are a one-line change.


## 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/directus-12-headless-cms-postgres-redis-
