The Dual-Database Pipeline
PCMTG operates on a fully serverless, event-driven topology within the Google Cloud Platform (GCP)[cite: 438]. Operating a high-speed NoSQL database alongside a rigid relational ledger introduces the classic distributed systems challenge: Eventual Consistency and State Synchronization[cite: 499].
1. Live Game State (Firestore - NoSQL)
Firestore is optimized for massive parallel reads and real-time websocket pushes, used strictly for “in-flight” data like the active Poker Tables[cite: 507].
The Secret Vector Exploit: Firestore client SDKs fetch entire documents[cite: 514]. To prevent players from reverse-engineering the math via Chrome DevTools, the secret_vector is placed in an air-gapped private subcollection (secure_data/solution) that is locked down by Firestore Security Rules and only accessible via the Cloud Run Admin SDK[cite: 516, 517, 520, 530].
2. Core Economy (Neon Postgres - SQL)
The persistent economy requires ACID compliance, ensuring a player cannot spend the same currency twice[cite: 470, 471]. This database handles the CardMasterRegistry and the DynamicExchangeLedger[cite: 471].
3. The Resolution Bridge
The Next.js client never writes directly to Cloud SQL[cite: 502]. Instead, Cloud Scheduler triggers the Cloud Run GameLogicManager, which reads the final Firestore state, calculates the math, opens a secure SQL transaction, and only then updates the Firestore table status[cite: 504, 505].