If you're using any Linux server, you can follow this guide to run the application as a systemd service.
[!WARN] Before running the application, make sure you're using a supported Node.js version (see nvm-setup.md).
Make a new service called discordbot.service in the /etc/systemd/system folder based on THIS example file:
sudo nano /etc/systemd/system/discordbot.seviceEdit the relevant lines in the file (you can leave the rest as-is), then save the changes:
Tip
You can find out your node path with which node command.
...
Environment="PATH=/home/your-user/.nvm/versions/node/v24.8.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
...
User=your-user
Group=your-group
WorkingDirectory=/path/to/the/projects/folder
ExecStartPre=/bin/mkdir -p /path/to/the/projects/folder/temp
ExecStartPre=/bin/chmod -R 777 /path/to/the/projects/folder/temp
...Reload systemd:
sudo systemctl daemon-reloadStart the service:
sudo systemctl start discordbot.service(Optional) Enable the service to start on boot:
sudo systemctl enable discordbot.serviceYou can check the app's status with:
sudo systemctl status discordbot.serviceYou can check the app's error logs with:
sudo journalctl -u discordbot.serviceYou can stop the service with:
sudo systemctl stop discordbot.serviceYou can disable (stop starting on boot) the service with:
sudo systemctl disable discordbot.service