firebase-realtime-patterns

Build real-time multiplayer Mahjong rooms with Firebase Realtime Database or Supabase.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/Teng-AI/mahjong --skill firebase-realtime-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: firebase-realtime-patterns
Source: https://github.com/Teng-AI/mahjong/tree/main/.claude/skills/firebase-realtime-patterns
Command: npx skills add https://github.com/Teng-AI/mahjong --skill firebase-realtime-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Patterns for implementing real-time multiplayer using Firebase Realtime Database (or Supabase).

Core Features & Use Cases

  • Room management (create/join/leave) with seat assignments and presence
  • Synchronized game state across clients, including phases and hand visibility
  • Security rules and presence handling to protect player data and room state
  • Debugging patterns for diagnosing sync issues and ensuring reliability

Quick Start

Start by wiring a Firebase or Supabase project, then initialize a room and begin listening to the game state.

Frequently Asked Questions about firebase-realtime-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage realtime multiplayer room presence and player disconnections in Firebase?

Firebase realtime multiplayer room presence is managed by applying connection state listeners and seat assignment schemas. This tracks the full room lifecycle, automatically handling player connections to manage create, disconnect, and reconnect events across synchronized clients.

What are the best security rules to protect private player hands in a Firebase realtime database?

Firebase realtime database security rules for multiplayer games restrict private hand visibility to the owning player while allowing public game state reads. This pattern uses data models and validation schemas to protect room data and prevent unauthorized access to hidden hands.

How do I synchronize game state and action sequencing for multiplayer calls using Supabase?

Synchronizing game state in Supabase uses schemas that sequence player actions during calls. This pattern manages synchronized phases and hand visibility across clients, ensuring reliable real-time updates and action sequencing for multiplayer gameplay.

Can I use Supabase instead of Firebase to build realtime multiplayer game rooms?

Yes, you can use Supabase instead of Firebase for realtime multiplayer game rooms. This pattern provides reference implementations for both platforms, allowing you to manage synchronized game state, player connections, and room lifecycles using either backend.

Why does my realtime game state desync across players during action calls?

Realtime game state desync during action calls occurs when client synchronization and action sequencing are not properly enforced. Debugging these sync issues requires validating data models, checking presence handling, and ensuring reliable state updates across all connected players.