Salary 4 Life: The Hustle

A complete IoT-powered TV game show platform with four synchronized interfaces, MQTT device coordination, and a Super Admin mission-control dashboard built under production pressure.

Role
Lead Frontend Developer
Timeline
Jul – Aug 2025
Stack
React · TypeScript · MQTT
Status
Shipped
The Hustle multi-role game platform preview
01The Problem

Live television has zero tolerance for sync failures.

The show depended on multiple screens behaving as one system: contestant devices, the host interface, audience displays, and production controls all had to move at the same pace. Before I redesigned the frontend architecture, the team was managing those surfaces through brittle flows that made devices drift apart, forced manual resets, and turned every rehearsal into a fire drill.

The most painful part was that failures were expensive in a way typical web apps are not. A contestant seeing the wrong question, or an audience screen freezing on an old state, could halt production for hours. By the time a problem was discovered, there was no central visibility into which device was wrong, why it failed, or how to recover it without physically walking across the studio.

One sync failure in a live production environment costs money and hours you cannot recover.
02Architecture

I approached the platform as a distributed system instead of a single app with extra screens. That changed the architecture completely: each interface got a focused role, state synchronization was centralized, and device monitoring became a first-class concern rather than an afterthought.

Four-interface role separation

I split contestant, host, audience, and admin experiences into distinct interfaces because they each carried different cognitive load and timing constraints. That let me simplify each UI around the exact decisions its operator needed to make instead of forcing one generalized interface to do everything poorly.

typescript
const UNIVERSAL_GAME_STEPS = {
  LOBBY: 'lobby',
  STAGE1_INIT: 'stage1_init',
  STAGE1_QUESTION: 'stage1_question',
  STAGE1_RESULTS: 'stage1_results',
  STAGE2_INIT: 'stage2_init',
};

const ROLE_VIEWS = {
  contestant: ['LOBBY', 'STAGE1_QUESTION', 'STAGE1_RESULTS'],
  host: ['LOBBY', 'STAGE1_INIT', 'STAGE1_RESULTS'],
  audience: ['LOBBY', 'STAGE1_QUESTION', 'STAGE1_RESULTS'],
  admin: Object.keys(UNIVERSAL_GAME_STEPS),
};

Each role consumed the same global progression model but rendered only the steps relevant to its operator.

Dual-channel MQTT architecture

Monitoring traffic and gameplay traffic had different reliability characteristics, so I kept them on separate topics. That prevented noisy status heartbeats from polluting the main control channel and made it easier to reason about failures during production.

typescript
useMQTTTopic('/game-sync/' + gameId, gameEventHandler);
useMQTTTopic('/monitoring/' + gameId, monitoringHandler);

const monitoringHandler = useCallback((message: MQTTMessage) => {
  if (message.event !== 'participant_connection_status') return;

  setDeviceStatuses((prev) => ({
    ...prev,
    [message.payload.participant_id]: {
      ...message.payload,
      lastSeen: new Date(),
      isConnected: true,
    },
  }));
}, []);

Control events stayed deterministic while monitoring remained verbose and observable on its own channel.

Universal step synchronization

The core insight was treating `universal_step_change` as the single source of truth for every screen in the system. Once every interface listened to the same event contract, synchronization became a repeatable product behavior instead of a fragile coordination trick.

typescript
export const useMQTTTopic = (topic: string, handler: (message: any) => void) => {
  const { client, isConnected } = useMQTT();
  const handlerRef = useRef(handler);
  handlerRef.current = handler;

  useEffect(() => {
    if (!client || !isConnected) return;

    const messageHandler = (receivedTopic: string, payload: Buffer) => {
      if (receivedTopic !== topic) return;
      handlerRef.current(JSON.parse(payload.toString()));
    };

    client.subscribe(topic);
    client.on('message', messageHandler);
    return () => client.off('message', messageHandler);
  }, [client, isConnected, topic]);
};

The reusable topic hook made sync logic portable across all four interfaces.

03The Hard Part

The Super Admin dashboard was born from a production disaster.

Our early rehearsals exposed a brutal reality: we could not tell which screen had drifted, and every recovery required someone to manually inspect devices one by one. The production team lost more than three hours in a single session trying to restore order because the system had no supervisory layer.

That failure reframed the problem. I stopped thinking of the admin interface as a nice-to-have and treated it as operational infrastructure. The Super Admin dashboard became the place where production could see connection health, force a universal state transition, and recover any single device without interrupting the rest of the show. That one addition turned chaos into a controllable workflow.

typescript
const changeUniversalStep = useCallback((newStep: string) => {
  sendMessage({
    event: 'universal_step_change',
    payload: { new_universal_step: newStep, force_sync: true },
  }, '/game-sync/' + gameId);
}, [sendMessage]);

const recoverDevice = useCallback((deviceId: string) => {
  sendMessage({
    event: 'device_recovery',
    payload: { target_device: deviceId, recovery_state: currentGameState },
  }, '/game-sync/' + gameId);
}, [currentGameState, sendMessage]);

The Super Admin could resync every screen or surgically recover a single failed device in seconds.

04Outcomes

90%

Setup Time Reduction

From 10-15 minutes to 1-2 minutes

100%

Sync Failures Eliminated

Zero production failures post-launch

90s

Issue Resolution

vs. up to 3 hours manually

100+

Simultaneous Participants

Real-time audience interaction

This project taught me that real-time UX is inseparable from operational visibility. Redundancy, live monitoring, and instant recovery were not extras, they were the product. The MQTT hook and synchronization model I built here became reusable infrastructure for every realtime system I touched after it.