LANtern
A LAN-based multiplayer trivia game with real-time WebSocket gameplay and dual-database support.
Problem
Needed a local-network multiplayer trivia game that could run entirely within a LAN — no cloud dependency, no latency from remote servers. Players should be able to join from any device on the same network and compete in real time.
What I Built
A full-stack trivia game with a Bun + Elysia backend handling WebSocket connections via Socket.IO, and a React frontend for the player interface. The server manages game rooms, question rounds, scoring, and real-time state synchronization across all connected clients.
The application supports dual database backends — SQLite for local/development use and PostgreSQL for production — allowing flexible deployment without code changes.
Stack
- Runtime: Bun
- Backend framework: Elysia
- Frontend: React with TypeScript
- Real-time: Socket.IO (WebSockets)
- Databases: SQLite (local), PostgreSQL (production)
What I Learned
- Managing real-time state across multiple WebSocket clients requires careful synchronization to prevent race conditions during scoring.
- Bun’s native SQLite driver is significantly faster than Node.js equivalents for local game state persistence.
- Supporting dual databases forced a clean abstraction layer that made the codebase more portable.
Outcome
A working multiplayer game that runs over any local network. Players join via a room code, answer timed questions, and see live leaderboard updates.