Directus wraps any SQL database with instant REST and GraphQL APIs, plus a no-code dashboard for content management. Connect to existing tables — zero migration needed.
Why Directus?
- Any SQL database: PostgreSQL, MySQL, SQLite, MSSQL, OracleDB
- Instant API: REST + GraphQL from your existing schema
- No migration: Point at an existing database, get an API
- Dashboard: No-code admin panel for non-developers
- Auth built-in: JWT, OAuth, LDAP, SAML
- Webhooks + Flows: Automation engine
- File storage: S3, local, Azure, GCS
Docker Setup
docker run -d -p 8055:8055 \
-e SECRET=your-secret-key \
-e DB_CLIENT=pg \
-e DB_HOST=localhost \
-e DB_PORT=5432 \
-e DB_DATABASE=mydb \
-e DB_USER=postgres \
-e DB_PASSWORD=password \
-e ADMIN_EMAIL=admin@example.com \
-e ADMIN_PASSWORD=admin123 \
directus/directus
REST API: Read Items
# Get all posts
curl http://localhost:8055/items/posts \
-H 'Authorization: Bearer YOUR_TOKEN'
# Filter, sort, paginate
curl 'http://localhost:8055/items/posts?filter[status][_eq]=published&sort=-date_created&limit=10&fields=id,title,author.name'
REST API: Create Item
curl -X POST http://localhost:8055/items/posts \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"title": "My Post", "body": "Content here", "status": "draft"}'
REST API: Update Item
curl -X PATCH http://localhost:8055/items/posts/1 \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"status": "published"}'
GraphQL API
query {
posts(filter: { status: { _eq: "published" } }, sort: ["-date_created"], limit: 10) {
id
title
body
author {
name
avatar {
id
}
}
tags {
tags_id {
name
}
}
}
}
JavaScript SDK
import { createDirectus, rest, readItems, createItem } from '@directus/sdk';
const client = createDirectus('http://localhost:8055').with(rest());
// Read
const posts = await client.request(
readItems('posts', {
filter: { status: { _eq: 'published' } },
sort: ['-date_created'],
limit: 10,
})
);
// Create
const newPost = await client.request(
createItem('posts', { title: 'New Post', body: 'Content' })
);
Authentication
# Get token
curl -X POST http://localhost:8055/auth/login \
-H 'Content-Type: application/json' \
-d '{"email": "admin@example.com", "password": "admin123"}'
# Response: { "data": { "access_token": "...", "refresh_token": "..." } }
Real-World Use Case
A marketing team had a PostgreSQL database with 50 tables but no admin UI. They pointed Directus at it — in 5 minutes, they had a full REST/GraphQL API and a drag-and-drop dashboard. No code, no migration, no schema changes.
Need to automate data collection? Check out my Apify actors for ready-made scrapers, or email spinov001@gmail.com for custom solutions.
Top comments (0)