Hosting Discord.js v14 Bots on NodeFlux Applications | NodeFlux.eu Docs
Deploy modern Discord.js v14 bots using gateway intents, environment variables, and event handlers.
Steps
- Prepare your Discord bot project locally and ensure package.json specifies "node": ">=18.0.0".
- Include required dependencies in package.json: "discord.js": "^14.0.0".
- Use process.env.DISCORD_TOKEN for authentication rather than hardcoding tokens in code.
- Upload project files to NodeFlux Node.js service using SFTP or panel File Manager (exclude node_modules).
- Configure DISCORD_TOKEN in the service Environment Variables panel.
- Install dependencies via panel package installer or npm ci workflow.
- Set entry point script (e.g., node index.js) and start the service.
- Verify bot signs online in your Discord server and logs clean gateway connection.
Notes
- Ensure required Gateway Intents (e.g., Message Content, Guild Members) are enabled in the Discord Developer Portal.
- Node.js services automatically restart if your bot process crashes due to unhandled promise rejections.
Related NodeFlux pages
- Connect a Node.js app to an external database — Use an external database safely without assuming NodeFlux provides a managed database for customer apps.
- Structuring Express and Fastify Web APIs for Production — Build lightweight, production-ready HTTP REST APIs with proper port binding and error handling.
- Configure environment variables and secrets — Keep bot tokens, API keys, and connection strings out of your source code.