Discord bot project structure

Discord bot project structure

Explorer

  • .git…
  • .vscode
  • extensions.json
  • settings.json
  • drizzlenew
  • 0000_initial.sqlnew
  • meta…new
  • node_modules…, not committed
  • src
  • index.ts
  • config.tsnew
  • registry.tsnew
  • testsnew
  • streaks.test.tsnew
  • guild-settings.test.tsnew
  • sessions.test.tsnew
  • focus.command.test.tsnew
  • .env, not committed
  • .env.examplenew
  • .gitignore
  • .nvmrcnew
  • .prettierignore
  • .prettierrc.json
  • compose.yamlnew
  • drizzle.config.tsnew
  • eslint.config.js
  • package-lock.json
  • package.json
  • README.mdnew
  • tsconfig.eslint.json
  • tsconfig.json
  • vitest.config.tsnew
  1. # Create the bot from the official discord.js template

    npm create discord-bot@latest study-buddy -- --typescript
  2. # Fill DISCORD_TOKEN and APPLICATION_ID in .env, then register commands

    cd study-buddy && npm run deploy
  3. # Start the bot

    npm start
  4. # Add the database, logging and config validation

    npm install drizzle-orm pg pino && npm install -D drizzle-kit @types/pg pino-pretty
  5. # Generate and apply a migration after changing the schema

    npx drizzle-kit generate && npm run db:migrate
  6. # Add tests

    npm install -D vitest @testcontainers/postgresql
  7. # Build and run the production image locally

    docker compose up --build