The problem
A simulation is a useful place to study what happens when concurrent requests attempt to change the same state. The browser should request a decision, not dictate its result.
How the system fits together
Server routes validate player choices. A PostgreSQL transaction locks the game row, computes the next quarter, writes a historical ledger, and updates the current snapshot. Optional summaries run outside that transaction.
Decisions that matter
- Keep the database authoritative for the state transition.
- Combine a fast current snapshot with an append-only history.
- Separate optional background features from the core transaction.
Scope and evidence
This case study describes the documented project and its engineering approach. It does not imply independently measured business results or a service-level guarantee.
Discuss the architecture