Community Bot is MrDemonWolf's personal, self-hosted stream management platform — a monorepo that ties together a Twitch chat bot, Discord notification bot, and web dashboard into one cohesive system. It's built specifically for his channels, but it's fully open source so anyone can fork it and adapt it for their own streams.
Your stream, your bot, your rules.
- Twitch Chat Bot — Database-driven custom commands with 40+ dynamic response variables, cooldowns, access levels, regex triggers, keyword matching, and stream status awareness.
- Discord Bot — Slash commands, Twitch live stream notifications, moderation (ban/kick/warn/mute with case tracking), self-assignable role panels, message templates, scheduled messages, and cross-platform quotes.
- Web Dashboard — Next.js app with tRPC, Discord and Twitch OAuth, audit log feed, bot controls, and full management of commands, regulars, quotes, counters, timers, spam filters, song requests, viewer queue, Discord settings, and user roles.
- Viewer Queue — Position-based queue system managed from chat (
!queue) or the dashboard with open/close/pause controls. - Quotes — Cross-platform quote system shared between Twitch chat and Discord slash commands.
- Named Counters — Create, increment, decrement, and display counters from chat.
- Recurring Timers — Automated chat messages on an interval with chat-line thresholds and online-only mode.
- Spam Filters — Configurable filters for caps, links, symbols, emotes, repetition, and banned words with permit system.
- Moderation Commands —
!permit,!nuke,!vanish, and!clipfor Twitch chat moderation. - Song Requests — Viewers request songs via
!sr; manage the queue from the dashboard with skip, remove, and clear. - AI-Enhanced Shoutouts — Optional Google Gemini integration for personalized shoutout messages via
!so. - Giveaways & Polls — Run giveaways and polls from chat or the dashboard.
- Import/Export — Import commands from Nightbot or export your full channel config as JSON.
- Welcome Messages — Configurable Discord welcome/leave messages, auto-role, and DM welcome with embed builder.
- User Management — Role-based access control (USER → MODERATOR → LEAD_MODERATOR → BROADCASTER) with ban system.
- Real-Time Event Bus — Type-safe Redis Pub/Sub for instant communication between all services.
- First-User Setup Wizard — One-time
/setup/{token}flow that designates the broadcaster. - Documentation Site — Fumadocs-powered docs with guides for every feature and full variable reference.
Full documentation is available at the docs site when running locally.
- Install dependencies:
bun install- Start infrastructure services:
docker compose up -d postgres redis- Copy and configure environment files:
cp apps/web/.env.example apps/web/.env
cp apps/discord/.env.example apps/discord/.env
cp apps/twitch/.env.example apps/twitch/.env- Push the database schema:
bun db:push- Start all services in development mode:
bun dev- Complete first-time setup by visiting the one-time setup URL logged to the console.
| Service | URL |
|---|---|
| Web Dashboard | http://localhost:3001 |
| Documentation | http://localhost:3000 |
| Discord Bot API | http://localhost:3141 |
| Twitch Bot API | http://localhost:3737 |
| Command | Description | Access |
|---|---|---|
!ping |
Basic ping/pong response | Everyone |
!uptime |
Display stream uptime | Everyone |
!title |
Show current stream title | Everyone |
!game |
Show current game/category | Everyone |
!followage |
Show how long you've followed | Everyone |
!accountage |
Look up Twitch account age | Everyone |
!commands |
Links to the public commands page | Everyone |
!quote |
View, add, remove, search quotes | Everyone/Mod |
!counter |
Manage named counters | Mod+ |
!sr |
Song request queue | Everyone/Mod |
!queue |
Viewer queue management | Everyone/Mod |
!so / !shoutout |
Shout out another streamer (+ AI) | Mod+ |
!permit |
Temporarily exempt a user from filters | Mod+ |
!nuke |
Timeout users matching a phrase | Mod+ |
!vanish |
Self-timeout for 1 second | Everyone |
!clip |
Create a clip of the current stream | Everyone |
!command |
Manage custom commands | Mod+ |
!reloadcommands |
Reload commands from database | Mod+ |
!bot |
Bot mute/unmute controls | Mod+ |
!filesay |
Fetch a URL and send lines to chat | Mod+ |
!weather |
Show weather for a location | Everyone |
!giveaway |
Run a chat giveaway | Mod+ |
!poll |
Run a chat poll | Mod+ |
See the docs for full command details and response variables.
After completing the setup wizard, the dashboard provides:
- Bot Controls — Enable/disable/mute the Twitch bot
- Command Management — CRUD for custom commands and default command toggles
- Regulars, Quotes, Counters, Timers — Full management UI
- Spam Filters — Configure all filter types with thresholds
- Song Requests & Viewer Queue — Real-time queue management
- Discord Settings — Link guild, set notification channel/role, welcome messages
- User Management — Assign roles and ban/unban users (broadcaster only)
- Audit Log — Role-filtered history of all dashboard changes
- Public Pages —
/p/commandsand/p/queuefor viewers
| Layer | Technology |
|---|---|
| Language | TypeScript (ESM) |
| Build System | Turborepo, bun workspaces |
| Web Framework | Next.js 16 |
| API Layer | tRPC |
| Authentication | better-auth (Discord + Twitch OAuth) |
| Discord Library | discord.js v14 |
| Twitch Library | @twurple/chat v7, @twurple/auth v7 |
| Database | PostgreSQL via Drizzle ORM |
| Cache / Events | Redis (ioredis), Redis Pub/Sub |
| Job Queue | BullMQ |
| UI Components | shadcn/ui, Tailwind CSS v4 |
| Documentation | Fumadocs |
| Env Validation | @t3-oss/env-core + Zod |
| HTTP Server (Bots) | Express 5 |
| Containerization | Docker Compose |
- Node.js 22+
- Bun 1.x
- Docker and Docker Compose
- A Twitch application (Client ID and Secret)
- A Discord application (Bot Token, Client ID, Client Secret)
- Clone the repository:
git clone https://github.com/MrDemonWolf/community-bot.git
cd community-bot- Install dependencies:
bun install- Start PostgreSQL and Redis:
docker compose up -d postgres redis- Copy environment files and fill in credentials:
cp apps/web/.env.example apps/web/.env
cp apps/discord/.env.example apps/discord/.env
cp apps/twitch/.env.example apps/twitch/.env- Push the database schema:
bun db:push- Start development:
bun devbun dev- Start all apps in development modebun build- Build all packages and appsbun test- Run Vitest unit testsbun check-types- Type-check all packagesbun db:push- Push schema changes to databasebun db:migrate- Run database migrationsbun db:studio- Open Drizzle Studio GUIbun dev:web- Start only the web dashboard
- TypeScript strict mode across all packages
- Zod-validated environment variables
- Vitest for unit testing
- Shared
tsconfig.base.jsonfor consistent compiler settings
apps/
web/ # Next.js web dashboard (tRPC, better-auth)
docs/ # Fumadocs documentation site
discord/ # Discord bot (discord.js v14, BullMQ, Express)
twitch/ # Twitch chat bot (@twurple/chat, Express)
packages/
db/ # Drizzle schema + client
env/ # Shared Zod-validated environment configs
events/ # Redis Pub/Sub typed event bus
config/ # Shared TypeScript config
server/ # Shared Express API server utilities
auth/ # Authentication package (better-auth)
api/ # Shared tRPC routers and utilities
docker-compose.yml # PostgreSQL, Redis, and bot services
turbo.json # Turborepo pipeline configuration
Community Bot is built on the shoulders of these excellent open-source projects and tools:
- Next.js - React framework for the web dashboard
- Turborepo - Monorepo build system
- Bun - JavaScript runtime and package manager
- discord.js - Discord API library
- @twurple - Twitch API and chat library
- Drizzle ORM - TypeScript ORM
- PostgreSQL - Database
- Redis - Caching and Pub/Sub event bus
- better-auth - Authentication
- tRPC - End-to-end typesafe API layer
- shadcn/ui - UI component library
- Tailwind CSS - Utility-first CSS framework
- Fumadocs - Documentation framework
- BullMQ - Job queue for background tasks
- Docker - Containerization
Have questions or feedback?
- Discord: Join my server
Made with love by MrDemonWolf, Inc.
