Directus is a free, open-source headless CMS that wraps any SQL database with a real-time API and a beautiful admin dashboard.
What Is Directus?
Directus is not your typical CMS. Instead of forcing you into a predefined schema, it connects to YOUR existing SQL database and instantly generates REST and GraphQL APIs.
Why developers choose it:
- Connects to existing PostgreSQL, MySQL, SQLite, MS SQL, MariaDB, CockroachDB
- Auto-generates REST + GraphQL APIs
- Beautiful admin app for content editors
- Role-based access control
- File management with transformations
- Webhooks and automation flows
- Self-hostable or cloud-hosted
- 100% open source (no vendor lock-in)
Quick Start
Docker
docker run -d \
-p 8055:8055 \
-e SECRET=your-secret-key \
-e DB_CLIENT=sqlite3 \
-e DB_FILENAME=/directus/database/data.db \
-e ADMIN_EMAIL=admin@example.com \
-e ADMIN_PASSWORD=admin123 \
directus/directus
Open http://localhost:8055. Full CMS ready.
npm
npx create-directus-project my-project
cd my-project
npx directus start
The API You Get
Directus auto-generates APIs for all your tables:
REST
# Get all blog posts
curl http://localhost:8055/items/posts \
-H "Authorization: Bearer YOUR_TOKEN"
# Create a post
curl -X POST http://localhost:8055/items/posts \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"title": "My Post", "content": "Hello world", "status": "published"}'
GraphQL
query {
posts(filter: { status: { _eq: "published" } }, sort: ["-date_created"]) {
id
title
content
author {
first_name
avatar {
id
}
}
}
}
JavaScript SDK
import { createDirectus, rest, readItems } from "@directus/sdk";
const client = createDirectus("http://localhost:8055").with(rest());
const posts = await client.request(readItems("posts", {
filter: { status: { _eq: "published" } },
sort: ["-date_created"],
fields: ["id", "title", "content", "author.first_name"]
}));
Admin Dashboard
The admin app includes:
- Content editor: Rich text, markdown, WYSIWYG, code
- File manager: Upload, crop, transform images
- User management: Roles, permissions, SSO
- Data studio: Custom dashboards and analytics
- Flows: Visual automation builder (like Zapier)
Content editors get a beautiful UI. Developers get clean APIs. Everyone's happy.
Directus vs Alternatives
| Feature | Strapi | Contentful | Directus |
|---|---|---|---|
| Database | Own DB | Proprietary | YOUR existing DB |
| API | REST | REST + GraphQL | REST + GraphQL |
| Open source | Yes | No | Yes |
| Self-host | Yes | No | Yes |
| Existing DB | No | No | Yes |
| Admin UI | Basic | Good | Excellent |
| Free tier | Self-host | 1 space | Self-host |
| Vendor lock-in | Some | High | None |
Real-Time Updates
// Subscribe to changes
const subscription = await client.subscribe("posts", {
event: "create",
query: { fields: ["id", "title"] }
});
for await (const message of subscription) {
console.log("New post:", message.data);
}
Flows (Visual Automation)
Build automations without code:
- Trigger: New item created → Send email notification
- Trigger: Item updated → Call webhook → Update external service
- Trigger: Scheduled → Generate report → Save to files
Who Uses Directus?
With 29K+ GitHub stars:
- Companies with existing databases needing an admin UI
- Developers building headless CMS-powered sites
- Teams needing both API and visual content management
- Organizations avoiding vendor lock-in
Get Started
- Run Docker container or use npm
- Connect to your database (or start fresh with SQLite)
- Create collections in the admin UI
- Use REST or GraphQL APIs in your app
Your database. Your API. Your rules.
Building a CMS-powered site with external data? Check out my web scraping tools on Apify — feed your CMS with fresh data from any website. Custom scrapers: spinov001@gmail.com
Top comments (0)