Twitch Chat Overlay
A modern, customizable Twitch chat overlay built with Next.js and TailwindCSS. Perfect for streamers who want to display chat messages with beautiful, customizable bubble designs during their streams.
✨ Features
- Beautiful Chat Bubbles: Modern bubble-style message display with username badges
- Full Customization: Customize colors, backgrounds, text shadows, and more for different user types
- User Role Support: Different styling for broadcasters, moderators, subscribers, VIPs, and regular users
- Real-time Chat: Live chat integration with Twitch using TMI.js
- Emote Support: Full support for Twitch, BetterTTV and 7TV emotes with proper sizing and scaling
- Message Management: Configurable message lifetime, limits, and user exclusion
- Advanced Color Picker: Photoshop-style color picker with HEX, RGB, HSL support
- Settings Import/Export: Save and share your overlay configurations
- Static Export Ready: Built for serverless deployment and static hosting
- Responsive Design: Works perfectly in OBS and other streaming software
🚀 Quick Start
1. Setup Twitch Application
- Go to Twitch Developer Console
- Create a new application with these settings:
- Name: Your overlay name
- OAuth Redirect URLs:
https://yourdomain.com/oauth/
- Category: Chat Bot or Other
- Note down your Client ID
Update the Client ID in src/lib/constants.ts:
export const constants = {
CLIENT_ID: "your_client_id_here",
// ...other constants
};
3. Deploy
Option A: GitHub Pages (Recommended)
- Fork this repository
- Enable GitHub Pages in repository settings
- Set source to “GitHub Actions”
- Push your changes - the site will auto-deploy
Option B: Vercel/Netlify
- Connect your repository to Vercel or Netlify
- Set build command:
npm run build
- Set output directory:
out
- Deploy
4. Setup in OBS
- Add a “Browser Source” in OBS
- Set URL to:
https://yourdomain.com/oauth
- Configure your overlay settings
- Copy the generated overlay URL
- Update the Browser Source URL with your overlay URL
- Set Width: 400, Height: 600
- Check “Shutdown source when not visible”
🎨 Customization Options
User Role Styling
Configure different appearances for:
- Broadcasters/Streamers: Special styling for the channel owner
- Moderators: Distinctive look for channel moderators
- Subscribers: Custom styling for subscribers
- VIPs: Special appearance for VIP users
- Default Users: Standard styling for regular viewers
Color Customization
For each user role, customize:
- Username bubble background color
- Message bubble background color
- Username text color (separate from message text)
- Message text color (separate from username text)
- Username text shadow
- Message text shadow
Advanced Settings
- Message Lifetime: How long messages stay visible (default: 90 seconds)
- Message Limit: Maximum number of messages on screen
- User Exclusion: Hide messages from specific users (useful for bots)
- Command Filtering: Hide messages starting with “!”
- Auto-scroll: Automatically scroll to latest messages
🛠️ Development
Prerequisites
Installation
# Clone the repository
git clone https://github.com/yourusername/twitch-chat-overlay.git
cd twitch-chat-overlay
# Install dependencies
npm install
# Start development server
npm run dev
Build for Production
# Build static export
npm run build
# The output will be in the 'out' directory
Project Structure
src/
├── app/ # Next.js app directory
│ ├── page.tsx # Main chat overlay page
│ └── oauth/
│ └── page.tsx # OAuth setup and configuration
├── components/
│ ├── BubblePreview.tsx # Color preview component
│ ├── ChatMessage.tsx # Individual chat message component
│ ├── ChatOverlay.tsx # Main overlay logic
│ └── ColorPicker.tsx # Advanced color picker
├── lib/
│ ├── constants.ts # App configuration and defaults
│ └── twitch.ts # Twitch API integration
├── types/
│ └── index.ts # TypeScript type definitions
└── utils/
└── index.ts # Utility functions
🔧 Configuration
Environment Variables
No environment variables required! All configuration is done through the web interface and stored in URL parameters.
TMI.js Integration
The overlay uses TMI.js for Twitch chat connection. The library is included statically for serverless compatibility.
Message Processing
- Emote Handling: Automatic emote replacement with proper sizing
- Emote-only Messages: Special handling for emote-only messages with larger display
- Message Filtering: Commands and excluded users are filtered automatically
- Duplicate Prevention: Built-in duplicate message detection
📱 Usage in Streaming Software
OBS Studio
- Add “Browser Source”
- Use your overlay URL
- Set dimensions to 400x600
- Enable “Shutdown source when not visible”
Streamlabs OBS
- Add “Custom Widget”
- Paste your overlay URL
- Adjust size as needed
XSplit
- Add “Web page” source
- Enter your overlay URL
- Configure size and position
🎯 Tips for Best Results
- Use message limits to prevent memory issues during long streams
- Enable “Shutdown source when not visible” in OBS
- Consider shorter message lifetimes for busy chats
Visual Design
- Test colors with different backgrounds
- Use text shadows for better readability
- Preview different user types before going live
- Export settings as backup before major changes
Chat Management
- Add bots to exclusion list to reduce clutter
- Use command filtering if you use many bot commands
- Adjust message lifetime based on chat activity
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development Guidelines
- Follow existing code style and conventions
- Test changes thoroughly with real Twitch chat
- Update documentation for new features
- Ensure static export compatibility
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
📞 Support
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Include browser console logs if applicable
Happy Streaming! 🎮✨