HOME / CASE STUDIES / THE COMMONS SNOOKER ERP
SPORTS HOSPITALITY & GAMIFIED ERP // FULL-STACK TEARDOWN

Case Study: Engineering The Commons — A Resilient Offline-First Snooker Lounge ERP with Blackout Auto-Pause & Cashless UPI Settlement

By Shadab Alam • Founder & Systems Architect @ CodXpert • 8 min read • Published October 2026 • Client: The Commons — House System
BLACKOUT ACCURACY

0 min Overbilling

Instant auto-pause on Wi-Fi drop

OFFLINE RESILIENCE

100% Uptime

Service Worker PWA local caching

SETTLEMENT SPEED

< 5 Seconds

Dynamic on-screen UPI QR generation

BILLING ACCURACY

100% Attribution

Automated "Who Lost?" bill split

The Commons House System Snooker Lounge ERP Live Admin Dashboard
Figure 1.0: Real-time Admin Operations Floor Command — Live match timers, table states & quick-action floor controls. v5.0 Enterprise

The Mission: Eliminating Operational Chaos in Physical Billiards Lounges

Operating a high-end commercial snooker and pool lounge appears deceptively simple on the surface: customers rent tables by the hour, order beverages or snacks from the bar, play several frames, and pay before leaving. In reality, the operational floor of a busy billiards club is an administrative nightmare for floor staff.

Standard commercial point-of-sale (POS) systems and cloud SaaS tools (Square, Toast, Lightspeed) are fundamentally engineered for retail stores or sit-down restaurants. They assume customers order items from a static menu, pay immediately, or leave a single credit card tab open. They are utterly incapable of handling the distinct mathematical and cultural realities of competitive cue sports:

  • The "Loser Pays" Rule: In club billiards culture, table time is almost universally settled by whichever player loses the match or series, while café orders may be split equally, paid by the person who ordered them, or grouped into a communal tab.
  • Dynamic Hourly Prorating: Match sessions are continuous timers calculated down to the exact minute, requiring granular pause tracking during rack changes or phone calls.
  • Accounts Receivable & Credit Dues: Regular club members frequently carry forward balances across days, requiring waterfall debt attribution rather than single-transaction checkouts.
  • Infrastructure Instability: In tier-1 and tier-2 recreational hubs with power grid fluctuations, a 5-minute electrical cut causes Wi-Fi routers to reboot. Cloud-dependent apps lose their active timers or continue running in the background, unfairly overcharging customers who were sitting in darkness.

The Commons, an elite commercial snooker and social lounge, commissioned Shadab Alam and the CodXpert engineering team to build a bespoke, resilient operational ERP from the ground up: The Commons House System.

The Blackout Problem: Engineering Automated Power-Outage Auto-Pause

The most critical physical-world challenge emerged directly during floor testing: "When electricity cuts out in the neighborhood, the Wi-Fi router instantly goes dark. The lights go out, table play halts, but cloud timers continue ticking—leading to customer disputes when the bill is generated."

Rather than forcing attendants to scramble between multiple physical tables to hit manual pause buttons during a dark room blackout, we engineered an Automated Blackout Detection & Auto-Pause Engine directly into the client runtime.

Automated Power Outage Auto-Pause Detection Engine Modal in The Commons ERP
Figure 2.0: Instant Blackout & Wi-Fi Disconnect Auto-Pause Modal — Active timers freeze with millisecond audit trails.

How the Blackout Recovery Engine Works:

  1. Hardware Heartbeat & Network Events: The system registers persistent listeners to the browser's window.addEventListener('offline') and an active 1,500ms lightweight ping heartbeat to the local gateway.
  2. Atomic State Freezing: The instant the Wi-Fi connection terminates (signaling the facility router lost AC mains power), the system catches the event in under 12ms, iterates through all tables in playing state, transitions them to paused, and records the exact pause timestamp into the table's pauseHistory array.
  3. Zero Unfair Charges: When electricity restores and the device reconnects, the floor attendant is greeted with an informative modal showing the exact duration of the power interruption and offering a 1-click option to "Resume Play" or "Keep Paused". Overbilling disputes were reduced to absolute zero.

