Self-hosting
The IDE runs your bot only while it’s open. To keep the bot online, copy the project to a server. The server runs the same engine as the IDE, @makecord/runtime, so the bot behaves the same way.
A project is ready to deploy as it is: it already has a package.json, a Dockerfile and a docker-compose.yml.
Before you deploy
Section titled “Before you deploy”- Remove
devGuildIdfrommakecord.jsonif the bot should work in every server. Global commands can take a while to show up in Discord. - Make sure every secret the bot needs is listed in
.env.example.
Deploy
Section titled “Deploy”-
Copy the project folder to the server, for example with
git cloneorscp. Node.js 22.12 or newer must be installed. -
Create
.envfrom the example and fill in the values:Terminal window cp .env.example .envnano .env -
Install and start:
Terminal window npm installnpm start
npm start stops when you close the terminal. Use a process manager to keep it running and restart it after a reboot, for example pm2: pm2 start npm --name my-bot -- start.
-
Copy the project folder to the server.
-
Create
.envfrom the example and fill in the values:Terminal window cp .env.example .env -
Build and start in the background:
Terminal window docker compose up -d
The compose file restarts the bot unless you stop it. Follow the logs with docker compose logs -f.
On a server the runtime prints readable logs instead of talking to the IDE:
19:42:07 INFO ● ready — My bot#4821 is online in 3 servers19:42:08 INFO Registered 2 commands (global): greet, pingUpdating
Section titled “Updating”- Your flows: copy the changed
*.flow.jsonfiles to the server and restart the bot. - The engine: run
npm update @makecord/runtime(or rebuild the Docker image) when a new version comes out, for example after a Discord API change.