How mehmetcozdemir/jutform-preflight works
1. What this repo is
- This is not a business app; it is a pre-flight environment check for the JutForm assessment stack.
- Its job is to prove that Docker, PHP, Nginx, MySQL, Redis, and Mailpit can all run together on the machine.
2. Deployment model
- The whole environment is defined in docker-compose.yml and runs as a small, containerized stack.
- The architecture is “edge web server + PHP app + supporting services,” with health/verification endpoints exposed through a single local entry point.
3. Request entry point
- Users and scripts hit Nginx on http://localhost:8080.
- Nginx serves the static status page and proxies PHP requests to php-fpm.
- This makes Nginx the front door for both browser checks and API-based checks.
4. Backend application boundary
- The only visible backend code is backend/public/index.php, which acts as the PHP entry point/front controller.
- Its role is likely to expose health/diagnostic responses and exercise connectivity to downstream services.
- PHP runs separately from Nginx, so web serving and application execution are cleanly split.
5. Frontend boundary
- The frontend is already built and checked in under frontend/dist/index.html.
- There is no source-side SPA build pipeline in this repo; the frontend is a static status page served by Nginx.
- The browser experience is therefore lightweight and mostly exists to visualize the service checks.
6. Database subsystem
- MySQL is part of the verification target and is initialized from docker/mysql/init/00-schema.sql.
- That schema file is the only explicit database asset in the tree, so the DB is used primarily to confirm connectivity and query execution rather than to model a full domain.
- The MySQL container is part of the environment contract the assessment expects.
7. Cache subsystem
- Redis is included as another runtime dependency to validate PHP’s ability to connect, write, and read.
- It is not backed by any repo data files, which suggests it is a pure service-health dependency in this preflight setup.
8. Email subsystem
- Mailpit provides SMTP capture for email delivery checks.
- It is an integration target rather than an internal application component, verifying that outbound mail infrastructure is reachable.
9. Container build and runtime configuration
- docker/php/Dockerfile builds the PHP runtime with the required extensions called out in the README: pdo, pdo_mysql, redis, json, intl, and zip.
- docker/nginx/Dockerfile, docker/nginx/nginx.conf, and docker/nginx/default.conf define the web server image and routing behavior.
- These files are the main infrastructure boundary between host machine and the assessment stack.
10. Verification flow
- The same underlying checks can be triggered three ways: via the browser UI, curl /api/health, or ./scripts/verify.sh.
- That means the repo has one conceptual health-check pipeline with multiple presentation layers, not multiple independent implementations.
- The script is the CLI wrapper around the service checks used for automated validation.
11. Data flow summary
- Browser or CLI → Nginx → PHP-FPM → probes MySQL/Redis/Mailpit.
- Static status UI is served directly by Nginx, while dynamic health data comes from PHP.
- MySQL schema initialization happens once at container startup through the mounted init SQL.
12. Operational boundaries
- Host ports are explicitly exposed for local verification, with the README calling out 8080, 8025, 3307, 6380, and 1025.
- The repo assumes Docker Compose orchestration, so the architecture is designed around reproducible local startup rather than long-running external infrastructure.
Main entry points: docker-compose.yml Compose · index.php Health entry · nginx/Dockerfile Nginx image · php/Dockerfile PHP image
Components 16
Orchestration
Docker Compose defines and wires the local assessment stack.
- Compose · Top-level stack definition and service wiring.
docker-compose.yml
Edge
Web entry, static delivery, and request routing.
- Nginx image · Builds the web server runtime.
docker/nginx/Dockerfile - Nginx config · Server and proxy behavior for the local front door.
docker/nginx/nginx.conf - Site config · Default site routes static content and PHP requests.
docker/nginx/default.conf - Nginx · Front door that serves static content and proxies PHP.
Application
PHP front controller and checked-in status UI.
- PHP image · Builds the PHP-FPM runtime with required extensions.
docker/php/Dockerfile - Health entry · Application entry point for dynamic status and probes.
backend/public/index.php - Status page · Prebuilt browser UI served directly by Nginx.
frontend/dist/index.html - PHP-FPM · Executes the PHP application behind the web server.
Services
Stateful and integration services validated by the stack.
- MySQL · Relational dependency exercised by the health checks.
- Schema init · Startup schema loaded into MySQL.
docker/mysql/init/00-schema.sql - Redis · Cache dependency used to validate read/write connectivity.
- Mailpit · Mail sink for outbound delivery checks.
Verification
CLI path for automated health checks.
- Verify script · Automated local verification entry point.
scripts/verify.sh - Browser · Human-facing entry to the status page and checks.
- Curl · Command-line entry to the health endpoint.
Connections 19
- Compose → Nginx image: builds · Compose instantiates the web server image.
- Compose → PHP image: builds · Compose instantiates the PHP runtime image.
- Compose → MySQL: starts · Compose launches the database service.
- Compose → Redis: starts · Compose launches the cache service.
- Compose → Mailpit: starts · Compose launches the mail capture service.
- Nginx image → Nginx: runs as · The built image provides the Nginx runtime.
- Nginx config → Nginx: configures · Core server behavior is defined here.
- Site config → Nginx: routes · Site routing and content handling are defined here.
- Status page → Nginx: served by · Static status page is delivered directly by Nginx.
- PHP image → PHP-FPM: runs as · The built image provides the PHP-FPM runtime.
- Health entry → PHP-FPM: executes on · Dynamic responses are generated by the PHP runtime.
- Nginx → PHP-FPM: proxies · Nginx forwards PHP requests to the app runtime.
- Browser → Nginx: requests · Browser traffic enters through the local web server.
- Curl → Nginx: requests · CLI health checks enter through the same front door.
- Verify script → Nginx: checks · Scripted verification uses the exposed HTTP entry point.
- Health entry → MySQL: probes · PHP validates database connectivity and queries.
- Health entry → Redis: probes · PHP validates cache connectivity.
- Health entry → Mailpit: probes · PHP validates outbound mail delivery.
- Schema init → MySQL: initializes · Schema is loaded when the database container starts.