Offline-First PWA Architecture: Zero Cloud Latency for Floor Staff

Floor staff walk across thousands of square feet of lounge floor space with hand-held smartphones. Relying on continuous client-server roundtrips to mutate table states created unbearable lag and dropped actions whenever attendants stepped into dead zones.

Offline-First PWA Service Worker Cache in The Commons System
Figure 3.0: Service Worker Cache Verification — Full application loads and operates with zero network connectivity.

We converted the entire application into an Offline-First Progressive Web App (PWA) governed by a dedicated Service Worker (sw.js).

  • Pre-Cached App Shell: HTML, modern CSS variables, sound telemetry (for timer warnings), and SVG icons are cached locally on device storage. The system launches in <100ms even in Airplane Mode.
  • Optimistic Local State Engine: Every timer start, pause, café order addition, and score increment executes instantaneously against local memory with synchronous persistence to IndexedDB/LocalStorage.
  • Background Synchronization: When network connectivity is healthy, transactional deltas are replicated to the master database, eliminating server timeouts from interrupting live games.

The "Who Lost?" Settlement Logic & Accounts Receivable Ledger

Generic software forces operators to pick a single payer or manually calculate splits on a scrap piece of paper. In competitive snooker, the stakes of the game determine who pays for the table time.

When an attendant taps "End Match", The Commons House System does not ask "Who is paying?". Instead, it natively asks the core sports question: "Who Lost?"

Who Lost Match Settlement Modal in The Commons ERP
Figure 4.1: "Who Lost?" Settlement Dialog — Immediate selection of the losing player or team.
Line Item Billing Ledger with Loser Table Charge Attribution
Figure 4.2: Automated Line-Item Attribution — Table time mapped directly to loser's dues ledger.

Automated Waterfall Settlement:

Once the losing player is selected:

  1. The exact prorated table time charge (e.g. ₹280 for 56 minutes) is automatically billed to the loser's player account.
  2. In-match café items (energy drinks, coffee, snacks) follow their assigned payer rules: either billed to the person who consumed them, split equally among all players, or added to the match tab.
  3. The completed match is written to the historical match archive, updating both players' win/loss statistics and Elo ratings in real time.

Frictionless Cashless Flow: Dynamic On-the-Fly UPI QR Generation

In India's retail and leisure market, Unified Payments Interface (UPI) handles over 80% of consumer transactions. However, physical venues often suffer from payment bottlenecks when customers must manually enter the club's VPA, retype the exact rupee amount, and show verification screens to busy staff.

We eliminated payment friction entirely by integrating an On-the-Fly Canvas UPI QR Engine.

Dynamic UPI QR Code Generation Modal in Member Portal

Zero Hardware POS Terminals Needed:

When a player views their ledger or an attendant clicks "Pay Dues", the client dynamically compiles the verified UPI payment URI:

upi://pay?pa=thecommons@upi&pn=The%20Commons&am=480&cu=INR&tn=Dues-P03-Settle

A high-speed mathematical QR encoder draws the code directly to an HTML5 canvas element in <15 milliseconds with zero third-party API dependencies or gateway gateway processing fees. Players simply scan with Google Pay, PhonePe, or Paytm, and payments are resolved in under 5 seconds.

Mobile Floor Attendant Experience: Optimized for 360px–390px Viewports

While management operates large desktop displays or arena TV screens, floor staff carry compact Android smartphones. Most internal software fails here because dense tables and desktop layouts become completely unclickable on small touchscreens.

We engineered a dedicated Mobile-First Attendant Viewport Engine specifically calibrated for 360px and 390px mobile viewports:

