Building a Multiplayer Quiz Game with AI Using AWS Serverless

Building a Multiplayer Quiz Game with AI Using AWS Serverless

Building a live multiplayer quiz app on AWS, with AI generated questions for any topic

Building Trivolt: a serverless multiplayer GenAI quiz game on AWS, designed with Claude Code

By Bryce Cummock, AWS Community Builder



From QuizDash to Trivolt

A little over a year ago, I had the privilege of demonstrating QuizDash at AWS Community Day Aotearoa NZ 2025.
QuizDash was a live, online multiplayer game built entirely on AWS serverless services and based on the classic Maths game FizzBuzz. In the style of Kahoot!*, a host would start a game in their browser and players would join by entering the session code shown on screen, along with a nickname. The host would start the game once everyone had joined. The server would then pick a random player and display a random number between 1 and 100. That player would then have five seconds to press one of four buttons: Fizz for a multiple of 3, Buzz for a multiple of 5, FizzBuzz for a multiple of both, or Pass for neither. If the answer was incorrect to the time elapsed then every player's screen shows "Boom! <player> is out" (or "Boom! you're out" if you were the player) . The last player remaining wins.


Figure 1: QuizDash during a scaling test, with the host screen on the left and two test players on the right.
The game was built to demonstrate Amazon API Gateway WebSocket APIs as a scalable, robust way to deliver a real-time experience with two-way communication, in contrast to REST. Alongside it, I used Amazon S3 and Amazon CloudFront (with AWS Amplify authentication libraries) to host the Angular front end, AWS Lambda functions written in Node.js and TypeScript for the game logic, and AWS CloudFormation to define the Infrastructure as Code. I was able to lean on my AWS development background and earlier open-source projects to build it.
On the day, the game was fast and fun, and it crowned a winner within five minutes. Since then I've often thought about extending it with interactive quizzes on any subject, possibly using GenAI to generate the questions. As an outside-of-work interest, though, the main constraint was time.
A year on, GenAI development tools have multiplied and they keep improving. I've also gained hands-on experience with AWS Bedrock AgentCore development, alongside Kiro CLI and Claude Code - including with Matt Pocock's  grill-with-docs  skills, and seen how these GenAI development tools can greatly reduce the time needed to design and develop an application. So using these, I decided to revisit the challenge. The result is Trivolt: a multiplayer quiz game where the host enters a topic and difficulty, GenAI generates the questions, and players are scored on both correct answers and how quickly they respond.

Trivolt home page

Figure 2: Trivolt's home page.

In this post I'll first cover my selected GenAI tooling: Claude Code with the grill-with-docs skill, with this being the tool I currently have the most experience with. I'll come back to how Kiro could complement it at the end. Next, I'll walk through the AWS services behind Trivolt, with my evaluation of design choices and trade-offs. Finally, I'll share the lessons I learned along the way.
The code, design documents and full design transcripts are publicly available at  github.com/cirruscape/public-app-trivolt .




Designing Trivolt with Claude Code and grill-with-docs

grill-with-docs is a free Claude Code skill which is available for download and easy installation from:  https://www.aihero.dev/skills-grilling. . It works by interviewing you about the design over several rounds of questions. For each it recommends an answer, but it provides possible alternatives to select from, and the option to enter your own. It also writes the agreed decisions into documentation as it goes.
From a Ubuntu bash prompt, starting the design (or 'grill session') was as simple as running this from an empty ~/dev/quiz-app directory:
p:~/dev/quiz-app$ claude
▐▛███▛█ Claude Code v2.1.312
▝▜██████▀ Opus 5.5 · Claude Pro

❯ /mattpocock-skills:grill-with-docs

Claude guessed from the directory name that I wanted a quiz app. It then asked clarifying questions in rounds, each with a recommended answer, alternative options, and the chance to enter my own.
The full session ran to 11 rounds and nearly 50 questions. I asked Claude to keep a record as it went, and you can read the transcripts in the repo's   grill_output  folder . The four excerpts below illustrate the process.

It recommends, but you decide

Claude's first guess was a classroom quiz. I wanted live trivia, and it reframed the rest of the design from this.
Q1 - What is a quiz app *for*? Who uses it and why?
(a) Self-study / spaced repetition
(b) Classroom / assessment: someone authors a Quiz, others take it
(c) Live party/trivia: a host runs a game in real time and players
answer on their phones, like Kahoot
-> I'd guess (b), author-and-take.

USER: Q1. c ... learning for small number of users currently, to be
deployed on AWS with serverless resources

