This repository contains a clean rewrite of an existing Discord bot.
The old bot is included only as read-only reference material in:
legacy/old-bot-readonly/The new implementation lives in:
apps/bot/The goal of this rewrite is to create a clean, maintainable, modern Discord bot with:
- TypeScript
- modular feature architecture
- clear command handling
- clean service layers
- environment-based configuration
- optional Prisma database support
- good documentation for future development
- AI-agent-friendly project structure
apps/
bot/
src/
commands/
events/
features/
services/
lib/
config/
index.ts
packages/
shared/
src/
prisma/
schema.prisma
migrations/
docs/
architecture.md
feature-map.md
migration-notes.md
legacy/
old-bot-readonly/Do not modify:
legacy/old-bot-readonly/The legacy bot exists only so humans and coding agents can inspect old behavior.
Install dependencies:
npm installCreate your environment file:
cp .env.example .envStart development:
npm run devBuild:
npm run buildStart production:
npm startnpm start applies pending database migrations (prisma migrate deploy)
and re-registers slash commands before starting the bot, so it's safe to
use directly as a platform start command. See docs/deployment.md for the
Railway + Postgres setup.
Create .env.example like this:
DISCORD_TOKEN=
DISCORD_CLIENT_ID=
DISCORD_GUILD_ID=
DATABASE_URL="file:./dev.db"
NODE_ENV=development
LOG_LEVEL=debugNever commit your real .env file.
- Pick one old feature from the legacy bot.
- Add it to
docs/feature-map.mdif missing. - Rebuild it cleanly inside
apps/bot/src/features/. - Add or update slash commands.
- Test the feature.
- Update documentation.
Important docs:
docs/architecture.md
docs/feature-map.md
docs/migration-notes.md
docs/deployment.md
AGENTS.mdThis is not a direct copy of the old bot.
The old bot is used to understand behavior. The new bot should be cleaner, safer, easier to extend, and easier to maintain.