Directus

Connect any SQL database and get instant REST and GraphQL APIs, a visual management Studio, and a native MCP server for AI agents — free for most organizations.

34.4Kstars
4.6Kforks
Other
TypeScript

Directus wraps any existing SQL database with a production-ready backend stack: auto-generated REST and GraphQL APIs, a visual management Studio for non-technical teammates, and a native MCP server so AI agents can work directly with your live data. There is no schema migration required — Directus introspects your existing tables and immediately generates typed endpoints with granular, field-level access policies.

The platform supports PostgreSQL, MySQL, MariaDB, SQLite, MS SQL, OracleDB, and CockroachDB. Teams can self-host on their own infrastructure, deploy in one click on Railway, or use Directus Cloud for a fully managed instance provisioned in under 90 seconds. Version 12 introduced the Monospace Sustainable Core License, making Directus free for organizations under $5M annual revenue and 50 employees via the Open Innovation Grant program.

Directus is built as a TypeScript monorepo with a Vue 3 admin app and a deeply extensible architecture. Developers can add custom API endpoints, server-side hooks, and entirely new UI interfaces through a declarative extension system. The embedded AI Assistant can create content, run translations, and trigger automation workflows directly from the Studio, while the native MCP server lets Claude, Cursor, ChatGPT, or any MCP-compatible tool query and mutate data using the same role-based permissions as human users.

What You Get

  • Auto-Generated REST & GraphQL APIs - Directus introspects your database schema on startup and immediately exposes fully documented REST and GraphQL endpoints — no code generation or boilerplate configuration required.
  • Visual Management Studio - A Vue 3 admin interface lets non-technical teammates create, edit, and manage content, media, and relational data without writing SQL, with full support for custom layouts and display formats.
  • Native MCP Server - A first-class Model Context Protocol server built into the API lets Claude, Cursor, ChatGPT, and other AI agents connect to your live data using the same access policies that govern your team.
  • Policy-Based Access Control - Granular, field-level permissions per role apply uniformly across REST, GraphQL, and AI agent access — no special cases or workarounds for different client types.
  • Multi-Database Support - Works with PostgreSQL, MySQL, MariaDB, SQLite, MS SQL, OracleDB, and CockroachDB without requiring schema migration; your data stays in your existing database.
  • Extension System - Custom API endpoints, server-side hooks, new field interfaces, display components, and full layout modules can be added declaratively without modifying core Directus code.
  • Built-in AI Assistant - Embedded in the Studio, the AI Assistant creates content, runs translations, and triggers automation workflows directly against live data with structured context from your schema.
  • Flows & Automation - A no-code automation engine with triggers, operations, and webhook outputs lets teams build data workflows and event-driven pipelines without leaving the Studio.

Common Use Cases

  • Expose an existing database as a headless CMS - A product team connects Directus to their legacy PostgreSQL database and immediately gets a typed API and admin panel without migrating data or writing a custom backend.
  • AI agent data access with governance - A developer configures the native MCP server so a Claude-powered agent can query customer records and trigger automation flows, with the same field-level permissions applied as for human users.
  • Multi-user editorial platform - A media company uses Directus to let journalists draft articles, editors review and publish, and designers manage assets — all through role-gated Studio views on a shared PostgreSQL database.
  • Internal SaaS admin panel - A B2B startup uses Directus as the admin backend for their product, giving customer success teams a no-code interface to manage user configurations and flag records without engineering involvement.
  • Rapid API prototyping - A developer spins up a SQLite-backed Directus instance locally to prototype REST and GraphQL endpoints for a new app before committing to a production database schema.
  • Content infrastructure for multi-site publishing - An agency runs a single Directus instance against a MariaDB database, using role-based access and collection-level permissions to serve content to multiple client frontends through a shared headless API.

Under The Hood

