How to Host a Discord Bot for Free
A practical beginner walkthrough for preparing, uploading and starting a Discord bot on free hosting.
Hosting a Discord bot begins before you press Start. The project needs a valid bot application, correct runtime, dependencies, a secure token and a startup command. Preparing these pieces correctly prevents many common deployment failures.
1. Prepare your Discord bot project
Your project should work locally before you move it to hosting. A deployment environment cannot fix broken application code automatically.
- Confirm the bot starts locally.
- Confirm dependencies install correctly.
- Know which Node.js or Python version the project requires.
- Identify the main startup file.
- Remove hard-coded secrets from source files.
2. Upload the project
Upload the application source files through the hosting file manager or deployment method supported by your host. Avoid uploading unnecessary development caches or unrelated archives unless your workflow requires them.
3. Install dependencies
Node.js projects normally use package.json to describe dependencies, while Python projects commonly use requirements.txt or another dependency manager.
Node.js:
npm install
Python:
pip install -r requirements.txt
4. Add the bot token securely
Do not publish the bot token in your code or screenshots. Prefer environment variables or a secrets feature provided by the hosting platform.
5. Configure the startup command
The startup command must point to the correct entry file and use the correct runtime. If your main file is index.js, for example, a common Node.js startup command is node index.js.
node index.js
# or
npm start
6. Start the bot and read Console
After starting the application, read the Console instead of assuming success. A successful Discord connection normally produces application-specific ready output, while failures often show a useful error message.
Frequently Asked Questions
Why does my bot start and immediately stop?
Common causes include an invalid token, missing dependency, wrong startup file, incompatible runtime or an unhandled application error.
Should I upload node_modules?
Usually the safer deployment workflow is to install dependencies on the server from package.json unless your environment specifically requires another approach.
Can I use TypeScript?
Yes, but the deployment workflow must compile or run TypeScript according to the project design.