# node-cron — card for AI agents

Job scheduling for Node.js with overlap prevention and distributed coordination.

Category: Jobs, queues and workflows · npm package `node-cron` · latest version 4.6.0 (checked 2026-11-01)
Install: `npm install node-cron`
License: ISC (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (paste into AGENTS.md or CLAUDE.md)

## node-cron
- Target v4: it requires Node.js 20+. Use `task.execute()`, not `task.now()`. Do not pass `scheduled`, `runOnInit` or `recoverMissedExecutions`; v4 removed them.
- `cron.schedule` starts the task immediately. When the task should start later, use `cron.createTask` with the same arguments and call `.start()` yourself.
- Listen for `execution:finished` and `execution:failed`, not the v3 `task-done` event. Listeners receive a `TaskContext`.
- Add `noOverlap: true` for jobs that can outlast their interval. Add `distributed: true` plus a `name` when the app runs on several instances.
- For background tasks (a file path instead of a function) in a bundled app, mark node-cron as external (`--external:node-cron`). The `logger` option is not supported for background tasks.
- Use `timezone: 'UTC'` when a fixed interval must keep firing across DST changes.
- Do not use node-cron when you need durable queues, retries, or exactly-once runs across crashes. It does not persist state.

## Docs written for agents
- [llms.txt (index of the docs)](https://nodecron.com/llms.txt)

## What it is
- node-cron schedules recurring work in a Node.js process using cron expressions. You call `cron.schedule(expression, task)` and the task starts right away. The returned task object can be stopped, resumed, destroyed and inspected. The package has no runtime dependencies and is written in TypeScript. The repository dates from 2016 and is ISC licensed.
- Beyond plain cron, the README lists four additions. `noOverlap` skips a run while the previous one is still going. `distributed: true` makes only one instance execute each fire. Passing a file path instead of a function runs the job in a forked process. Lifecycle events cover started, finished, failed, missed and skipped runs. Version 4 is a TypeScript rewrite that requires Node.js 20 or newer and ships both ESM and CommonJS builds.
- It suits apps that need timed jobs inside the app itself: nightly backups, cleanups, periodic checks. The maintainers point readers elsewhere for durable queues with retries, workflow orchestration, or exactly-once guarantees across crashes.

## Caveats
- Not durable: Schedules live in process memory. The maintainers say node-cron does not persist state, and they recommend a queue or workflow engine when you need exactly-once guarantees across crashes.
- Missed runs are not replayed: v4 removed `recoverMissedExecutions`. A missed run only emits `execution:missed` and logs a warning. Any catch-up logic is yours to write.
- Bundlers break background tasks: Background tasks fork a helper file from `node_modules`. If you bundle without marking node-cron external, the fork fails with `Cannot find module '.../daemon.js'`. Inline function tasks are not affected.
- Quartz-looking, not Quartz-compatible: The `L`, `W`, `#` and `?` modifiers are borrowed from Quartz, but weekday numbers follow standard cron. Day-of-month and day-of-week are combined with AND, so Quartz expressions can fire on different days.
- DST fall-back can pause sub-hourly jobs: Schedules follow wall-clock time in the task's timezone. During the repeated fall-back hour, a schedule like `*/15` can stop firing for that hour. The README suggests `timezone: 'UTC'` for uninterrupted intervals.

## Numbers (AgentGid data)
- Gid Score: 61.9 (#873 of all tools, 6 of 48 in its category)
- Used in 38 public projects set up for AI coding agents (0.6%)
- Downloads last week: 7,151,932 (as of 2026-11-24), +36.9% over 4 weeks
- GitHub stars: 3,286 (as of 2026-11-24)
- Last push: 2026-11-07

## Often used with
dotenv 86.8%, uuid 55.3%, Express 55.3%, cors 47.4%, tsx 52.6%, Zod 65.8%

## Checked alternatives (same job)
- Croner: https://agentgid.com/tools/croner/agent.md
- BullMQ: https://agentgid.com/tools/bullmq/agent.md
- cron: https://agentgid.com/tools/cron/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/node-cron/
- Homepage: https://nodecron.com
- Repository: https://github.com/node-cron/node-cron
- Source: https://github.com/node-cron/node-cron#readme
- Source: https://github.com/node-cron/node-cron
- Source: https://github.com/node-cron/node-cron/releases
- Source: https://nodecron.com
- Source: https://nodecron.com/getting-started.md
- Source: https://nodecron.com/migrating-from-v3.md

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