Architecture Directus uses a layered monorepo architecture where Express.js controllers delegate to typed service classes that mediate between a multi-phase permission pipeline, Knex-based data access, and a wildcard event emitter. Every data operation — whether triggered by REST, GraphQL, an automation flow, or an AI agent via MCP — passes through the same three-phase permission system: process-ast, process-payload, and validate-access. The MCP server is a first-class HTTP transport in the same Express application, registering tool definitions from the same service layer, which means AI agents face identical field-level RBAC as human users with no workarounds. The Vue 3 admin app communicates through a typed SDK and extends through a declarative extension registry that adds interfaces, displays, layouts, and modules without touching core code.

Tech Stack Node.js 22 powers the backend with TypeScript as the unified language across the API, admin app, extensions SDK, and all shared packages. Knex.js provides database-agnostic query building with support for PostgreSQL, MySQL, MariaDB, SQLite, MS SQL, OracleDB, and CockroachDB. The admin frontend uses Vue 3 with Pinia for state management and Reka UI primitives for accessible components. The MCP server uses the official @modelcontextprotocol/sdk. AI integrations use the @ai-sdk adapter pattern supporting OpenAI, Anthropic, and Gemini providers. Storage drivers cover Azure Blob, Google Cloud Storage, S3, Cloudinary, and Supabase Storage. The monorepo is managed with pnpm workspaces, Changesets for versioning, Vitest for testing, and multi-stage Docker builds for production.

Code Quality Vitest is used extensively across the API services, controllers, and Vue composables with test files collocated alongside source modules. TypeScript strict mode is enforced throughout with shared type definitions in a dedicated @directus/types package. Error handling uses a custom typed error hierarchy from @directus/errors rather than stringly typed messages. The ItemsService demonstrates consistent defensive patterns: permission validation, event emission, cache invalidation, and transaction wrapping are applied uniformly to all mutation operations. ESLint, Stylelint, and Prettier enforce code style with automated changelog generation via Changesets.

What Makes It Unique The native MCP server implementation is technically distinctive: rather than a bolt-on plugin, it uses the same service layer and permission pipeline as the REST API, so AI agent governance is structural rather than policy-configured. The schema-agnostic approach — introspecting live databases and generating a query AST at runtime — means Directus can wrap existing production databases without any migration. The MSCL-1.0 license includes a built-in future grant to GPL-3.0 on the fourth anniversary of each release, a novel sustainable open-source model that gives commercial operators long-term confidence while funding continued development. The Open Innovation Grant makes the platform free for the vast majority of self-hosting teams.

Self-Hosting

Directus is released under the Monospace Sustainable Core License (MSCL-1.0), a source-available license derived from the Fair Core License. In plain terms, you can use, modify, and redistribute the software for any purpose except competing directly with Directus’s own commercial offerings. Importantly, the license includes a built-in future grant: every release automatically converts to GPL-3.0 four years after its publication date, so self-hosters can count on the code becoming fully open-source over time. Organizations under $5M in annual revenue and 50 employees qualify for the free Open Innovation Grant, which covers most individual developers, startups, and small teams. Organizations above those thresholds using advanced or enterprise features require a commercial license from Directus.

Self-hosting Directus requires a Node.js 22 runtime, a supported SQL database (PostgreSQL is recommended for production), and optionally Redis for caching and shared memory in multi-instance deployments. Docker images are provided with multi-stage builds optimized for production. The operational burden is real: you are responsible for database backups, Directus version upgrades, storage configuration, SSL termination, and scaling your own infrastructure. The extension system and flows engine add operational complexity proportional to how deeply you customize the deployment. Teams without dedicated infrastructure experience should evaluate Directus Cloud or Railway’s one-click deployment before committing to self-hosting.

Compared to Directus Cloud, self-hosters give up managed backups, automatic minor version upgrades, a global CDN for assets, auto-scaling, and Directus’s infrastructure SLA. The Cloud tier provisions a project in under 90 seconds with database, storage, and networking pre-configured. Self-hosting gives you full control over data residency, database access, and cost structure at scale — but support is limited to the community forum, Discord, and GitHub Issues unless you purchase a commercial support agreement. Teams evaluating the trade-off should account for the engineering time required to operate the platform reliably at production scale.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack

No spam. Unsubscribe anytime.

Join 750+ subscribers
No spam. Unsubscribe anytime.

Search