home / http-apis / directus

Directus CLI

Official · Directus
34k

Official Directus CLI for bootstrapping self-hosted projects, migrating the database, and snapshotting or applying schema.

$npm init directus-project <project-folder>
Language
TypeScript
Stars
34,410
Category
HTTP & APIs
Agent
Ready
Agent Compatibility
JSON Output
Agent Skill
MCP Support
AI Analysis

Directus CLI is the server-side command surface for setting up and operating a self-hosted Directus project. It focuses on project bootstrap, database lifecycle, schema promotion, and a small set of admin tasks against the instance database.

What It Enables
  • Create or bootstrap a self-hosted Directus project, install or migrate the database, and start the API.
  • Snapshot a Directus schema to YAML or JSON, preview changes with --dry-run, and apply schema updates between environments.
  • Create roles and users, reset user passwords, and run simple maintenance checks such as collection counts against the project database.
Agent Fit
  • schema snapshot --format json, schema apply --dry-run, and --yes support make schema promotion and verification workable in scripts or CI.
  • The surface is mixed rather than broad: most commands assume a local project directory, configured database environment, or human prompts, especially init.
  • Directus itself can expose an /mcp endpoint when the server is running, but this package is mainly a deployment and schema-management CLI, not the richer client-side directusctl automation surface.
Caveats
  • Most day-to-day content reads and writes happen through the Directus REST or GraphQL APIs, or the separate directusctl CLI, rather than this server-side package.
  • Useful operation requires a configured project and database connection, and init installs drivers and prompts for database and admin details.