bf8262b64f4322db6617ab550c9a11b464e8d151
Copenhagen Truck Wash API
Backend API for Copenhagen Truck Wash services.
Architecture & Stack
- Edge Proxy: Traefik 2.11 (Handles TLS termination, routing, and rate limiting).
- Web Server: Caddy 2.7 (Serves the PHP application via FastCGI).
- PHP Runtime: PHP 8.2-FPM (Scale out with workers
php1tophp5). - Cache/Queue: Redis 7.
- Observability: Jaeger (Tracing), Prometheus (Metrics).
Getting Started
Prerequisites
- Docker Desktop 4.x+
- PHP 8.2 CLI (optional, for host-side testing)
Local Development
To bring up the minimal development stack (Traefik, Redis, Caddy, and one PHP worker):
docker compose up -d traefik redis php1 caddy
The API is accessible at:
http://localhosthttps://localhost(using Traefik default cert)http(s)://localhost/api/(proxied with/apiprefix stripped)
To start all services including multiple PHP workers and development tools (Jaeger, Portainer):
docker compose --profile dev up -d
Configuration
Configuration is primarily managed via environment variables.
- The application root is located at
services/nginx/app. services/nginx/app/config.phploads configuration from the environment (requiresUSE_ENV=true).php1performs an automaticcomposer installon startup ifAUTO_COMPOSER_INSTALL=true.
Testing
The project now uses Pest as the primary test runner in services/nginx/app.
Running Tests
All commands are run from services/nginx/app:
composer test
composer test:unit
composer test:integration
composer test:coverage
Integration tests are opt-in and should be run with required services available:
$env:RUN_INTEGRATION_TESTS='1'
composer test:integration
Test Layout
tests/Unit/*: isolated unit and route-level behavior tests.tests/Integration/*: Redis/DB-backed tests intended for Docker/CI environments.tests/<legacy-domain>/*: legacy procedural scripts retained during migration; keep them runnable until matching Pest coverage exists.
Logs & Monitoring
- Logs:
docker compose logs -f [service_name](e.g.,php1,caddy,traefik). - Traefik Dashboard:
http://traefik.localhost(available in dev). - Jaeger (Tracing):
http://localhost:16686(when running with--profile dev). - Portainer:
http://localhost:9000(when running with--profile dev).
API Documentation
- OpenAPI: The authoritative OpenAPI 3.0 contract is at
openapi.yaml. - Writerside: Documentation projects are located in
/Writersideand/Writerside2.
Languages
PHP
93.5%
HTML
3.5%
JavaScript
1.9%
Shell
0.4%
Python
0.3%
Other
0.3%