Directus 12 Headless CMS (Postgres, Redis, S3)

Directus turns a SQL database into REST and GraphQL APIs with a visual Studio for content, files, users and automations. This template runs the official Directus 12.6.1 image with PostGIS-enabled Postgres 18, Redis and a Railway Bucket, and creates the administrator before the instance goes public.

What you get

  • Directus 12.6.1 (official image, pinned by digest) with REST, GraphQL, WebSockets, Studio and an MCP server
  • PostgreSQL 18 with PostGIS 3.7 on a volume
  • Redis 8.2 for cache, rate limits and multi-replica sync
  • A Railway Bucket for uploaded files and extensions, so the Directus service keeps no local state
  • An administrator created during first start with a generated ADMIN_PASSWORD

Good for

  • A headless CMS for sites and apps built with Next.js, Nuxt, Astro, SvelteKit or mobile frameworks
  • A back office with roles and permissions over a Postgres schema
  • A REST and GraphQL backend with file storage, image transformations and realtime
  • Internal data tools using Insights dashboards, Flows automations and the MCP server

Cost

Measured idle on Railway: Directus about 260 MiB, Postgres about 180 MiB and Redis about 25 MiB, with near-zero CPU. Idle cost is driven by that RAM plus Bucket storage at $0.015 per GB-month. Directus also started and served requests under a 0.5 GB limit; heavy image transformations or large imports need more memory.

Services in this template

  • Redis · image redis:8.2.11@sha256:b0b01167ff47bc3868e56a967895a26be4230891a1f42a78ab61cdd227accc8d
  • Directus · from baranberkay96/directus-railway
  • Postgres · image postgis/postgis:18-3.7@sha256:c5d1ba4292ff7b4471ff41cd515c677633797b72cdd2a7bb691cadaab91f1a1f

Questions people ask

How do I log in?

Open https://{your-domain}/admin and sign in with ADMIN_EMAIL (default admin@example.com) and ADMIN_PASSWORD from the Directus service variables. The admin exists before the public port opens, so nobody else can complete onboarding.

What is the licence?

Directus is source-available under the Monospace Sustainable Core License 1.0, not an OSI open-source licence. Without a key it runs on the Core tier: 3 seats, 25 active collections, 5 active flows, 30 days of history, no SSO and no custom permission rules, with telemetry on. Organisations under USD 5M revenue and 50 employees can apply for a free Open Innovation Grant key; others needing more than Core need a commercial licence. This is not legal advice.

Is data persistent?

Yes. Content lives in Postgres on a volume and files live in the Railway Bucket. Redeploying the Directus service loses nothing, and replicas work without extra setup.

Can it send e-mail?

Only after you set EMAIL_FROM and EMAIL_TRANSPORT with the matching EMAIL_* settings. Railway allows outbound SMTP only on Pro; on other plans use Mailgun or SendGrid.

How do I upgrade?

The version is the FROM line in services/directus/Dockerfile (tag and digest). Read the release notes, change both, back up Postgres and redeploy; Directus migrates the database on start. Stay on PostgreSQL 18 unless you migrate the data.

Full template README

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

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.

Guides for this template

View Directus 12 Headless CMS (Postgres, Redis, S3) on railway.com

Similar templates

TemplateCategoryDeploymentsDeploys
Strapi
A popular self-hosted CMS
CMS7,676
WordPress
A content management system (CMS) written in PHP
CMS7,564
Directus
Directus [Nov '26] (Headless CMS/Strapi & Supabase Alternative) Self Host
CMS3,294
Instatic CMS - SQLite
Design, build and manage powerful static sites from state-of-the-art CMS
CMS1,395
Teable
A super fast Airtable alternative with AI agent integrated
CMS981
Strapi 5
A popular self-hosted "headless" CMS
CMS900