Comparison
Deploying a Node.js bot (grammY, discord.js, Bolt) to production
Node.js bots deploy easily if start, config and shutdown are explicit.
Comparison2 min readUpdated
Checklist
- A
start script in package.json and a committed lockfile. - Config from
process.env; locally use node --env-file=.env. - Handle SIGTERM so deploys stop the bot cleanly.
- Listen on
process.env.PORT for webhook mode.
FROM node:20-slim
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
USER node
CMD ["npm", "start"]
Deploy
Railway: Tutorial: deploy a bot on Railway · Vultr: Tutorial: bot on a Vultr VPS with systemd
Templates: grammY · discord.js · Slack Bolt · WhatsApp
Frequently asked questions
Which Node.js version?
Our templates target Node.js 20 or newer; use an active LTS line.
npm ci or npm install?
npm ci in production: it installs exactly the lockfile.
Why does my bot reply twice after a deploy?
The old and new copies overlapped; handle SIGTERM and avoid running two replicas of a polling or gateway bot.