A production-ready(ish) template demonstrating how to integrate Inngest with Directus for handling asynchronous workflows, featuring automated content translation using DeepL and image transformation preprocessing.
- 🔄 Automated content translation across multiple languages using DeepL
- 🖼️ Automatic image transform pre-generation
- 📊 Background job monitoring with Inngest
- 🚀 Production-ready Docker setup
- 🔒 Type-safe development environment
Prerequisites
- Docker and Docker Compose
- Node.js 22+ and pnpm
- DeepL API key for translations
Development Setup
The project consists of several services running in Docker containers:
- Directus (
:8088
) - Headless CMS - PostgreSQL - Database
- Redis - Cache
- Inngest (
:8288
) - Background job processing
pnpm i
cp .env.example .env
Directus Admin Token
This is required for applying the template and generating types.
DIRECTUS_TOKEN=your_admin_token
DeepL API Key
You'll need to create an account on DeepL for the translation workflow. DeepL does provide 500,000 free characters per month (as of January 2025) which should be more than enough for testing in most projects. You can get this from the DeepL API Key
DEEPL_API_KEY=your_deepl_api_key
Inngest Configuration
INNGEST_DEV=true
INNGEST_EVENT_KEY=your_event_key
INNGEST_SIGNING_KEY=your_signing_key
You need to either run the queue in development mode or build it for production in order for the translation workflow to actually run and the extension to be loaded in Directus.
pnpm run queue:dev
You can also build the queue for production:
pnpm run queue:build
docker compose up
Directus will be available at http://localhost:8088
and Inngest Dev Server at http://localhost:8288
.
These ports are configurable in the docker-compose.yml
file.
Note: The 8088
port is just an arbitray choice because I have too many local Directus instances running on the default port of 8055
.
This would only be done once, and only if you are applying the template for the first time. Do not repeat this step.
This template provides a multilingual content management foundation using Directus. It includes pre-configured content types for posts with translation support, integrated with DeepL for automated translations. The schema includes essential fields for content management (title, slug, content) along with comprehensive language handling supporting both LTR and RTL text directions.
To apply the template, ensure your Directus instance is fresh and hasn't been configured with any conflicting collections. The template will create the necessary collections for posts, languages, and translations, along with their relationships and field configurations. After application, you can extend the schema further based on your specific needs while maintaining the core multilingual functionality.
npx directus-template-cli@latest apply -p --directusUrl="http://localhost:8088" --directusToken="admin-token-here" --templateLocation="./directus/template" --templateType="local"
You need to either run the queue in development mode or build it for production in order for the translation workflow to actually run.
pnpm run queue:dev
You can also build the queue for production:
pnpm run queue:build
You may need to restart docker containers for the queue to be picked up as well.
docker compose restart
The project uses Inngest for handling asynchronous tasks. Two main workflows are implemented:
-
Content Translation
- Triggers on post creation/update
- Automatically translates content using DeepL
- Supports multiple languages and field types
- Creates notifications for content editors
-
Image Transform Pre-generation
- Triggers on image upload
- Generates all configured image transforms
├── directus/ # Directus configuration and uploads
├── queue/ # Inngest integration
│ ├── src/
│ │ ├── functions/ # Background job implementations
│ │ ├── hooks/ # Directus event hooks to pass events to the queue
│ │ └── inngest/ # Inngest configuration
├── scripts/ # Development utilities
├── types/ # Generated TypeScript types
└── .env # Environment variables
The translation system supports multiple content fields and languages. Configure supported languages in Directus with:
code
: Language code (e.g., 'en-US', 'es-ES')name
: Language name (e.g., 'English', 'Spanish')deepl_code
: Corresponding DeepL language code (see supported languages)direction
: Text direction (ltr/rtl)
Configure image transform presets in Directus settings. The system will automatically generate these variants when new images are uploaded.
After making schema changes in Directus, regenerate TypeScript types:
pnpm generate:types
Access the Inngest dashboard at http://localhost:8288
to monitor background jobs and debug workflows.
🚧 Coming soon. We'll be adding a Dockerfile to build the Directus instance along with the queue for production.
- Set appropriate environment variables
- Configure proper CORS settings
- Remove development-only settings from docker-compose
- Set up proper logging
- Configure rate limiting for the translation API