Most headless CMS platforms force you into their data model. Directus is different: it wraps your existing SQL database and gives you an instant API + admin panel — without touching your schema.
The Key Insight
Directus does not own your data. It reads your database schema and generates:
- REST API endpoints
- GraphQL API
- Admin UI with WYSIWYG editing
- Role-based access control
- File management
- Webhooks and automation
Your database stays yours. Remove Directus, and your data is untouched.
Setup
npx create-directus-project my-project
# Choose: PostgreSQL, MySQL, SQLite, MS SQL, MariaDB, CockroachDB, or OracleDB
# Set admin email and password
# Done!
Or Docker:
services:
directus:
image: directus/directus:latest
ports:
- "8055:8055"
environment:
SECRET: "your-secret-key"
ADMIN_EMAIL: "admin@example.com"
ADMIN_PASSWORD: "password"
DB_CLIENT: "pg"
DB_HOST: "postgres"
DB_PORT: "5432"
DB_DATABASE: "directus"
DB_USER: "postgres"
DB_PASSWORD: "postgres"
REST API (Auto-Generated)
# List all articles
curl http://localhost:8055/items/articles \
-H "Authorization: Bearer TOKEN"
# Filter, sort, paginate
curl "http://localhost:8055/items/articles?filter[status][_eq]=published&sort=-date_created&limit=10"
# Deep relations
curl "http://localhost:8055/items/articles?fields=*,author.name,comments.*"
GraphQL API (Also Auto-Generated)
query {
articles(filter: { status: { _eq: "published" } }, sort: ["-date_created"]) {
id
title
content
author {
name
avatar {
id
}
}
comments {
body
user {
name
}
}
}
}
JavaScript SDK
import { createDirectus, rest, readItems, createItem } from "@directus/sdk";
const client = createDirectus("http://localhost:8055").with(rest());
// Type-safe queries
const articles = await client.request(
readItems("articles", {
fields: ["id", "title", "content", { author: ["name"] }],
filter: { status: { _eq: "published" } },
sort: ["-date_created"],
limit: 10,
})
);
// Create
const newArticle = await client.request(
createItem("articles", {
title: "New Post",
content: "Hello world",
status: "draft",
})
);
Flows (Visual Automation)
Directus has a built-in automation engine:
- Trigger: Item created in "orders" collection
- Action: Send webhook to payment processor
- Action: Send email notification
- Action: Update inventory collection
All configured visually in the admin panel.
Why Directus Over Strapi/Payload
| Feature | Strapi | Payload | Directus |
|---|---|---|---|
| Wraps existing DB | No | No | Yes |
| Database support | PostgreSQL, MySQL, SQLite | MongoDB, PostgreSQL | 7 databases |
| GraphQL | Plugin | Built-in | Built-in |
| Visual automation | No | No | Yes (Flows) |
| Self-hosted | Yes | Yes | Yes |
| Cloud option | Yes | Yes | Yes |
Need custom CMS integrations or data extraction? I build APIs and scraping tools. Email spinov001@gmail.com or check my Apify tools.
Top comments (0)