Self-host Directus
Instant REST and GraphQL APIs plus a customizable admin app layered over any SQL database — a data platform for turning an existing or new database into a headless CMS/backend.
Key facts
Pick Directus when you already have (or want) a plain SQL database and need instant REST/GraphQL APIs plus an admin app layered over it, rather than a new opinionated data store. It's the lightest-touch option here (512 MB, difficulty 2) if your data model is relational and you don't need Supabase's or Nhost's bundled auth-and-realtime stack.
What you need
- Any VPS with at least 512 MB of RAM
- A domain you control — most self-hosted setups need HTTPS in front of them
- Under an hour if you've used Docker before
Install with Docker Compose
Save this as compose.yml and run docker compose up -d:
# Directus — official image with a Postgres backend
services:
database:
image: postgis/postgis:16-master
environment:
POSTGRES_USER: directus
POSTGRES_PASSWORD: changeme
POSTGRES_DB: directus
volumes: ["./data/database:/var/lib/postgresql/data"]
healthcheck:
test: ["CMD", "pg_isready", "-U", "directus"]
interval: 10s
timeout: 5s
retries: 5
directus:
image: directus/directus:latest
ports: ["8055:8055"]
volumes: ["./uploads:/directus/uploads"]
depends_on:
database:
condition: service_healthy
environment:
SECRET: replace-with-a-long-random-value
ADMIN_EMAIL: admin@example.com
ADMIN_PASSWORD: changeme
DB_CLIENT: pg
DB_HOST: database
DB_PORT: 5432
DB_DATABASE: directus
DB_USER: directus
DB_PASSWORD: changeme
# docker compose up -d → http://SERVER_IP:8055What you take on
Directus is easy to run, but its licence is the first thing to get right before you build on it: