Learn simple methods to run background jobs in Replit, automate tasks, and keep processes running reliably in your projects.

Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
The short version: Replit does not support true background jobs that keep running after your Repl goes to sleep. If you need something to run continuously, you must keep the Repl awake with an external pinger or run your job inside the main process of a “Deploy → Always On” plan. For scheduled tasks (like cron jobs), you implement a scheduler inside your running code, because Replit does not have a built‑in cron system.
On your laptop, you might have a daemon process, a cron job, or a worker that keeps running even after you close your terminal. Replit is different. A Repl goes to sleep when nobody is interacting with it unless it’s deployed as an Always On service (paid feature). When it sleeps, all background work stops.
The safe mindset is this: a Repl can only run long-lived background tasks if the Repl itself stays awake. And that only happens if:
This is the most common and reliable approach. Instead of trying to spin off a second script in the background, you run a scheduler inside your web server code. The server runs continuously (if Always On), and your scheduled job runs on intervals.
Example with Node.js using setInterval:
import express from "express";
const app = express();
// Your normal endpoint
app.get("/", (req, res) => {
res.send("Server running!");
});
// Background job: runs every 60 seconds
setInterval(() => {
console.log("Background job executed!");
// Put your logic here: cleanup, API fetch, etc.
}, 60 * 1000);
// Start the server
app.listen(3000, () => {
console.log("Server started on port 3000");
});
This works because the job is part of the running application. As long as the server stays alive (Always On), the job keeps running.
Sometimes you want a clean separation: one Repl for your API, one Repl for background tasks. In that case, you run a single script with an infinite loop or a scheduler.
Example using Python with schedule:
import schedule
import time
def job():
print("Background job executed!")
# Put your logic here
schedule.every(1).minutes.do(job)
while True:
schedule.run_pending()
time.sleep(1)
This only works reliably if the worker Repl is deployed as Always On. Otherwise, it will stop when the Repl sleeps.
If Always On isn’t an option, the workaround is to expose a simple HTTP endpoint and use an external uptime monitor to ping your Repl every few minutes. This prevents the container from sleeping, so your in-process scheduler works. Not officially supported, but widely used in practice.
Your code still runs the same as in earlier examples. The difference is that an external service keeps your Repl awake.
If you treat Replit like a cloud runtime instead of a laptop, background jobs become straightforward: a continuously running deployment, with your scheduler living inside the app itself.
When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.