index.phpUser-facing results page, loads data via./data/results.jsonand triggers regenerate when in dev or whenrefreshquery argument supplied with correct key.data.phpUses the API toGET /resultsand transform it into a single JSON file with score calculations and tally table included.utils.phpVariety of env, string and database utilities that are used between files.results.phpSingle page entry results screen.api/index.phpProvides HTTP/REST access to the various GET/POST/DELETE endpoints to interact with the database.api/.htaccessAllows./api/resultsand./api/racesetc to remap incoming HTTP calls toindex.phpfor the various endpoints.db/Database scripts for recreating the database and injecting the required races.data/Stores the generates JSON file as well as an export of the Capital Athletic relay records.assets/Stores images.
index.php, utils.php, and .env plus ./assets and ./data directories on public facing web server (no database). Currently this is https://relaycarnival.capitalathletics.au
All files also exist on non-advertised/protected web server for data entry via API + database.
For speed and security, the public site can call private server data.php endpont to generate and save the JSON via ?refresh=xxx call which can be run as required.
The following environment variables must exist in .env
EVENT_NAME=Relay Carnival 20xx-xx
JSON_URL=https://abc.com/data.php // private admin server URL to grab JSON from
SYNC_KEY=relaycarnivalsync // magic key to use for triggering sync of JSON file via JSON_URL
DB_HOST=x.x.x.x
DB_NAME=relaycarnival
DB_USERNAME=relaycarnival
DB_PASSWORD=xxxxx
DB_CHARSET=utf8mb4
GTAG=G-xxxxxxxxxx // Google analytics tag