Projet

Directus

A Directus installation guide with Supabase & Docker Compose

  • directus
  • docker-compose
  • supabase
Voir sur GitHub
Dépôt
KevinDeBenedetti/directus
Dernière mise à jour
mai 2025

README

Directus - Install guide

A headless CMS powered by Directus and Supabase, deployed via Docker Compose. This repository contains everything you need to run Directus with Supabase as your primary database and storage drive.

Description

This project sets up Directus configured to use a Supabase database and Supabase storage driver. Directus provides a modern headless CMS interface, while Supabase offers a scalable PostgreSQL database and object storage.

Features

  • Directus: Latest stable release.
  • Supabase Integration:
    • PostgreSQL database client.
    • Supabase storage driver for file uploads.
  • Docker Compose: Easy spin-up of Directus service.
  • Environment-driven configuration: All credentials and settings via .env file.

Prerequisites

  • Docker
  • Docker Compose
  • A Supabase project with:
    • PostgreSQL database credentials
    • Supabase storage bucket and service role credentials

Getting Started

  1. Clone the repository:
git clone https://github.com/KevinDeBenedetti/directus.git
cd directus
  1. Create your environment file: Copy the sample environment variables to .env:
cp .env.example .env
  1. Configure .env: Open .env and set the following variables:
# Directus Admin
ADMIN_EMAIL=your-admin@example.com
ADMIN_PASSWORD=yourStrongPassword
SECRET=yourDirectusSecretKey

# Database (Supabase)
DB_CLIENT=pg
DB_HOST=db.<your-supabase-project>.supabase.co
DB_PORT=5432
DB_DATABASE=postgres
DB_USER=postgres
DB_PASSWORD=<your-db-password>

# Supabase Storage
STORAGE_LOCATIONS='supabase'
STORAGE_SUPABASE_DRIVER=adapter
STORAGE_SUPABASE_SERVICE_ROLE=<your-service-role-key>
STORAGE_SUPABASE_BUCKET=<your-storage-bucket>
STORAGE_SUPABASE_PROJECT_ID=<your-supabase-project-id>

# Websockets
WEBSOCKETS_ENABLED=true
  1. Start services:
docker-compose up -d
  1. Access Directus: Visit http://localhost:8055 and log in using the ADMIN_EMAIL and ADMIN_PASSWORD from your .env.

Docker Compose Configuration

services:
  directus:
    image: directus/directus:11.5.1
    ports:
      - 8055:8055
    env_file: .env
    environment:
      SECRET: ${SECRET}
      ADMIN_EMAIL: ${ADMIN_EMAIL}
      ADMIN_PASSWORD: ${ADMIN_PASSWORD}
      DB_CLIENT: ${DB_CLIENT}
      DB_HOST: ${DB_HOST}
      DB_PORT: ${DB_PORT}
      DB_DATABASE: ${DB_DATABASE}
      DB_USER: ${DB_USER}
      WEBSOCKETS_ENABLED: ${WEBSOCKETS_ENABLED}
      STORAGE_LOCATIONS: ${STORAGE_LOCATIONS}
      STORAGE_SUPABASE_DRIVER: ${STORAGE_SUPABASE_DRIVER}
      STORAGE_SUPABASE_SERVICE_ROLE: ${STORAGE_SUPABASE_SERVICE_ROLE}
      STORAGE_SUPABASE_BUCKET: ${STORAGE_SUPABASE_BUCKET}
      STORAGE_SUPABASE_PROJECT_ID: ${STORAGE_SUPABASE_PROJECT_ID}

Environment Variables

VariableDescription
ADMIN_EMAILAdmin user email for Directus
ADMIN_PASSWORDAdmin user password for Directus
SECRETJWT secret for Directus
DB_CLIENTDatabase client (e.g., pg)
DB_HOSTHostname of Supabase database
DB_PORTPort for Supabase database (default 5432)
DB_DATABASEDatabase name (usually postgres)
DB_USERDatabase user (usually postgres)
DB_PASSWORDPassword for the database user
STORAGE_LOCATIONSName of the storage location (e.g., supabase)
STORAGE_SUPABASE_DRIVERSupabase storage driver identifier
STORAGE_SUPABASE_SERVICE_ROLESupabase service role key for storage
STORAGE_SUPABASE_BUCKETSupabase storage bucket name
STORAGE_SUPABASE_PROJECT_IDSupabase project identifier
WEBSOCKETS_ENABLEDEnable or disable websockets (true or false)

Usage

  • After starting the container, log in to Directus at http://localhost:8055.

  • Use the Directus admin interface to manage collections, fields, and roles.

  • Uploaded files will be stored in your Supabase Storage bucket.

Une question sur ce projet ?

L'assistant connaît mes dépôts : demandez-lui comment celui-ci fonctionne.

Autres projets