Vibe Coding 101: Trivia & Tunes
Build a home trivia game that feels like a real hosted event — using AI tools for scaffolding, refactoring, and asset generation. A practical look at shipping software fast without spaghetti.
Why this existed
The idea was simple: build a home trivia game that feels like a "real" hosted event — music cues, rounds, pacing, scoring, and just enough structure that you can repeat it with friends without rebuilding everything each time.
The bigger goal: use it as a controlled test to prove a workflow for shipping software fast without turning it into spaghetti. That meant making early decisions that production apps need (data model, authentication boundaries, input validation, error handling, and deployment basics), even while the prototype was still "fun."
Inspiration lives at triviaandtunes.no.
Stack & tools
- PHP + MySQL for fast iteration, predictable hosting, and a clean request/response model.
- Linux for deployment and ops sanity.
- VS Code as the IDE layer, with AI tooling integrated into the workflow.
- Cursor for agent-style scaffolding and iterative code generation/refactors.
- Claude Code for deep codebase-aware edits, command-running workflows, and systematic cleanup.
- ChatGPT + Gemini for brainstorming, UX copy, edge-case testing, and rapid iteration.
The key point is the division of labor: one tool to scaffold, one to refactor hard, one to sanity-check, one to generate assets, and a human to make product decisions.
The build workflow
- Define the playable core before writing code: What does the host do? What does the player see? How do rounds advance? How is scoring stored?
- Build the spine first: Routes/pages (landing → new game → join game → play rounds → results), session concept, minimal admin controls.
- Use AI in short, testable loops: Generate a small feature slice. Run it. Break it on purpose. Fix the failure mode. Refactor immediately if a pattern repeats.
- Promote prototype code to real code: Prepared statements everywhere. Clear naming conventions. Consistent error handling. Small reusable components.
Data model that made it real
The moment the prototype stopped being a toy was the database design. A home trivia game needs more than "questions" — it needs a structure that preserves fairness, supports retries, and explains results.
Core entities
- Users: host accounts and/or player profiles.
- Game sessions: a unique instance of a game night.
- Teams / players: who is in the room and who belongs to what.
- Rounds: the pacing layer (music round, trivia round, picture round).
- Questions: prompts, choices, accepted answers, difficulty tags.
- Answers: player/team submissions with timestamps and scoring state.
- Scores: computed totals, overrides, tie-break rules, and audit notes.
Why it matters: Auditability ("Why did we get 7 points?"), Flexibility (add round types without rewriting), Speed (instant host UI), and Integrity (relational constraints prevent phantom teams or orphaned answers).
The home-game loop
- Host creates a game session (title, round pack, optional music mode).
- Players join (link/code), pick team names, and confirm readiness.
- Rounds run with a clear timer/pacing model.
- Submission window: teams enter answers.
- Reveal and score: accepted answers display, points apply, standings update.
- Final screen: winners, highlights, and shareable recap.
Music integration is treated as a round ingredient — not the whole app. That keeps the system usable even when the music source changes.
Polish: UX, vibe, and guardrails
- Host-first UX: fewer clicks, larger controls, readable at distance.
- Player clarity: obvious "where are we in the game?" indicators.
- Fast styling: a consistent smoky/jazzy tone without heavy front-end frameworks.
- Guardrails: validate inputs, throttle risky actions, avoid "the night is ruined" bugs.
Deployment notes
The app targets the practical reality of PHP hosting: Linux servers, common control panels, and simple deploy steps that don't require a DevOps team.
- Environment config: database credentials, base URL, mail settings.
- File permissions: uploads, logs, and cache directories.
- Backups: database dumps + upload folders before big updates.
- Security baseline: session hardening, prepared statements, and sane server defaults.