
Template details
Trivia Time
A full-stack web application built with Next.js 13, Supabase, and Prisma. Play AI-generated trivias about art, entertainment, geography, history, and science.
About this template
Trivia Time is a full-stack Next.js 13 web application for playing AI-generated trivia quizzes, where players choose from art, entertainment, geography, history, or science and compete on a global leaderboard. The project combines Supabase for data storage, Prisma as the ORM, NextAuth for authentication, and OpenAI's GPT API for on-the-fly question generation.
What is Trivia Time?
Trivia Time is a full-stack web application built with Next.js 13, Supabase, and Prisma. It accepts a selected trivia topic from the player, generates questions using OpenAI's GPT API, and returns an interactive quiz interface styled with Chakra UI. The app runs on Vercel and is linked at triviatime.vercel.app, with the source code published on GitHub.
Key Features
- AI-generated trivia — Each quiz is produced by OpenAI's GPT API, so the questions are dynamically machine-written rather than pulled from a fixed question bank.
- Five topic categories — Players can choose art, entertainment, geography, history, or science, giving the generator a focused subject area.
- NextAuth authentication — Sign-in, session management, and account persistence are handled by NextAuth/Auth.js, enabling personal identity for leaderboard scoring.
- Supabase database with Prisma — User records, quiz results, and leaderboard data are stored in Supabase's Postgres database and accessed through the Prisma ORM.
- Global leaderboard — Scores from all players are ranked, supporting the "compete with people around the world" experience.
- Form validation with Zod and React Hook Form — All input forms are validated using Zod schemas combined with React Hook Form for type-safe responsive forms.
- Chakra UI interface — The user interface is built with Chakra UI, providing prebuilt accessible components such as buttons, modals, and forms.
- React Email and Zustand — React Email powers email templates (e.g., for notifications), and Zustand handles lightweight client-side state management.
Who is it for?
Trivia Time is made for trivia players who want to test their knowledge across several topics and measure themselves against other players via a leaderboard. It also serves developers who want to study a complete Next.js 13 application that integrates Supabase, Prisma, NextAuth, and the OpenAI API in a real project. Additionally, educators or event organizers can use the app or its code as a base for running quiz sessions with AI-generated content.
What can you do with Trivia Time?
- Trivia enthusiasts: play quizzes in their favorite categories and try to outscore players around the world on the global leaderboard.
- Developers: explore a production-style codebase that shows how to wire Next.js 13 App Router (or pages, depending on the version) to a Postgres database via Prisma and call external APIs like OpenAI.
- Educators and content creators: use the AI question generation engine to build quizzes for classrooms, study groups, or community events.
FAQ
What tech stack does Trivia Time use?
The core stack is Next.js 13 for the framework, Chakra UI for styling, NextAuth for authentication, Supabase for the database, Prisma for database access, OpenAI's API for question generation, React Email for email content, React Hook Form with Zod for forms, and Zustand for state management.
How does the trivia generation work?
When a player selects a topic, the application sends a prompt to OpenAI's GPT API asking for trivia questions on that subject. The returned questions are then displayed in the quiz interface, and player answers are scored against the expected responses.
Can I deploy Trivia Time myself?
Yes. The source code is public on GitHub and can be self-hosted. You will need to configure your own Supabase project and provide your own OpenAI API key, as well as set up NextAuth providers for authentication.
Is Trivia Time free?
The public demo at triviatime.vercel.app is freely accessible to play. The open-source repository contains no mention of paid tiers, though self-hosting requires your own API keys which may incur usage costs from OpenAI and Supabase.
What categories are available?
The game currently supports art, entertainment, geography, history, and science. There is no indication in the source of additional categories, but the AI generation engine can be extended by modifying the prompts.
















