PM2 is the recommended process manager for running both bots —Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Capinetta-RP/capinetta-discord-bot/llms.txt
Use this file to discover all available pages before exploring further.
capinetta-general and capinetta-whitelist — reliably in production. It handles automatic restarts on crash, structured log aggregation, and registering the bots as system services so they survive server reboots. The project ships with a ready-made ecosystem.config.js that defines both processes with sensible defaults.
ecosystem.config.js
The project root contains this configuration file, whichnpm run prod passes directly to PM2:
npm Scripts Reference
The following scripts frompackage.json are relevant to deployment and process management:
| Script | Command run | Description |
|---|---|---|
npm run prod | pm2 start ecosystem.config.js | Start both bots via PM2 |
npm run deploy | node deploy-general.js && node deploy-whitelist.js | Deploy slash commands for both bots |
npm run deploy:general | node deploy-general.js | Deploy General Bot slash commands only |
npm run deploy:whitelist | node deploy-whitelist.js | Deploy Whitelist Bot slash commands only |
npm run gen-ssl | node generate-ssl-certs.js | Generate self-signed SSL certs into certs/ |
npm run setup | Install, migrate, deploy, minify, prod | Full production setup in one command |
npm run setup:dev | Install, db push, deploy, minify, prod | Full development setup in one command |
Common PM2 Commands
| Command | Description |
|---|---|
npm run prod | Start both bots via PM2 (runs pm2 start ecosystem.config.js) |
pm2 list | List all running processes and their status |
pm2 logs | Tail logs from all processes |
pm2 logs capinetta-general | Tail logs from the General Bot only |
pm2 restart all | Restart all bots |
pm2 restart capinetta-general | Restart only the General Bot |
pm2 stop all | Stop all processes |
pm2 delete all | Remove all processes from PM2 |
pm2 monit | Live dashboard: CPU, RAM, and logs per process |
Auto-Start on Server Reboot
pm2 startup, PM2 will print a sudo env PATH=... command tailored to your system. Copy and run that exact command to complete the registration.
Updating the Bot
Log Management
NODE_ENV=production is set directly in ecosystem.config.js for both processes. This enables production-mode optimizations in Express (fewer verbose errors, better performance) and suppresses development-only warnings from libraries like discord.js and Prisma.