CLAUDE: Live trivia changes the shape a lot. Your "yes" to Q2 was
answering a question I wrote for the author-and-take model, so I'll
reframe it rather than assume it carries over.
*Note here it already guessed that I may want to create a Kahoot-like quiz game, and added this as an option! *
It holds you to the shared Ubiquitous language. Every agreed term goes into  GLOSSARY.md , with words to avoid. When I drifted, Claude called it out.
CLAUDE: Two glossary issues come first.
- You said "Author". We settled that the Host writes and runs Quizzes,
with "Author" on the avoid list. I'll read "Author" as Host.
- You said "question set". Is that just a Quiz, or something distinct?

Your context overrides its defaults

Claude proposed Host moderation, the AWS CDK and deployment to the us-east-1 region. I specified Amazon Comprehend moderation, CloudFormation and ap-southeast-2 (Sydney) to override these. It then asked me to justify the CloudFormation choice so it could record my reason in an Architecture Decision Record (ADR), and it checked service availability in Sydney before going further.
Q43 - Why CloudFormation over CDK? This one is yours to answer, and
I'll record your reason in an ADR.

USER: Q41 - deploy everything to ap-southeast-2, Q43. developers are
highly-skilled in cloudformation already and is preference, not skilled
in CDK

[Claude searched for service availability in ap-southeast-2 and wrote
docs/adr/0004-cloudformation-sam-not-cdk.md]

It surfaces its own assumptions

When writing the functional requirements, Claude listed eight things we hadn't settled, made an assumption for each, and offered another round to confirm them. For example, it answered itself by checking the documentation: the Opus model is inference-profile only on Bedrock, so from Sydney it uses the  au.  geographic profile.

Design Outputs

The following key files were produced:
  1. A Product Requirements Document ( docs/PRD.md ), with 48 numbered functional requirements such as "FR-6.4: a second Answer from the same Player is rejected".
  1. A Glossary ( GLOSSARY.md ) of about 20 terms, so the code, the tests and the conversation all use the same words: Host, Player, Game, Join Code, Reveal.
  1. A Milestone Plan ( docs/PLAN.md ), from M0 (foundations and spikes) to M5 (production). I added M6 (custom domains) later.
  1. Architecture Decision Records ( docs/adr/ ) for each significant choice, such as  0001-quiz-generation-agent-on-agentcore.md  and  0002-appsync-events-for-live-play.md .
Looking back over the session, the split of decisions was clear. I chose live trivia, AI-generated Quizzes, the AgentCore and Strands stack, Comprehend moderation, CloudFormation and the Sydney region. Claude made the rest of the recommendations, and I accepted them round by round.




Building it, milestone by milestone

Subsequent grilling was performed by grill-with-docs to complete the following milestones that were recorded within the PLAN.md file:

M0: Foundations and spikes

The following resources are initially created as a foundational deployment:
  • DynamoDB table, for storage of Quizzes, Games and Game History
  • Cognito UserPool and UserPoolClient, for managing Host users
  • SecretsManager secret, for signing Players' JWT tokens (see Spike B)
  • ECR repository, for Docker image storage for the built quiz generation agent
  • Spike A: an AgentCore + Bedrock "hello" agent as a tracer for its implementation, i.e. a working skeleton that proves the end-to-end path to build on top of, plus a dev deployment pipeline using GitHub Actions.
  • Spike B: the AppSync Events Player authoriser. This tests that anonymous Players, using signed JWT tokens, can only subscribe to their own Game's AppSync channel to receive events, and can never publish. (It's a real investigation, as a spike rather than a tracer.) The following AWS resources are defined here: i. AppSync Events API ii. AppSync Events channel iii. Lambda function for Player authorisation
  • Implementing OIDC subjects, as a prerequisite to allow GitHub Actions deployments to the host AWS account.

M1: Domain rule implementation via TDD

  • Generates the TypeScript source code that provides the functional logic.

M2: Live play with a seeded Quiz, in four parts

  • M2a: the API core.
  • M2b: the API stack, seed script and API smoke test, which plays a whole Game on every deploy. Defines:
  • API Gateway (HTTP API)
  • API Gateway backing Lambda function
  • Health-check Lambda function
  • M2c: the web stack. Defines:
  • Web-hosting S3 bucket
  • CloudFront distribution
  • CloudFront Function (SPA route rewriter)
  • M2d: History. A finished Game is recorded with its revealed Questions and final Leaderboard.

M3: Quiz generation from a Topic

  • Defines a Lambda function, invoked asynchronously by the API, to invoke the AgentCore runtime.

M4: Moderation and remaining rules

  • Nickname moderation using Amazon Comprehend.
  • A sweeper lambda function that runs hourly, to finish idle Games.

M5: Production

  • Deployment pipeline
  • Budget alerts
  • Data protection

M6: Custom domain names

  • Defines Route 53 records, ACM certificates and an API Gateway custom domain, for hosting on trivolt.app.



Architecture

Trivolt is deployed as six AWS CloudFormation stacks per environment:  foundation ,  certs  (in region us-east-1, because CloudFront only accepts certificates from there),  agent ,  api ,  web  and  ops .
Trivolt architecture diagram

Figure 3: Trivolt infrastructure diagram, illustrating AWS resources used to build the solution.
The services are summarised below.
Service
What it does in Trivolt
Why it fits
Amazon S3 + Amazon CloudFront
Hosts the React web app. CloudFront also routes  /api/*  to the API, so the app and the API share one origin and need no CORS.
Global edge caching. The bucket stays private behind Origin Access Control. A CloudFront Function handles the app's routes and the  www.  redirect.
Route 53 + AWS Certificate Manager
Custom domains:  trivolt.app  for the site, and  api.trivolt.app  for direct API callers such as the smoke test.
DNS-validated certificates are created and renewed automatically, from CloudFormation.
Amazon API Gateway (HTTP API)
The app's REST-style API.
Lower cost and latency than a REST API. Its built-in JWT authoriser checks Host sign-ins before any code runs. The trade-offs: no direct AWS WAF integration, and no usage plans or API keys. Throttling is still available per stage and route.
AWS Lambda (Node.js 22, arm64)
The API, the generation worker, the abandonment sweeper, the health check and the real-time authoriser.
Pay per request, scaling to zero. Graviton (arm64) is cheaper per millisecond. Reserved concurrency caps how far each function can scale.
Amazon DynamoDB
Quizzes, Games, History and generation quotas, in a single table.
On-demand billing, single-digit-millisecond reads, conditional writes, and TTL to expire old data automatically.
AWS AppSync Events
Real-time push of "question opened", "answer revealed" and "game finished" to every screen.
Managed WebSocket pub/sub, with no connection IDs or fan-out code to manage. More on this below.
Amazon Cognito
Host accounts (email and password).
Managed sign-up, sign-in, password policy and tokens. Players stay anonymous.
Amazon Bedrock (Converse API)
The model that writes and checks Questions.
A choice of foundation models behind one API, so changing model is a configuration change.
Amazon Bedrock AgentCore Runtime
Runs the question-generation agent, built with the open-source Strands Agents SDK, in a container.
Managed, isolated, session-based agent hosting. Today a Lambda function could do this job, but AgentCore leaves room to grow: longer sessions for more verification rounds, tools for web fact-checking, memory, built-in tracing and metrics, and multi-turn sessions.
Amazon Comprehend
Checks Player Nicknames with  DetectToxicContent .
Machine-learning moderation with no model to train.
Amazon EventBridge Scheduler
Runs the sweeper hourly, finishing Games abandoned for 24 hours.
Serverless cron.
AWS Secrets Manager + SSM Parameter Store
The Player token signing key, and tunable settings such as the toxicity threshold.
Secrets stay out of code, and settings change without a redeploy.
AWS CloudFormation + AWS SAM
All infrastructure as code, in the six stacks above.
Repeatable environments: dev and prod come from the same templates.
Amazon CloudWatch, Amazon SNS, AWS Budgets
Alarms, metrics and cost alerts.
Built in, with nothing to host.

Why AppSync Events instead of API Gateway WebSockets

QuizDash used API Gateway WebSocket APIs, so this was the GenAI's decision that I was most interested in to provide server-to-browser communications. Trivolt splits the traffic in two: every command (join, answer, advance) is a plain HTTP request to Lambda, which updates DynamoDB and then publishes an event to the Game's AppSync Events HTTP-based channel. Browsers only ever subscribe to this.
Compared with API Gateway WebSockets, this removed 3 jobs I had to do myself in QuizDash:
  1. Connection tracking. With WebSocket APIs, the server has to store every connection ID in DynamoDB to allow replies later, and clean up stale ones. With AppSync Events, the server publishes to a channel and AppSync delivers to every subscriber.
  1. Fan-out. Sending one update to 50 Players means looping over 50 connection IDs and handling failures. With AppSync Events it's a single publish call.
  1. Channel security for anonymous users. Players don't have Cognito accounts. When they join, they receive a short-lived signed token, and a Lambda authoriser on AppSync Events lets that token subscribe to its own Game's channel only, and never publish. Hosts subscribe with Cognito, and only the backend can publish, using IAM. So the server stays the single source of truth.
There's one important trade-off, which the automated smoke test caught on its first runs against dev: AppSync Events delivers at most once, on a best-effort basis. All three bot Players missed an event that the Host received on the same channel. So events are treated as notifications, not as the record. Every client re-fetches a snapshot of the Game over HTTP on load, on reconnect, whenever an event's version number skips, and whenever an expected event is overdue. This is recorded in ADR 0002, and the smoke test reports how many events it had to recover.

Generating Trusted Questions & Answers

LLMs sometimes mark the wrong Option as correct. So the agent generates Questions, then verifies each one in a second step: is exactly one Option defensibly correct, and is the Question unambiguous? Questions that fail are dropped and regenerated. The Host then reviews the Draft Quiz, and can discard or regenerate individual Questions before approving it as Ready.

Figure 4: Sample quiz generation screen available to the host, based on their specified topic. The host is able to review each question, click Regenerate to select a new question, or discard a question completely before approving a quiz to start .

Trivolt currently runs on Amazon Nova 2 Lite, through a global inference profile. Because the agent uses only the Bedrock Converse API, switching to a stronger model such as Claude Opus 5.5 (through the  au.  profile from Sydney) is a configuration change.
Because quiz generation also runs in AgentCore runtime (with Strands SDK), we can also instrument its invocations with OTEL for CloudWatch visibility. A quiz generation trace made via Bedrock AgentCore is illustrated below. This also provides information of where question validation has failed for various reasons, requiring regeneration.

Figure 5: Illustrating Cloudwatch GenAI Observability, for viewing details of our Quiz generation invocations to a Bedrock model via our Bedrock Agentcore implementation.



Security

The following safeguards were also automatically implemented for the application, to help protect it against abuse and run-away costs - especially while it is currently for demonstration only with limited budget.
  1. Host sign-up is disabled for now; this may be revisited later; at this stage, anyone interested can request a demonstration via email to myself .
  1. Least privilege throughout. Each Lambda has only the permissions it needs, and the browser can never publish to real-time channels.
  1. Private by default. The S3 bucket is private behind CloudFront Origin Access Control. Hosts authenticate with Cognito. Players get narrowly scoped, short-lived tokens.
  1. Abuse controls: - Nickname moderation with a blocklist plus Comprehend - Hosts can remove a Player; - A daily cap on AI generations per Host - Reserved concurrency on every Lambda, which limits how far a traffic spike (or a bill) can grow.
  1. Protecting data in production: DynamoDB point-in-time recovery, retention policies so a stack deletion can't remove data, and Cognito deletion protection.




Cost

The architecture has almost no always-on cost. When nobody is playing:
  • No Lambda is running;
  • DynamoDB on-demand bills nothing for requests;
  • AgentCore and Bedrock bill only for work done;
  • AppSync Events, API Gateway and CloudFront bill per request or per byte.
The fixed monthly costs are small, such as a Route 53 hosted zone and a Secrets Manager secret. This means we pay for usage, not capacity.
I have also performed some calculation of what we may expect to pay on a monthly basis for this to run in region ap-southeast-2 (Sydney), assuming that each quiz has 10 questions, and is played by 10 players, token counts are based on an average from previous quizes generated, and with use of Amazon Nova 2 Lite as the model:

Item
Basis
US$/month @ 30 quizzes
US$/month @ 3,000 quizzes
Usage-driven



Bedrock, Nova 2 Lite
19.5k input × $0.32/M + 2.0k output × $2.63/M ≈ $0.0116 per quiz; $0.008–0.016 depending on how many questions fail checking
~0.35 (0.24–0.48)
~35 (24–48)
AgentCore Runtime
About $0.005 per quiz, mostly memory billed while each session sits idle for 15 minutes after its quiz finishes (October: 24 GB-hours of memory for about 45 invocations)
~0.16 (0.12–0.24)
~16 (12–24)
CloudWatch
Custom metrics published every hour (7 × $0.30 = $2.10) and 6 alarms ($0.60) run regardless of load; trace and Lambda logs scale (about 0.9 GB at 3,000, at $0.67/GB)
~2.75
~3.50
Comprehend (topic and nickname toxicity checks)
About 11 checks per game × $0.0001
~0.03
~3.30
AppSync Events
About 400 operations per game (at $1/M), plus connection minutes
~0.01
~1.25
API Gateway (HTTP API)
About 300 requests per game (at $1.29/M)
~0.01
~1.20
DynamoDB (on-demand)
About 600 reads and 300 writes per quiz-and-game
~0.01
~1.00
Lambda
About 300 requests and 23 GB-seconds per quiz-and-game; within the always-free tier if nothing else in the account uses it
0
0–1.30
CloudFront
About 16 GB served at 3,000; within the always-free tier
0
0
Fixed



Route 53 hosted zone,  trivolt.app 

0.50
0.50
Secrets Manager, player token key

0.40
0.40
ECR images (about 94 MB each, up to 20 kept)

~0.20
~0.20
S3, CloudTrail and similar

~0.10
~0.10
Prod total

≈ 4.60 (4–6)
≈ 60–65 (45–85)
This illustrates that even with moderate use of the game, costs are well controlled! However we should still always stay protected from potential risks; e.g. runaway controls, DDoS attacks and other abuse. Guardrails are also in place for this purpose, being:
  • AWS Budgets sends an email alert at 80% of a US$20 monthly budget, and when spend is forecast to exceed it. The account also hosts other workloads, so every stack is deployed with a  quizapp-env  tag, and the budget counts only resources with that tag. Note: per-request Bedrock model usage isn't covered by the tag.
  • Quotas and caps: the daily generation limit, reserved concurrency and the 50-Player cap all keep costs bounded.
  • Right-sized defaults: arm64 Lambdas, CloudFront's cheaper price class in dev, a 30-day lifecycle on build artifacts, and DynamoDB TTL to clear expired data.
  • Model choice is configuration. A low-cost model (Nova 2 Lite) is fine for development, and a stronger model can be used where quality matters. The pipeline's verify-and-validate steps keep quality up with either.



Lessons learned

The following are key lessons that I learned from implementing the solution using Claude with /grill-with-docs:
  • Spike the risky parts first. Proving AgentCore deployment and the AppSync Events authoriser in M0 meant no later milestone was built on an untested assumption.
  • Test against the real cloud, automatically. Unit tests couldn't have found the lost AppSync events. A smoke test that plays a whole Game on every deploy did, on its first run.
  • Make real-time events notifications, not the record. Designing for at-most-once delivery, with snapshots as the source of truth, also gave reconnects and page reloads for free.
  • Write decisions down as you make them. The ADRs meant I could later ask "why HTTP API and not REST?" or "why AgentCore and not Lambda?" and get the original reasoning, not a guess.
  • Ask the LLM to check the latest documentation. Services such as Bedrock AgentCore are newer than most models' training data. Adding a note to prompts to check the latest AWS documentation may help avoid out-of-date advice.




Conclusion

The ability of Claude combined with grill-with-docs to deduce my requirements with detail and create my desired multi-player quiz game with a polished user interface and robust, bug-free game play to me was astonishing! The amount of required manual code typing was minimal - and mostly related to the custom GitHub actions pipeline for deploying the application.
Note this was a simple setup; I am still fairly-new to GenAI-generated development and I did not have any skills files to direct the model towards any set methods or standards. The skill's test-first approach (TDD) via automated unit and integration tests, and initial spikes and traces also helped instill quality and validate the initial design early.

Where Kiro could fit in

What I would be interested in learning further however is how use of Claude + /grill-with-docs compares to other GenAI tools that are out there. Such an analysis is out-of-scope here, but one thought is this:
  • grill-with-docs is excellent at discovery. Its rounds of questions produced a shared understanding, captured in the Glossary, PRD and ADRs. Its build, test generation and test runs also worked well. But the link between requirements and tests is only partial and informal: some tests cite FR numbers in their names or comments, and nothing checks that every requirement has a test.
  • Conversely, Kiro is built around Spec-Driven-Development. Each feature has a spec of requirements (user stories with acceptance criteria), a design and a task list, and each task traces back to the requirements it implements. It doesn't do the same kind of probing interview to uncover requirements and edge cases.
  • For larger applications where such structure and traceability is required, I believe the two could complement each other well - grill-with-docs to produce the Glossary, PRD and ADRs, leaving out the Plan and implementation detail, then import them into a new Kiro project as steering files.
I have tried this, as shown below.
Kiro IDE with the Trivolt Glossary, PRD and ADRs imported as steering files

Figure 6: The grill-with-docs outputs imported into Kiro as steering files.
  • Finally, and this is on the more contentious side - I must say I enjoyed seeing and playing the quiz game before I actually knew how it was implemented. This is a risk - it can be too easy to accept technical solutions, and not understand a solution or how to fix things when problems strike. I believe learning to work this way is a learning journey for all of us.
Code and design transcripts can be viewed at  github.com/cirruscape/public-app-trivolt .



Kahoot! is a trademark of Kahoot! ASA. This project isn't affiliated with or endorsed by Kahoot!. "Kahoot-like" describes the style of game.
Disclaimer: The views and opinions expressed in this article are those of the author only.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article