I have a Javascript discord bot, and it is getting bigger and bigger, the problem is that every time I close my replit. In about 30 minutes my bot just goes offline. I use this code in my keep_alive.js file
http.createServer(function (req, res) {
res.write("Online:)");
res.end();
}).listen(8080);```
//I have this in index.js: `const keep_alive = require('./keep_alive.js')`
The best solution that I have found and use (and it is free) is pm2. It requires no code in your file at all
npm i pm2 -g
// navigate to the folder with your main bot.js file (in this example it is called index.js)
pm2 start index.js
// followed by
pm2 save
// Optionally you can monitor the whole server as well with
pm2-server-monit
Comes with a free dashboard as well