Truths & Lies: Teaching AI to My Son
An AI-powered trivia game I built with my 8-year-old son to teach him prompt engineering. Powered dynamically by the Google Gemini API.

Truths and Lies Interface Screenshot
Take a screenshot of your active application on your Mac (e.g. using Cmd+Shift+4) and save it as truths-and-lies.png inside the /public/images/ folder to replace this placeholder!
Project Tech Stack
What We Built
Truths and Lies is an interactive two-truths-and-a-lie trivia game. Instead of relying on a pre-written database of questions, the game connects to the **Google Gemini API** to generate trivia dynamically.
Players select a division (Children, Teens, or Adults) and a category (like Sports, Movies, Science, History, or Music), and Gemini instantly cooks up three facts where exactly one is a lie. The challenge is to find the lie without clicking a truth!
Coding as a Family
This app started as a fun, educational way to teach my 8-year-old son how programming and AI work. He came up with the core ideas—choosing categories like Sports Stars and Movies, setting up a Hall of Fame leaderboard, and designing how the badges should look.
Together, we expanded the solo game into a real-time classroom multiplayer experience:
- Writing System Instructions: Learning how to prompt Gemini so that it instructs the LLM to output structured JSON data containing exactly one lie, without giving away which index is correct.
- Smartboard & Live Contest Suite: Designed for teachers to project educational warm-ups on a Smartboard or run 15-second speed contests where students scan a QR code to answer on their own devices.
- AI-Assisted Nickname Moderation: A safety pipeline using Gemini-2.5-flash to screen student lobby names in real time, automatically blocking profanity, crude numbers, and Gen Alpha brainrot slang (like *skibidi* or *gyatt*).
- Zero-Friction Guest Mode: Automatically creates mock sessions on landing, letting users jump straight into gameplay without completing email registrations.
Under the Hood
Dynamic Gemini Prompting
Calls Gemini dynamically using system instructions to enforce JSON returns, separating content delivery from validation checks.
AI Classroom safety
Uses strict K-12 moderator system instructions with JSON response schemas to identify cuss evasions, inappropriate numbers, and meme slang.
Live Lobby speed leaderboard
Provides a real-time lobby where answers submitted via mobile devices calculate score metrics based on response speed.
Neon Serverless DB
Stores live lobbies, user profiles, streaks, and unlocked badges in a scalable relational database with Jose-backed JWT auth tokens.