This guide will help you set up your local development environment to contribute to Directus.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/directus/directus/llms.txt
Use this file to discover all available pages before exploring further.
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:Clone the Repository
Fork the Directus repository on GitHub, then clone your fork:Install Dependencies
Install all dependencies for the monorepo:Build the Project
Build all packages in the monorepo:Running Development Servers
API Server
Run the API development server with hot reload:http://localhost:8055.
App Dashboard
Run the App development server with Vite HMR: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 inpnpm-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:- Clear the pnpm cache:
pnpm store prune - Remove
node_modules:rm -rf node_modules packages/*/node_modules - Reinstall dependencies:
pnpm install - 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:- Learn about the codebase structure
- Review the pull request guidelines
- Start contributing!