How mydnshost/mydnshost-frontend works
Project type and purpose
• This is a full-stack “frontend” web application written in PHP.
• It provides a browser-based UI for managing DNS entries by calling a separate JSON API (the mydnshost-api repo).
• It uses Composer for dependency management, Docker for containerization, and GitHub Actions for CI.
File structure
• Top-level:
• .github/ (CI workflows)
• Dockerfile (container build)
• composer.json/composer.lock (PHP deps)
• public/ (web-server docroot, contains index.php + .htaccess)
• src/ (PHP application code)
• templates/ (presentation layer – .tpl template files + assets)
• In src/:
• DisplayEngine.php (templating/rendering engine)
• routes/ (one class per route group: Admin, User, Domain, Authenticated vs. Not, System Jobs/Services, Terms, etc.)
• session.php (session management)
• storage.php (client library wrapper for the JSON API – via the mydnshost-php-api submodule)
• In templates/:
• A default theme folder with SCSS/JS assets (front-end behavior & styling) and numerous .tpl files for each view.
README for additional insights
• Confirms that this is the “main frontend” and interacts with an external JSON API.
• Notes that production is typically deployed as a Docker container.
• No internal database – all persistence happens in the API service.
a. Client Web Browser (UI)
• Loads HTML/CSS/JS assets delivered by the PHP server.
b. Frontend Web Server (Docker container)
• Nginx or Apache + PHP-FPM (public/index.php)
• Routes via src/routes/* classes
• DisplayEngine renders templates from templates/default
• session.php + storage.php manage user sessions and API client calls
c. External JSON API Service
• mydnshost-api (calls over HTTPS)
• Handles all data persistence (DB, authentication, email)
d. CI/CD Pipeline
• GitHub Actions workflow (.github/workflows/automerge.yml)
• Builds Docker image, runs tests, auto-merges dependency bumps via dependabot
e. Optional: Docker Registry / Deployment
• Registry holding built images
• Infrastructure repo (mydnshost-infra) for deployment manifests
Relationships & interactions
• Browser → (HTTP/HTTPS) → Frontend Web Server
• Frontend Web Server → (JSON over HTTPS) → External JSON API
• CI/CD → (build & push) → Docker Registry → Deployment targets
• Git Repository → CI/CD triggers on push/pull_request
Architectural patterns & design principles
• MVC-style separation:
• Controllers: route classes in src/routes
• Model/Service: storage.php + mydnshost-php-api client
• View: templates/default/*.tpl
• Single responsibility per route class
• Configuration in config.php
• Dependency management with Composer
• Containerized, stateless service (sessions can be file or redis, per config)
Detail without over-splitting
• Enough to capture the MVC layers, external API boundary, and deployment flow.
• The separation between frontend UI, application server, and data API layers
• The internal MVC-style structure
• The deployment and CI/CD landscape
• The key technologies: PHP & Composer, Docker, GitHub Actions, external JSON API