Twitch stream analytics and credits system for PSP1G's streams. This project automatically tracks stream data, chat statistics, user attendance, and generates beautiful end-of-stream credits available either as an OBS browser source or to be viewed in the browser where you can look at all past logs.
- Real-time message counting and chat statistics
- Automatically detects if streamer went live
- Top chatters tracking with message counts
- Moderation action logging (timeouts, bans, deleted messages)
- Emote usage tracking and top emotes display
- First-time chatter detection
- Automatic tracking of users present during streams
- Consecutive attendance streak calculation
- Stream title and category change history
- Special guests and featured streamers
- Raid statistics
- Moderator activity and rankings
- Support tracking (subscriptions, cheers, gifts)
- Node.js (v14 or higher)
- npm or yarn package manager
- Twitch account for chat integration
-
Clone the repository:
git clone <repository-url> cd stream-credits
-
Install dependencies:
npm install
-
Environment Configuration:
Create a
.envfile in the root directory or use the provided template. Example:TWITCH_CLIENT_ID=<your client id here> TWITCH_CLIENT_SECRET=<your client secret here> WEBHOOKS_SECRET=<randomly generated string> PORT=3000 TWITCH_CHANNEL_NAME=<your channel name here> TWITCH_CHANNEL_ID=<your channel id here> EXCLUDED_USERS=Nightbot,StreamElements,...
-
Authorize Twitch EventSub:
Check out the file
auth link, where you will need to replace the client_id with your own and follow it to authorize the application. -
Run the application:
npm start
-
Build the Docker image:
docker build -t stream-credits . -
Run the container:
docker run --env-file .env -p 3000:3000 stream-credits
Refer to the steps 3 and 4 above for proper configuration.
Access the web interface at http://localhost:3000 to view:
- Live stream statistics
- Generated credits with all tracked data
- Historical log data from previous streams
- Top chatters, emotes, and attendance streaks
The src/data/default.json file contains the default structure for:
- Cast member roles
- Artists, editor and programmer credits
- Moderator categorization
- Empty data structures for new streams
Edit the cast, artists, programmers, and editors arrays in default.json to customize credits:
{
"cast": [
{ "name": "username", "role": "Custom Role" }
],
"programmers": [
{ "name": "developer", "role": "Feature Description" }
]
}stream-credits/
├── src/
│ ├── data/
│ │ ├── credits.js # Main data management system
│ │ ├── postprocess.js # Data processing and analytics
│ │ └── default.json # Default configuration and structure
│ ├── events/
│ │ ├── tmiEvents.js # Twitch chat event handlers
│ │ └── tesEvents.js # TES event handlers
│ ├── listeners/
│ │ ├── tmi.js # Twitch chat client setup
│ │ └── tes.js # TES listener setup
│ ├── public/
│ │ ├── index.ejs # Main credits page
│ │ ├── logs.ejs # Log viewing interface
│ │ ├── style.css # Styling for web interface
│ │ ├── script.js # Client-side functionality
│ │ ├── partials/ # EJS template components
│ │ └── img/ # Static images and assets
│ ├── main.js # Application entry point
│ ├── server.js # Web server setup
│ └── emotes.js # Emote handling utilities
├── logs/ # Daily stream logs storage
├── package.json # Dependencies and scripts
└── README.md # Project documentation
This project is licensed under the MIT License.
Originally developed Flourek.