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.
Installation Guide
This guide covers detailed installation instructions for Directus, including Docker deployment, npm/pnpm installation, and production environment configuration.Requirements: Directus requires Node.js 22 or higher. Check your version with
node -vInstallation Methods
Choose the installation method that best fits your needs:- Docker (Recommended)
- npm
- pnpm
- From Source
Docker provides the easiest path to production deployment with all dependencies containerized.
Docker Installation
Docker is the recommended method for production deployments. Directus provides official Docker images.Quick Start with Docker
Production Docker Compose Setup
For production, use Docker Compose with PostgreSQL:Generate Secure Keys
Generate secure random values for Update your
KEY and SECRET:docker-compose.yml with these values.Start the Services
- Start PostgreSQL database
- Start Redis cache
- Start Directus
- Bootstrap the database on first run
Dockerfile Reference
The official Directus Dockerfile uses a multi-stage build:npm/pnpm Installation
Install via npm
Configure Environment
Edit the
.env file created during init. See Environment Configuration below.Install via pnpm
Install from Source
For development or if you want to customize Directus:Environment Configuration
Directus is configured via environment variables. Here are the essential configurations:Core Configuration
Caching with Redis
Storage Configuration
Rate Limiting
Authentication & Security
Email Configuration
Production Deployment
Using PM2 for Process Management
Directus includes PM2 configuration for production deployments:Nginx Reverse Proxy
Example Nginx configuration:Production Checklist
Before deploying to production:Database
Database
- Use PostgreSQL or MySQL (not SQLite)
- Set up automated backups
- Configure connection pooling
- Enable SSL for database connections
- Exclude system tables:
DB_EXCLUDE_TABLES="spatial_ref_sys,sysdiagrams"
Security
Security
- Generate strong
KEY(32 characters) andSECRET - Set
REFRESH_TOKEN_COOKIE_SECURE="true" - Set
SESSION_COOKIE_SECURE="true" - Configure
PUBLIC_URLto your domain - Enable and configure CORS appropriately
- Set up rate limiting with Redis
- Review and configure
CORS_ORIGIN
Performance
Performance
- Enable Redis caching:
CACHE_ENABLED="true" - Configure rate limiting with Redis store
- Set appropriate cache TTL values
- Use CDN for assets
- Configure
MAX_PAYLOAD_SIZEbased on needs
Storage
Storage
- Configure cloud storage (S3, Azure, GCS)
- Set up CDN for file delivery
- Configure appropriate file upload limits
- Enable server-side encryption if required
Email
- Configure email transport (SMTP, SES, etc.)
- Set
EMAIL_FROMto valid sender address - Test password reset emails
- Configure email rate limiting
Monitoring
Monitoring
- Enable logging: Configure Pino log levels
- Set up health check endpoint:
/server/ping - Monitor with PM2 or Docker health checks
- Set up error tracking (Sentry, etc.)
- Configure metrics export if needed
SSL/TLS
SSL/TLS
- Configure SSL certificates
- Use reverse proxy (Nginx, Caddy, etc.)
- Force HTTPS redirects
- Enable HSTS headers
Database Migration
When updating Directus versions, migrations may be required:Troubleshooting
Database connection errors
Database connection errors
Symptoms: Error connecting to databaseSolutions:
- Verify database is running
- Check
DB_HOST,DB_PORT,DB_DATABASE,DB_USER,DB_PASSWORD - Ensure database driver is installed (
pg,mysql2, etc.) - Check network connectivity
- For PostgreSQL, try:
DB_SSL="false"if SSL is not configured
Port already in use
Port already in use
Symptoms:
Error: listen EADDRINUSE: address already in use :::8055Solutions:- Change port:
PORT=3000in.env - Find and kill process using port 8055:
KEY or SECRET not set
KEY or SECRET not set
Symptoms:
Error: KEY environment variable is requiredSolutions:- Generate keys:
- Add to
.envfile
File upload errors
File upload errors
Symptoms: Files fail to upload or saveSolutions:
- Check
STORAGE_LOCAL_ROOTdirectory exists and is writable - Increase
MAX_PAYLOAD_SIZEif files are large - Verify disk space
- Check file permissions on upload directory
Docker container won't start
Docker container won't start
Symptoms: Container exits immediatelySolutions:
- Check logs:
docker logs directus - Verify all required environment variables are set
- Ensure database is ready before Directus starts (use
depends_on) - Check volume mounts are correct
Next Steps
Configure Data Model
Set up your collections, fields, and relationships
Authentication Setup
Configure OAuth, LDAP, SAML, or other auth providers
API Documentation
Learn about REST and GraphQL endpoints
Extensions
Extend Directus with custom interfaces and endpoints
Webhooks & Flows
Automate workflows and integrate with external services
User Management
Set up roles, permissions, and user accounts