Projects/AI Debate Chatbot
AI Debate Chatbot

AI Debate Chatbot

Two-player debate game with real-time AppSync sync, 3 rounds of AI-generated questions, and a final scored judgment from an LLM.

Next.jsTypeScriptTailwind CSSAWS AppSyncDynamoDBGraphQLAWS AmplifyGroqLlama

About this project

Two players join a shared room by code, submit opening positions, answer three rounds of Groq-generated debate questions on a server-synced timer, then receive a structured judgment scoring each side on Matter, Manner, and Method. All room state lives in DynamoDB and propagates via AppSync GraphQL subscriptions, so both browsers stay in sync without polling. The most interesting decisions were making the round timer drive off a server timestamp (so refresh and reconnect don't desync) and electing Player A's client as the only one that calls Groq — that single-caller pattern avoids duplicate LLM requests and race conditions in the round-progression logic.

  • AppSync GraphQL with @aws_subscribe WebSocket subscriptions — no polling, no Socket.IO
  • Server-synced round timer via DynamoDB `roundStartedAt` so both clients share one clock
  • Custom 'present()' merge helper to handle AppSync's null-means-unchanged update semantics
  • Server-side /api/groq proxy keeps the API key out of the browser

Key features

Two-player rooms

Join with 6-char code, sides A/B

Real-time sync

AppSync WebSocket subscriptions

LLM-driven

Groq generates questions + judgment

Matter / Manner / Method

Structured 3-axis scoring


Screenshots

Active debate room

Result page

Debate History


Tech stack

Next.js
TypeScript
Tailwind CSS
AWS AppSync
DynamoDB
GraphQL
AWS Amplify
Groq
Llama

Other projects