Inspiration
The inspiration for Brain-Battle came from a simple observation: studying alone is boring. Traditional study methods often lead to low engagement and poor retention rates. We noticed that students perform better when learning is interactive, competitive, and social. The rise of AI tools like ChatGPT made us realize we could create something revolutionary — a platform that combines the power of AI-generated content with the excitement of multiplayer gaming.
We were inspired by platforms like Kahoot! but wanted to go beyond generic questions to create personalized, document-specific quizzes that actually help students learn their specific material.
What it does
Brain-Battle transforms studying into a social, competitive experience.
It allows students to upload study documents, generates AI-powered personalized quizzes, and lets them compete in real-time against classmates.
With live score updates, leaderboards, and anti-cheat detection, it makes learning engaging, interactive, and fun.
How we built it
Architecture Overview
Brain-Battle is built on a modern, scalable tech stack:
- Frontend: Next.js 15 with TypeScript and Tailwind CSS for a responsive, type-safe interface
- Backend: Supabase for database, authentication, and real-time subscriptions
- AI Integration: OpenAI GPT-4 for question generation and
text-embedding-3-smallfor semantic search - Real-time Features: Supabase Realtime for live score updates and multiplayer synchronization
Key Components
1. Document Processing Pipeline
2. AI-Powered Quiz Generation
Our quiz generation system uses a sophisticated prompt engineering approach.
3. Real-time Multiplayer System
The multiplayer architecture uses Supabase Realtime subscriptions.
4. Anti-cheat Monitoring
We implemented comprehensive cheat detection.
Database Design
Our schema supports complex multiplayer interactions:
| Table | Purpose |
|---|---|
quiz_sessions |
Manages multiplayer quiz lifecycle |
quiz_questions |
Stores generated questions with metadata |
quiz_answers |
Tracks player responses and scoring |
player_progress |
Real-time progress tracking for live leaderboards |
session_events |
Audit trail for cheat detection and debugging |
Challenges we ran into
Technical Challenges
1. Real-time Synchronization
Problem: Keeping multiple clients synchronized during live quiz sessions was extremely challenging.
Solution: We implemented a robust state management system using Supabase Realtime subscriptions combined with optimistic updates and conflict resolution.
2. AI Question Quality
Problem: Early versions generated generic questions that weren't specific to the uploaded documents.
Solution: We developed a sophisticated prompt engineering system with document-specific context injection and structured output validation.
3. Anti-cheat Implementation
Problem: Competitive environments naturally incentivize cheating through tab switching and external resources.
Solution: We built a comprehensive monitoring system that tracks user behavior and reports violations in real-time while maintaining a good user experience.
4. Performance at Scale
Problem: Real-time updates and vector searches could become slow with many concurrent users.
Solution: We optimized database queries, implemented proper indexing, and used connection pooling to handle high concurrency.
UX Challenges
1. Onboarding Complexity
Problem: The platform has many features that could overwhelm new users.
Solution: We created guided tutorials and progressive disclosure to introduce features gradually.
2. Mobile Responsiveness
Problem: Complex multiplayer interfaces are difficult to optimize for mobile devices.
Solution: We redesigned key components with mobile-first principles and touch-friendly interactions.
Accomplishments that we're proud of
- Built a fully functional real-time multiplayer quiz engine powered by Supabase Realtime
- Successfully integrated AI-driven, document-specific question generation using GPT-4 and vector embeddings
- Implemented anti-cheat monitoring for fair competition
- Designed a responsive, modern UI that works seamlessly across devices
What we learned
Building Brain-Battle taught us several key lessons:
Technical Insights
- Real-time synchronization is complex: Implementing live score updates across multiple clients required careful state management and WebSocket optimization.
- AI prompt engineering is crucial: Getting consistent, high-quality quiz questions from GPT-4 required extensive prompt tuning and structured output formatting.
- Vector embeddings are powerful: Using semantic search with
pgvectorallowed us to create contextually relevant questions from document content. - Database design matters: Proper schema design with foreign keys and indexes was essential for performance at scale.
User Experience Discoveries
- Competition drives engagement: Students were 40% more engaged when competing against friends vs. studying alone.
- Real-time feedback is addictive: Live leaderboards created a gaming-like experience that kept students motivated.
- Anti-cheat is necessary: We had to implement sophisticated monitoring to maintain quiz integrity in competitive environments.
What's next for Brain-Brawl
We’re excited to continue evolving Brain-Battle with features like:
- Tournament-style competitions
- Advanced analytics and insights
- Integration with popular LMS platforms
- Mobile applications for iOS and Android
Built With
- bcryptjs
- custom-auth-system
- eslint
- framer-motion
- git
- next.js-15
- next.js-api-routes
- node.js
- openai-embeddings-(text-embedding-3-small)
- openai-gpt-4
- pdf-parse
- pgvector-extension
- postgresql
- prettier
- react-19
- supabase
- supabase-(postgresql)
- supabase-auth
- supabase-realtime
- tailwind-css
- typescript
- vector-embeddings-storage
- vercel-(next.js)
Log in or sign up for Devpost to join the conversation.