Real-Time Loyalty & Engagement System with Streaming Chat Bot
2024* Images are for illustration purposes only
Real-time loyalty and reward platform integrated with a custom streaming chat bot, enabling viewer engagement, point accumulation, and raffle-based rewards.
Tech Stack
Key Features
- Real-Time Point Distribution & Raffle Mechanics
- Custom Streaming Bot (Reverse-Engineered WebSocket)
- NextAuth Secure Authentication
- Scheduled Reward Processing (QStash)
- Scalable Event-Driven Architecture
The Challenge
Live streamers struggled to maintain viewer engagement and reward loyal community members effectively.
Constraints & Scale
Needed to process chat events in real-time, integrate with multiple streaming platforms, and handle burst traffic during raffles.
System Architecture
Event-driven architecture using Next.js, a custom WebSocket server for the bot, and Upstash Redis for high-speed leaderboards and ephemeral state.
Key Tradeoffs
Built a custom WebSocket bot instead of using standard APIs to bypass rate limits and enable deeper integration, requiring more maintenance but offering superior control.
Measurable Results
Increased chat activity by 200% and facilitated the redemption of over 5,000 rewards. The system handled 10k+ concurrent WebSocket connections with minimal resource usage.
Project Details
Designed and developed a real-time loyalty and engagement system integrated with a custom-built streaming chat bot to enhance audience interaction and retention. The project focused on rewarding user activity such as watching, chatting, and interacting during live streams. Built a dedicated loyalty program web application using Next.js with secure and fast authentication via NextAuth. The platform allows users to track points, redeem rewards, and convert accumulated points into raffle tickets through a structured reward system. Developed a custom streaming bot using TypeScript and Node.js. At the time, no official API was available, so the bot was implemented by reverse-engineering the WebSocket communication protocol, enabling real-time detection of user activity and chat commands. Streamers could configure and use multiple bot commands to interact directly with viewers. Implemented real-time point distribution, raffle mechanics, and scheduled reward processing using PostgreSQL for persistence and Upstash Redis / QStash for caching and task scheduling. WebSocket-based communication ensured low-latency interactions between viewers, the bot, and the loyalty platform. The system was designed to be scalable, event-driven, and extensible, supporting high concurrency during live streaming sessions while maintaining accurate reward tracking and fair raffle execution.