Component Interactions

How the database, backend endpoints, user interface, TO area and admin layer depend on one another.
Architecture Interactions Cross-Layer

Standard interaction pattern

User action
  ↓
Frontend page / script
  ↓
Shared API helper
  ↓
PHP endpoint
  ↓
Database read/write
  ↓
JSON response
  ↓
Frontend render/update

This is the dominant pattern across both the main App UI and the TO UI.

App ↔ API interaction

The App frontend calls backend endpoints for all meaningful state changes. The UI does not own business truth; it renders and orchestrates. Examples:

  • Armies calls army CRUD and import endpoints
  • Game Setup coordinates games, armies and tournament selection
  • Game Play depends on play-state and event endpoints
  • Auth pages depend on auth endpoints

TO ↔ API interaction

The TO area uses a similar pattern but calls TO-specific endpoints and some shared army/user/tournament endpoints. The TO surface is effectively a specialised operational client over the same core data model.

Admin ↔ SQL interaction

The Admin area is much closer to the data model. It changes reference data and configuration directly through targeted endpoints. Because of that, admin changes often have wider downstream effects than app/TO changes.

  • Editing races/factions/units affects army creation and imports
  • Editing tournaments or scoring affects standings behaviour
  • Editing users affects identity and access across every surface

SQL ↔ API interaction

The SQL layer defines the real component boundaries. Most API folders map naturally to one or more schema domains:

API area Main SQL domains touched
authusers, user_sessions, password_resets, email_verifications
armies / unitsarmy_lists, army_units, units, unit_aliases, import_issues
games / turns / eventsgames, game_sides, game_turns, game_player_turns, game_units, game_events
tournaments / totournaments, tournament_entrants, tournament_entrant_armies, tournament scoring tables
admincore data, tournaments, users

Cross-cutting interaction hotspots

Some parts of the system are unusually cross-linked and therefore deserve extra care:

  • Canonical units affect imports, armies, TO, gameplay reporting and admin
  • Games sit between app UI, SQL runtime state, tournaments and stats
  • Users affect auth, ownership, TO operations, admin and subscriptions
  • Tournament scoring systems affect event setup and standings calculations

Interaction style summary

Interaction Primary style
App → APIRequest/response, page-level orchestration
TO → APIOperational workflow orchestration
API → SQLValidation + write/read orchestration
Admin → SQL via APIHigh-impact maintenance/configuration
Docs → allHuman-readable system map