Welcome to
Skip to main content
Home/Documentation/Backend Architecture

Backend Architecture

Directus CMS, database, vector storage, and extensions

The Hub Digital platform relies on a headless CMS architecture powered by Directus. The backend repository is maintained separately in hub-digital-admin.

Infrastructure

The backend relies on several containerized services orchestrated via Docker Compose:

  • Directus — The core headless CMS and API engine
  • PostgreSQL — Relational database for all content and user data
  • MinIO / S3 — Object storage for uploads (images, documents, avatars)
  • Redis — Used for caching and rate-limiting

Starting the Backend Locally

To start the full backend stack locally:

cd ../hub-digital-admin
cp .env.example .env
docker compose -p hub-digital-admin -f docker-compose.yml -f docker-compose.s3.yml up -d

Custom Extensions

Directus functionality is extended via custom code located in the extensions/ directory:

Endpoints

  • ai-chat — Custom REST endpoint that handles communication with the LLM (Azure OpenAI or Ollama) and vector database (Qdrant) for the Toti AI Assistant.
  • course-enrollments — Custom logic for enrolling users into courses and managing their progress.

Hooks

Various validation hooks ensure data integrity before it is saved to the database:

  • login-streak-hook — Manages the gamification streak logic when a user logs in.
  • *-gallery-validation-hook — Ensures uploaded gallery images meet size and format requirements.

Operations (Flows)

  • qdrant-upsert-operation — Custom Flow operation to embed text and store it in Qdrant when a resource/course is created or updated.
  • qdrant-delete-operation — Custom Flow operation to remove vectors from Qdrant when content is deleted.

File Storage (S3)

All media uploads are routed to an S3-compatible storage provider (MinIO locally, AWS S3 in production). The NUXT_PUBLIC_*_UPLOAD_FOLDER environment variables in the frontend point to the specific folder IDs in Directus where these files should be stored.