This guide walks you through deploying a Discord.js bot on Daki Hosting — from creating your server to having your bot online and reading its token securely.Documentation Index
Fetch the complete documentation index at: https://wiki.daki.cc/llms.txt
Use this file to discover all available pages before exploring further.
What you’ll learn
- How to create a Node.js server for your bot
- How to upload your code
- How to configure the install command, startup command, and Docker image
- How to set your bot token securely using a
.envfile - How to start your bot and verify it works
Prerequisites
- A Daki account (Free Tier or paid) — see Create an Account
- A Discord bot with a bot token, created in the Discord Developer Portal
- Your bot’s source code, including a
package.jsonwithdiscord.jsanddotenvas dependencies
Discord bots connect outbound to Discord’s servers and do not require an inbound port. This means Discord bots work on both Free Tier and paid plans. If your bot also serves HTTP requests (e.g., for slash command interactions or webhooks), you will need a paid plan, as publicly accessible ports are only available on paid plans. See Network & Allocations.
Step 1: Create a Node.js Server
- Log in to the Free Tier Dashboard at dash.daki.cc or the Billing Panel at billing.daki.cc.
- Create a new server and select the Node.js egg.
- Give your server a name (e.g.,
MyDiscordBot).
Step 2: Access the Portal
Log in to the Portal via SSO (from the Credentials tab or your Billing Panel service page), or directly at portal.daki.cc. See Portal Overview.Step 3: Upload Your Bot’s Code
Option A — Upload as a ZIP (simplest):- Compress your project folder into a
.zipfile locally. - In the Portal, go to the Files tab and click Upload.
- Right-click the
.zipand click Extract.
Do not include your
node_modules folder in the upload — it will be installed automatically by the install command. Do include your package.json and package-lock.json.Step 4: Configure the Startup Tab
Open the Startup tab and configure all three fields: 1. Docker Image — Select the Node.js version your bot requires (e.g., Node.js 20 or Node.js 22). Node.js 20 LTS is a safe default if unsure. 2. Install Command — Set this to install your dependencies automatically:node index.js— if your entry file isindex.jsnode bot.js— if your entry file isbot.jsnpm start— if you have astartscript inpackage.json
Step 5: Add Your Bot Token via a .env File
Your bot needs its Discord token to connect. Store it in a .env file on the server so it never ends up in your source code.
- In the Files tab, click New File and name it
.env. - Add your token:
- Click Save.
dotenv:
dotenv is listed in your package.json dependencies so it gets installed by the install command.
See Environment Variables for more details on using .env files.
Step 6: Start Your Bot
Click Start in the Console tab. A successful launch will print your bot’s login confirmation:Common Issues
Error: Cannot find module 'discord.js'
Error: Cannot find module 'discord.js'
Your dependencies were not installed. Check that your
package.json lists discord.js as a dependency, and that the install command is set to npm install in the Startup tab. Restart the server to trigger the install.Error: Cannot find module 'dotenv'
Error: Cannot find module 'dotenv'
Add
dotenv to your package.json dependencies and restart the server to reinstall.Error: An invalid token was provided
Error: An invalid token was provided
Your bot token in the
.env file is incorrect or missing. Go to the Files tab, open .env, and verify the value. Make sure there are no extra spaces, quotes, or line breaks.Bot starts but disconnects shortly after
Bot starts but disconnects shortly after
This is usually caused by missing Gateway Intents. In the Discord Developer Portal, enable the required privileged intents (e.g., Message Content Intent) for your bot application, and ensure your code requests them.
Server crashes immediately on start
Server crashes immediately on start
Open the Console tab and read the error. Common causes: wrong startup command (filename typo), wrong Node.js version, or missing
node_modules. See Troubleshooting.Next Steps
- Environment Variables — Full guide on
.envfiles and reading variables in code. - Keep Your Free Server Active — Watch ads to keep your Free Tier server alive.
- File Manager — Update your code files after making changes.