Skip to content

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.

  • Remove devGuildId from makecord.json if 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.
  1. Copy the project folder to the server, for example with git clone or scp. Node.js 22.12 or newer must be installed.

  2. Create .env from the example and fill in the values:

    Terminal window
    cp .env.example .env
    nano .env
  3. Install and start:

    Terminal window
    npm install
    npm 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.

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 servers
19:42:08 INFO Registered 2 commands (global): greet, ping
  • Your flows: copy the changed *.flow.json files 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.