---
title: "Temporal Trivia"
description: "An incredibly durable game of multi-player trivia, powered by Temporal. Showcases a human-in-the-loop workflow that uses GenAI for trivia Q&A generation, and workflows to maintain and control the state of the game."
canonical: "https://temporal.io/code-exchange/temporal-trivia.md"
source: "https://temporal.io/code-exchange/temporal-trivia"
published: "2025-01-24"
authors:
  - "Keith Tenzer"
  - "Ci-Ci Thomson"
  - "Anthony Wong"
company: "Temporal"
languages:
  - "Go"
tags:
  - "fun"
  - "game"
  - "ai"
reviewed_by_temporal: false
community_contribution: true
---

# Temporal Trivia

An incredibly durable game of multi-player trivia, powered by Temporal. Showcases a human-in-the-loop workflow that uses GenAI for trivia Q&A generation, and workflows to maintain and control the state of the game.

- [View repo](https://github.com/temporal-sa/temporal-trivia)
- [View article](https://temporal.io/blog/the-making-of-temporal-trivia.md)
- [Watch video](https://www.youtube.com/watch?v=0sWz2CgvG7E)

<iframe width="560" height="315" src="https://www.youtube.com/embed/0sWz2CgvG7E?si=leiF31cDfW7gCdgL" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

A trivia game built durably on Temporal. This multi-user trivia-game was demoed at Replay 2023 to show off [Multi-Region Namespaces](https://docs.temporal.io/evaluate/development-production-features/multi-region-namespace). It is a very unique use of Temporal that uses GenAI and workflows to maintain and control the state of the trivia-game.

Players can create or join a game. Category, number of players, number of questions and even a challenge mode are all configurable. Once the game starts, players are presented with questions and multiple choice answers (generated by ChatGPT). They submit their answers and results are shown including a final score once the game completes.

This demo primarily shows a fun way to see the *human interaction* features of Temporal, demonstrating developer velocity by delivering a lot of scalability and features by leveraging Temporal features.

Our design goals:

- Scale to millions of users
- Support multiplayer and unlimited number of games
- Build using polyglot
- Maintain game state and durability when things break
- Timeout mechanism for questions
- Single source of truth for game logic
- Do it all in a few hundred lines of code!

Problems Solved:

- State Management
- Entity Pattern (Player/Game)
- Controller (Game Loop)
- Durability

## Workflow Design
![Temporal Trivia Workflow Design](https://images.ctfassets.net/0uuz8ydxyd9p/23XAwcV1J4p65hEm4hc3Po/b444644ccadd2624f6efc4bf05c292af/Temporal_Trivia_Workflow_Design.png)
