Draconai Documentation

dd_id_b82bfe7e81
4. System Technical

Architecture

Note: This document is limited to used software, Docker containers, and high-level structure. It does not describe code-level implementation details.

Overview

  • Two Symfony installs: one frontend, one backend.
  • Connected via API.
  • Running with Docker.
  • Docker configuration (images, Traefik, etc.) is stored under server/var_www/docker/.
  • Database: PostgreSQL.
  • Reverse proxy: Traefik.
  • Traefik uses a file provider (server/var_www/docker/traefik/dynamic.yml) for routing rules.
  • Admin tool: phpMyAdmin.
  • phpMyAdmin is routed via Traefik at pma.ai.drawconclusions.org and protected by an IP allowlist.
  • Access via server IP (no domain yet).
  • Architecture subpages include Routes, Docker Containers, Items, and Relations.
  • All containers are defined in a single docker-compose file.
  • Web stack: Nginx + PHP-FPM.
  • FE PHP-FPM image is built from server/var_www/docker/fe/Dockerfile.
  • BE PHP-FPM image is built from server/var_www/docker/be/Dockerfile.
  • Frontend templates: Twig.
  • Theme switcher in FE stores preference in session.
  • Frontend scripting: TypeScript.
  • Frontend build tools: Webpack, webpack-cli, TypeScript, ts-loader, Babel (core + preset-env), babel-loader, css-loader, mini-css-extract-plugin, sass, file-loader, terser-webpack-plugin, clean-webpack-plugin.
  • Frontend libs: D3, TinyMCE.
  • Docker Compose file (server): /var/www/docker-compose.yml
  • Traefik config: server/var_www/docker/traefik/traefik.yml
  • Backend API is served under /api (e.g., /api/health).
  • Mailpit is used as a local SMTP catch-all for development.
  • Database convention: UUIDv4 primary keys for all tables (see conventions.md, ID: DOC-CONV-UUID).
  • Docker container names are UpperCamelCase: Traefik, FePhp, FeNginx, BePhp, BeNginx, Db, Mailpit, PhpMyAdmin, wordpress-app (service names remain lowercase in docker-compose).

Canonical Ownership

Canonical

  • Docker container details live on Docker Containers pages (see components.md).
  • Route details live on route pages (see architecture_routes.md).
  • Table details live on table pages (see tables.md and table_*.md).

Database

Db

  • PostgreSQL runs as the db service in server/var_www/docker-compose.yml.
  • Init SQL lives at server/var_www/docker/postgres/init.sql and creates the health_check table.
  • Init SQL seeds the users table with admin@example.com and the configured admin email from config.xml (admin/email).
  • Backend API reads DB connection settings from environment variables set in docker-compose.yml.
  • Backend DB check endpoint: /api/db-check (Traefik strips /api before hitting BE).
  • Backend login endpoint: /api/login (expects JSON with email + password).
  • FE login page posts to the backend login endpoint via BE_API_URL (defaults to http://be-nginx).
  • Backend mail test endpoint: /api/mail-test (sends via Mailpit).
  • Backend test-user endpoint: /api/test-user (creates a test login user for Playwright).
  • Backend contact endpoint: /api/contact stores email rows and sends mail to admin.
  • Backend register endpoint: /api/register creates a pending registration and sends a confirmation email.
  • Backend register confirm endpoint: /api/register/confirm creates the user from the pending registration.
  • Backend roles service provides hardcoded roles (guest, user, admin) and /api/roles.
  • Users table includes role with allowed values user and admin (default user).
  • Thoughts core unit stored in thoughts table with /api/thoughts list/create and /api/thoughts/{id} detail.
  • Password reset flow:
  • /api/forgot-password stores a reset token and emails a link.
  • /api/reset-password validates the token, updates the password, clears the token, and returns the email for auto-login.

Diagrams

Physical Machines

graph LR
  Local[Local Machine] -->|git push/pull| GitHub[(GitHub Repo)]
  Local -->|deploy (rsync/scp)| Droplet[DO Server]
  Droplet -->|git pull (read-only)| GitHub

Docker Network

graph TD
  Internet((Internet)) --> Traefik[Traefik :80]
  Traefik -->|/| FE_NGINX[FeNginx]
  Traefik -->|/api| BE_NGINX[BeNginx]
  Traefik -->|docs.ai.drawconclusions.org| WORDPRESS[WordPress]
  FE_NGINX --> FE_PHP[FePhp]
  BE_NGINX --> BE_PHP[BePhp]
  FE_PHP -->|API calls| BE_NGINX
  BE_PHP --> DB[(PostgreSQL Db)]

Docker Containers

  • Frontend Symfony install (folder: fe)
  • Backend Symfony install (folder: be)
  • API connection between frontend and backend
  • PostgreSQL database
  • Traefik reverse proxy / ingress
  • phpMyAdmin (admin UI)