Back to Home
AI & Family Collaboration

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.

Status: Active Family Project Co-Creator: My 8-Year-Old Son
Truths and Lies Application Interface Screenshot

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

Next.js 16TypeScriptGemini APINode PostgresNeon ServerlessTailwind CSS

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 explored how to collaborate with AI:

  • 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.
  • Targeting Content: Teaching the model to adapt questions based on age—generating Elsa and Superhero questions for kids, and classical music or deep tech trivia for adults.
  • Database Gamification: Setting up simple schemas on Neon to store user scores, streak milestones, and award achievements (like getting 5 correct answers in a row).

Under the Hood

Dynamic Gemini Prompting

Calls Gemini dynamically using system instructions to enforce JSON returns, separating content delivery from validation checks.

Age Division scoreboards

Separates score submissions into three different leaderboard divisions to keep matches fair and fun for all players.

Local Mock Database

Implements an in-memory SQL simulator that mimics games, users, and achievements tables to make offline development possible.

Badge Unlock pipeline

Checks streak counts and login times after each turn to trigger badge awards, saving achievements to a relational user table.