Kyoko - Discord Rpg
A Discord bot built with Bun, Discord.js, and Drizzle ORM.
Architecture
This project uses a modular architecture:
src/index.ts: Entry point. initializes the client.src/lib/KyokoClient.ts: Custom Discord Client wrapper handling command loading and events.src/lib/env.ts: Centralized Environment Configuration. Validates environment variables usingzodat startup.src/lib/DrizzleClient.ts: Database client instance.src/commands/: Command files.src/db/: Database schema and migrations.
Setup
-
Install Dependencies:
bun install -
Environment Variables: Copy
.env.exampleto.env(create one if it doesn't exist) and fill in the required values:DISCORD_BOT_TOKEN=your_token_here DISCORD_CLIENT_ID=your_client_id DISCORD_GUILD_ID=your_guild_id_optional DATABASE_URL=postgres://user:pass@localhost:5432/db_nameNote: The app will fail to start if
DISCORD_BOT_TOKENorDATABASE_URLare missing or invalid. -
Run Development:
bun run dev -
Database Migrations:
bun run db:push # Apply schema changes bun run generate # Generate migrations
Description
Languages
TypeScript
98.5%
CSS
0.9%
Shell
0.5%