# Directus — Open Source Backend & Headless CMS for Any Database > Directus wraps any SQL database with instant REST & GraphQL APIs, an admin app, auth, file storage, and automation — no migration or proprietary schema needed. ## Install Save the content below to `.claude/skills/` or append to your `CLAUDE.md`: ## Quick Use ```bash npx create-directus-project@latest my-project cd my-project npx directus start ``` Open `http://localhost:8055` — login with your admin credentials and start managing your data. ## Intro **Directus** is an open-source data platform that wraps any SQL database with instant REST & GraphQL APIs, an intuitive admin app, authentication, file storage, and workflow automation. Unlike traditional CMS platforms that require a specific database schema, Directus works with your existing database — no migration needed, no proprietary tables, no vendor lock-in. With 34.7K+ GitHub stars, Directus is a unique "Database-first" platform: you design your database schema as you normally would (or connect an existing one), and Directus automatically generates APIs, admin interfaces, and access controls on top of it. ## What Directus Does Directus provides a complete backend toolkit: - **Instant APIs**: REST and GraphQL APIs auto-generated from your database schema - **Admin App**: No-code admin panel for content management, built with Vue.js - **Authentication**: Email/password, SSO (OAuth 2.0, OpenID, LDAP, SAML), and API tokens - **Access Control**: Granular role-based permissions at collection, field, and record level - **File Storage**: Asset management with transforms (resize, crop) and CDN support - **Flows (Automation)**: Visual workflow builder for triggers, conditions, and actions - **Webhooks**: Real-time notifications on data changes - **Insights**: Built-in analytics dashboard builder with charts and metrics ## Architecture ``` ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ Admin App │────▶│ Directus │────▶│ Your SQL DB │ │ (Vue.js) │ │ Server │ │ (Postgres / │ │ │ │ (Node.js) │ │ MySQL / etc)│ └──────────────┘ └──────┬───────┘ └──────────────┘ │ │ Your Frontend │───▶ REST / GraphQL API │ (Any framework)│ ``` ## Self-Hosting ### Docker Compose ```yaml services: directus: image: directus/directus:latest ports: - "8055:8055" environment: SECRET: your-random-secret-key DB_CLIENT: pg DB_HOST: postgres DB_PORT: 5432 DB_DATABASE: directus DB_USER: directus DB_PASSWORD: directus ADMIN_EMAIL: admin@example.com ADMIN_PASSWORD: your-admin-password depends_on: - postgres postgres: image: postgres:16-alpine environment: POSTGRES_USER: directus POSTGRES_PASSWORD: directus POSTGRES_DB: directus volumes: - pg-data:/var/lib/postgresql/data volumes: pg-data: ``` ## Key Features ### Database-First Approach Directus never modifies your database schema: ```sql -- Your existing database tables work as-is CREATE TABLE products ( id SERIAL PRIMARY KEY, name VARCHAR(255), price DECIMAL(10,2), category_id INTEGER REFERENCES categories(id), created_at TIMESTAMP DEFAULT NOW() ); -- Directus automatically provides: -- REST: GET /items/products -- GraphQL: query { products { id name price } } -- Admin UI with forms, filters, and relations ``` ### Supported Databases | Database | Status | |----------|--------| | PostgreSQL | Full support | | MySQL / MariaDB | Full support | | SQLite | Full support | | MS SQL Server | Full support | | CockroachDB | Community | | OracleDB | Community | ### Flows (Visual Automation) Build automations without code: ``` Trigger: Item Created in "orders" → Condition: order.total > 1000 → Action: Send Email to sales team → Action: Create record in "high_value_orders" → Action: Call webhook to fulfillment API ``` ### Extensions System Directus is fully extensible: ```typescript // Custom endpoint extension export default { id: 'custom-reports', handler: (router, context) => { router.get('/sales-report', async (req, res) => { const { ItemsService } = context.services; const orders = new ItemsService('orders', { schema: req.schema }); const data = await orders.readByQuery({ aggregate: { sum: ['total'] } }); res.json(data); }); }, }; ``` Extension types: - **Interfaces**: Custom input components - **Displays**: Custom value renderers - **Layouts**: Custom collection views - **Modules**: Full custom pages - **Endpoints**: Custom API routes - **Hooks**: Event-driven logic ## Directus vs Alternatives | Feature | Directus | Strapi | Payload | Hasura | |---------|----------|--------|---------|--------| | Open Source | Yes | Yes | Yes (MIT) | Yes (Apache) | | Approach | Database-first | CMS-first | Code-first | Database-first | | Existing DB | Connect any SQL | Own schema | Own schema | Connect PostgreSQL | | APIs | REST + GraphQL | REST + GraphQL | REST + GraphQL | GraphQL only | | Admin UI | Built-in (Vue) | Built-in (React) | Built-in (React) | Console | | Automation | Visual Flows | Webhooks | Hooks | Event triggers | | No-code | Extensive | Moderate | Minimal | Moderate | ## FAQ **Q: Will Directus modify my existing database?** A: It won't modify your business tables. Directus only creates its own system tables (prefixed with directus_) for configuration, permissions, and metadata. Your business data tables stay untouched. **Q: Is it suitable for traditional CMS websites?** A: Very much so. Directus works as a headless CMS paired with Next.js, Nuxt.js, Gatsby, and other frontends. Built-in asset management, multi-language support, and versioning are all CMS essentials. **Q: Directus or Strapi?** A: If you have an existing database to connect to, choose Directus (database-first). If you're building a content model from scratch, either works. Directus has stronger no-code capabilities; Strapi has a larger developer ecosystem. ## Source & Thanks - GitHub: [directus/directus](https://github.com/directus/directus) — 34.7K+ ⭐ - Website: [directus.io](https://directus.io) --- Source: https://tokrepo.com/en/workflows/directus-open-source-backend-headless-cms-any-database-f431a500 Author: AI Open Source