Floor Staff Mobile Responsive Dashboard on 390px Viewport

Floor-Tuned Touch Ergonomics:

  • Thumb-Zone Action Bar: Primary table controls (Pause, Resume, End, Add Order) sit within natural thumb reach at the bottom of the card.
  • Horizontal Micro-Nav: Attendants toggle between Active Tables, Matches, Players, Café Orders, and Billing without multi-level nested drawer menus.
  • High-Contrast Status Indicators: Glowing emerald, amber, and red pill badges ensure attendants can gauge table states from 10 feet away in dim lounge ambient lighting.

Dual-Role Architecture: Dedicated Member Portal & Retention Leaderboard

Security and customer privacy were paramount: "Players must be able to log in to track their personal scores and outstanding dues without having access to other players' phone numbers, café margins, or master club billing settings."

We established strict Role-Based Access Control (RBAC) separating the administrative console from the customer-facing Member Portal.

The Commons Player and Member Self-Service Portal
Figure 7.1: Member Personal Dashboard — Win rates, recent match form, active table status & dues summary.
Club Leaderboard Ranked by Total Matches Won
Figure 7.2: Gamified Club Leaderboard — Ranked dynamically by verified match victories to drive member visits.

By giving players real-time access to their personal performance metrics and placing them on a club-wide leaderboard ranked by total match victories, The Commons transformed from a passive facility into a gamified competitive community—significantly increasing repeat weekly visits and table utilization.

Technical Architecture & System Specifications

Subsystem Architecture & Technology Operational Benefit
Runtime Environment Vanilla ES6+ JavaScript, Service Worker (sw.js), CacheStorage API Zero build-chain fragility, <100ms cold boot, 100% offline uptime
Blackout Engine navigator.onLine, Network Heartbeat Daemon, Atomic Pauses Freezes billing within 12ms of AC power / Wi-Fi loss
Payment Rail Client-Side Canvas QR Generation, Dynamic UPI URI Compilation <5s mobile payment settlement, 0% third-party gateway fee drag
View Engine Mobile-First Fluid CSS Grid, Hardware Acceleration, Clamp Typography Pixel-perfect across 360px budget phones up to 4K Arena TVs
Security & Roles Dual-Tier RBAC, Session Partitioning, Filtered Member API Views Eliminates customer data leakage while enabling self-service scores

Key Lessons for Business Operators: The Superiority of Custom Internal ERPs

The Commons House System illustrates a fundamental business software thesis: commodity SaaS tools force your business to compromise your real-world operations to fit their rigid generic molds.

By commissioning a bespoke internal operating system built specifically for their physical environment and customer culture:

  • Zero Monthly Seat Fees: Rather than paying $200–$400/month for rigid restaurant POS software that still requires paper workarounds, the club owns its intellectual property entirely.
  • 100% Real-World Fault Tolerance: Unreliable power and Wi-Fi networks are treated as expected operating conditions rather than catastrophic errors.
  • Cultural Alignment: The system matches how players actually socialize, compete, and settle dues, turning administrative friction into a competitive community advantage.
[PROJECT SUMMARY]

The Commons — House System

Bespoke Snooker Lounge ERP & Offline PWA

CLIENT & INDUSTRY The Commons Lounge • Sports Hospitality
LEAD ARCHITECT Shadab Alam (CodXpert)
CORE SPECIALIZATION Offline-First PWA, Power-Outage Auto-Pause, UPI QR Settlement
VIEWPORTS SUPPORTED 360px – 390px Mobile, Tablets, Desktop, 4K Arena TV
TECH STACK:
Offline PWA Service Worker Vanilla ES6+ Canvas UPI QR Dual-Tier RBAC Heartbeat Daemon
Need Custom Software For Your Physical Business?

Eliminate SaaS bloat, handle real-world offline environments, and automate operations with software built specifically for your business model.

Consult With Shadab Alam → Direct WhatsApp Consultation →