Inspiration
Twitch chat is a place where viewers share opinions, make guesses, and react to what happens on stream. I wanted to explore how that interaction could become something measurable rather than just another chat message.
That idea led to CrowdLab, a Twitch-connected prediction experiment where viewers submit numeric guesses, the broadcaster records the actual result, and the application calculates how close the predictions were.
What It Does
CrowdLab lets a broadcaster start a timed prediction round and collect viewer predictions through Twitch chat using the !predict command. The dashboard displays the accepted predictions and crowd average as the round progresses.
When the round is locked and the measured result is entered, CrowdLab calculates the prediction errors, scores participants, and updates the leaderboard. The Live Experiment Insights panel summarizes the current round, while the separate stream overlay presents the status and results in a format suitable for a broadcast scene.
How I Built It
I built CrowdLab using React, TypeScript, Vite, and a Node.js server. The Twitch integration uses OAuth for authorization and EventSub WebSocket events to receive chat activity.
I focused on keeping the game logic on the server so that prediction validation, round deadlines, scoring, and leaderboard results are not determined by the client interface. I also added a local-test mode to help test the experience without depending on a live Twitch session for every development cycle.
I used OpenAI Codex as a development assistant to help implement and refine the Twitch integration, game-round logic, dashboard, overlay, experiment insights, and automated tests. I reviewed and tested the resulting code iteratively rather than treating generated code as automatically correct.
Challenges I Faced
One challenge was coordinating live chat messages with a timed game loop. Predictions needed to be validated against the current round, and messages received after locking should not change the result. Duplicate messages also needed to be handled safely.
Another challenge was ensuring scoring behaved consistently. During testing, I found that mathematically equal errors from decimal predictions could receive different ranks because of floating-point precision. I corrected the ranking logic and added a regression test.
I also worked on making the information consistent between the dashboard and the stream overlay, handling empty rounds and missing results, and presenting tied leaders correctly.
What I Learned
This project helped me understand how a real-time application connects an external event source to server-controlled state and a live user interface. I learned more about WebSocket-based communication, OAuth configuration, input validation, game-state transitions, automated regression testing, and the importance of testing edge cases.
Working with Codex also taught me that AI-assisted development works best when paired with clear requirements, code review, tests, and repeated verification.
What's Next
CrowdLab is a working prototype, and there is still room to improve it. The current implementation keeps game state in memory, so persistent experiment history is an important future improvement. I would also like to test more experiment types and make it easier for streamers to configure their own experiments.
My goal is to make CrowdLab a simple way to turn passive Twitch viewing into an interactive, measurable experiment—one prediction round at a time.
Built With
- codex
- css
- html
- javascript
- node.js
- oauth
- openai
- react
- twitch
- typescript
- vite
- websockets
Log in or sign up for Devpost to join the conversation.