Skip to main content
This guide will help you set up your local development environment to contribute to Directus.

Prerequisites

Before you begin, ensure you have the following installed:
  • Node.js 22 - Required version for development
  • pnpm >=10 and <11 - Package manager used by Directus
  • Git - For version control

Installing Node.js

We recommend using a version manager like nvm or volta to manage Node.js versions:

Installing pnpm

Install pnpm globally:
Or use corepack (recommended):

Clone the Repository

Fork the Directus repository on GitHub, then clone your fork:
Add the upstream remote to stay in sync with the main repository:

Install Dependencies

Install all dependencies for the monorepo:
This will install dependencies for all packages in the workspace.

Build the Project

Build all packages in the monorepo:
To build a specific package:

Running Development Servers

API Server

Run the API development server with hot reload:
The API will be available at http://localhost:8055.

App Dashboard

Run the App development server with Vite HMR:
The App will be available at http://localhost:8080.

Running Both Servers

You can run both servers simultaneously in separate terminal windows or tabs.

Database Setup

Directus supports multiple SQL databases. For local development, you can use:
  • SQLite - Simplest option, no setup required
  • PostgreSQL - Recommended for production-like development
  • MySQL/MariaDB - Alternative option

Using SQLite

Create a .env file in the /api directory:

Using PostgreSQL

First, ensure PostgreSQL is running, then create a .env file in the /api directory:

Linting and Formatting

Before submitting a pull request, ensure your code passes all linting and formatting checks:

Auto-fixing Issues

Many issues can be automatically fixed:

Testing

Run the test suite to ensure your changes don’t break existing functionality:

Blackbox/E2E Tests

Blackbox tests require building the project first:

Development Tips

Working with the Monorepo

Directus uses pnpm workspaces. To run commands in a specific package:

Dependency Management

When adding dependencies:
  • Use workspace:* for internal package dependencies
  • Use catalog: for external dependencies (versions defined in pnpm-workspace.yaml)
  • Add new shared dependencies to the catalog first

Staying Up to Date

Regularly sync your fork with the upstream repository:

Troubleshooting

Build Errors

If you encounter build errors:
  1. Clear the pnpm cache: pnpm store prune
  2. Remove node_modules: rm -rf node_modules packages/*/node_modules
  3. Reinstall dependencies: pnpm install
  4. Rebuild: pnpm build

Port Already in Use

If the default ports are already in use, you can specify different ports:

Next Steps

Now that your development environment is set up: