Inspiration

Creating quizzes for classes or team events meant writing questions manually and setting up platforms. I wanted to eliminate that friction entirely — type a topic, get questions instantly, play with anyone.

What it does

LiveQuiz is a real-time multiplayer trivia platform. The host types any topic — "FIFA World Cup", "JavaScript", "Marvel Movies" — and Claude AI generates 5-20 custom questions in seconds. Players join instantly via QR code or shared link. No signup, no install. Answers are speed-weighted and scored server-side in real time.

How we built it

Frontend: Next.js 14 (App Router), TypeScript, Tailwind CSS, shadcn/ui — deployed on Vercel.

Database: AWS DynamoDB with a single-table design supporting 5 entity types (rooms, players, questions, answers, WebSocket connections) under one partition key per room. One QueryCommand returns the full game state in a single round-trip.

Real-time pipeline: DynamoDB Streams → AWS Lambda (livequiz-stream) → API Gateway WebSocket → all connected players. Every state change triggers an invalidate broadcast in under 500ms. No polling, no Redis, no persistent servers.

AI: Anthropic Claude API generates structured JSON questions with validation, markdown fence stripping, and server-side rate limiting (5 generations per room).

Infra: Fully serverless. All AWS resources provisioned via a single bash script (scripts/setup-websocket.sh).

Challenges we ran into

The trickiest part was the real-time architecture. Vercel serverless functions are stateless — they can't hold WebSocket connections. The solution was using DynamoDB Streams as the event bus: any write to DynamoDB triggers a Lambda that reads all active CONNECTION# items for the room and broadcasts via API Gateway Management API. Stale connections (HTTP 410) are cleaned up in the same pass.

The second challenge was the single-table DynamoDB design. Modeling 5 entity types under one table with SK prefixes (PLAYER#, QUESTION#, ANSWER#, CONNECTION#) required careful access pattern planning to avoid full table scans.

Accomplishments that we're proud of

  • A fully serverless real-time pipeline with zero additional infrastructure beyond DynamoDB + Lambda
  • Single-table DynamoDB design with documented access patterns that scales horizontally by design
  • AI question generation that's server-secure, rate-limited, and robust against malformed API responses
  • Idempotent answer submission with server-side speed-weighted scoring to prevent manipulation

What we learned

DynamoDB Streams is an underutilized event bus. Using it as the trigger for WebSocket broadcasts means the database itself drives real-time updates — no separate pub/sub layer needed. This pattern scales to millions of concurrent rooms because each room is its own partition.

What's next for LiveQuiz

  • Auth for persistent player profiles and game history
  • Rejoin support for disconnected players
  • Host-configurable time limits and point values
  • Public room browser for discovery

Built With

  • anthropic-claude-api
  • api-gateway-websocket
  • aws-dynamodb
  • aws-lambda
  • dynamodb-streams
  • next.js
  • node.js
  • tailwind-css
  • typescript
  • vercel
Share this project:

Updates

Submission history