A real-time multiplayer trivia game. No backend or server required — just three HTML files, a free Firebase project, and somewhere to host them.
Players join from their phones using a 6-character game code. The host controls the game from a dashboard. Scores update live as answers come in.
Firebase is the free real-time database that syncs game state between the host and all players.
my-trivia-night), and click through the setup steps. You can turn off Google Analytics when prompted — it’s not needed.Test mode allows all reads and writes for 30 days. You will set proper rules in Step 4 before that window expires.
firebaseConfig object that looks like this:
const firebaseConfig = {
apiKey: "AIza...",
authDomain: "your-project.firebaseapp.com",
databaseURL: "https://your-project-default-rtdb.firebaseio.com",
projectId: "your-project",
storageBucket: "your-project.firebasestorage.app",
messagingSenderId: "123456789",
appId: "1:123456789:web:abc123"
};
You need to paste your config into three files. Open each file in a text editor and find the firebaseConfig block (it is near the top of the <script> section). Replace every placeholder value with your real values from the Firebase console.
Files to edit:
trivia_night_host_dashboard.htmltrivia_night_player.htmltrivia_night_games.htmlIn each file, find this block and replace it:
const firebaseConfig = {
apiKey: "YOUR_API_KEY",
authDomain: "YOUR_PROJECT_ID.firebaseapp.com",
databaseURL: "https://YOUR_PROJECT_ID-default-rtdb.firebaseio.com",
projectId: "YOUR_PROJECT_ID",
storageBucket: "YOUR_PROJECT_ID.firebasestorage.app",
messagingSenderId: "YOUR_MESSAGING_SENDER_ID",
appId: "YOUR_APP_ID"
};
Replace each YOUR_... placeholder with the matching value from your Firebase project. All three files must have the same config — they all talk to the same database.
Note on API keys: The Firebase
apiKeyis safe to put in a public GitHub repo. It is not a secret — it just identifies your project. Security is handled by Firebase Security Rules (which you will set up next), not by hiding the key.
The default test mode rules expire after 30 days and then lock out all users. Follow these steps to set permanent rules that keep the game working.
{
"rules": {
"games": {
".read": true,
".write": true
},
"templates": {
".read": true,
".write": true
}
}
}
These rules allow full access to the /games and /templates paths (which the app uses) and block everything else. Since this app has no login system, the game code is the only access control for active games.
You have two main options depending on your situation.
Best for: hosting a permanent public URL that anyone on the internet can reach.
trivia-night)main and folder to / (root)https://YOUR_GITHUB_USERNAME.github.io/trivia-night/
https://YOUR_GITHUB_USERNAME.github.io/trivia-night/trivia_night_host_dashboard.htmlhttps://YOUR_GITHUB_USERNAME.github.io/trivia-night/trivia_night_player.htmlhttps://YOUR_GITHUB_USERNAME.github.io/trivia-night/trivia_night_games.htmlYOUR_GITHUB_USERNAME.github.ioBest for: running a game at a party or event where everyone is on the same Wi-Fi network. No internet required after setup.
What you need: Python (comes pre-installed on Mac and most Linux systems; download from python.org on Windows).
cd path/to/your/trivia-night-folder
python3 -m http.server 8080
python -m http.server 8080
192.168.x.x)ipconfig in Command Prompt, look for IPv4 Addressip addr in terminal, look for inet under your Wi-Fi interfacehttp://YOUR_LOCAL_IP:8080/trivia_night_host_dashboard.htmlhttp://YOUR_LOCAL_IP:8080/trivia_night_player.htmlFor example: http://192.168.1.42:8080/trivia_night_host_dashboard.html
Ctrl + C in the terminal.Firewall note: If players can’t connect, your system firewall may be blocking port 8080. On Windows you may see a prompt asking to allow access — click Allow. On Mac you may need to go to System Settings → Network → Firewall and temporarily allow incoming connections, or just allow the Python app when prompted.
Firebase still needs internet: The game state syncs through Firebase, so everyone (host and players) needs internet access even on a local setup. The local server just serves the HTML files — Firebase handles the real-time sync.
The Session Manager (trivia_night_games.html) is an admin page that shows all active and recent games in real time. It requires a GitHub login and is restricted to a single GitHub username that you specify.
To set it up:
trivia_night_games.html in a text editor and find this line:
const ALLOWED_GITHUB_LOGIN = 'YOUR_GITHUB_USERNAME';
Replace YOUR_GITHUB_USERNAME with your actual GitHub username (case-sensitive).
http://localhost:8080 for local)https://YOUR_PROJECT_ID.firebaseapp.com/__/auth/handler
(replace YOUR_PROJECT_ID with your actual Firebase project ID)YOUR_GITHUB_USERNAME.github.io (for GitHub Pages) or localhost (for local)Once set up, only the GitHub account matching ALLOWED_GITHUB_LOGIN can sign in to the Session Manager. Anyone else sees an Access Denied screen.
Open the host dashboard in your browser. A unique 6-character game code is automatically generated.
Use templates (optional): Save your question bank as a named template to reuse across sessions. Load a template from the dropdown to restore a saved set.
Start the game by clicking Start Game. Questions are served one at a time.
Advance questions by clicking Next Question. The host dashboard shows all player responses and running scores in real time.
Rejoin support: If a player accidentally closes the tab, reopening the player URL will detect their existing session and offer to rejoin with their score intact.
| Layer | Tool |
|---|---|
| Hosting | GitHub Pages, Firebase Hosting, or any static file server |
| Database | Firebase Realtime Database (free tier) |
| Auth (Session Manager only) | Firebase Authentication + GitHub OAuth |
| QR codes | qrcodejs (runs entirely in the browser) |
Have a great set of trivia questions? Contribute a question bank to the community library.
This project was built and is maintained using Claude Code by Anthropic.