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)

Just deployed

Just deployed

Just deployed

Bucket

Bucket

Just deployed

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

Implementation Details

ServiceRolePublicStorage
DirectusAPI, Studio, WebSockets, MCP; health /server/pingYes, port 8055none (files in the Bucket)
PostgresContent, users, settings (PostGIS enabled)NoVolume
RedisCache, rate limits, multi-replica syncNoVolume
BucketUploaded files and extensionsNoRailway 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.


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
168