Croner
A zero-dependency cron job scheduler and cron-expression evaluator for JavaScript and TypeScript
Repository Health
Technical Analysis
Croner lets JavaScript and TypeScript code trigger functions on a cron schedule, or simply evaluate cron expressions to compute upcoming/previous run times, without pulling in any runtime dependencies. It extends standard cron syntax with seconds and year fields plus L (last), W (nearest weekday), # (nth weekday occurrence), and + (AND logic) modifiers, and it runs unmodified across Node.js, Deno, Bun, and the browser (as a standalone script, UMD bundle, or ES module).
Beyond simple scheduling, Croner builds in the operational guardrails that hand-rolled setInterval-based schedulers usually lack: overrun protection so a slow-running job doesn’t overlap itself, structured error handling for both sync and async job functions, per-job pause/resume/stop control, and explicit time-zone targeting for schedules that must run relative to a specific locale rather than server local time. Because everything runs in-memory with no database or config files, it fits equally well as a lightweight in-process scheduler for a small service or as the timing engine embedded inside a larger job-processing system.
What You Get
new Cron(pattern, fn)to schedule a function against a cron expression with extended syntax (seconds, years,L/W/#/+).nextRun()/.nextRuns(n)/ previous-run helpers to evaluate a cron expression without actually scheduling anything- Built-in overrun protection so a long-running job invocation doesn’t overlap its next scheduled trigger
- Structured error handling for both synchronous and asynchronous job functions
- Per-job
.pause()/.resume()/.stop()control after a job has been scheduled - Explicit time-zone targeting so schedules run against a specific zone rather than server local time
Common Use Cases
- Running periodic maintenance jobs (cleanup, cache refresh, report generation) inside a Node.js/Bun backend service
- Scheduling in-browser reminders or periodic UI refreshes without a server-side cron daemon
- Computing ‘next N occurrences’ of a cron expression for a scheduling UI or admin dashboard
- Embedding cron-based timing as the scheduling engine inside a larger task/job-processing system
Under The Hood
Architecture - The library is authored Deno-first: deno.json defines the canonical ./src/croner.ts export, and a build/build.ts script (using esbuild plus esbuild-plugin-d.ts) compiles the Deno source down to the published npm package, so a single TypeScript codebase targets JSR, npm, and browser bundles from one source of truth. Core logic is split across src/croner.ts (the Cron class and scheduling loop), src/pattern.ts (cron-expression parsing including the extended L/W/#/+ modifiers), src/date.ts (date math and next/previous run computation), and src/helpers/timezone.ts (time-zone-aware evaluation). Tech Stack - Pure TypeScript with zero runtime dependencies; builds and tests run through Deno’s own toolchain (deno test, deno lint, deno fmt) rather than a Node-centric bundler, with esbuild used only for the npm/browser distribution step. Code Quality - The test/ directory contains a large, expression-focused Deno test suite (pattern.test.ts, range.test.ts, question-mark.test.ts, previous-runs.test.ts, several ocps-*.test.ts conformance suites), reflecting the project’s emphasis on correctly matching cron-expression edge cases across many real-world patterns. API Design - The primary API is a single Cron(pattern, fn, options) constructor plus a handful of instance methods (nextRun, nextRuns, pause, resume, stop), which keeps the surface area small; supporting both ‘trigger a function’ and ‘just evaluate an expression’ from the same constructor lets the same mental model cover both scheduling and pure cron-math use cases.
Used by 16 apps in this directory
AionUi
AI Agents · Productivity
Free, open-source Cowork desktop app that unifies Claude Code, Codex, Gemini CLI, and 20+ AI agents into a single platform with multi-agent teams, 24/7 cron automation, and zero-config built-in agent.
bunqueue
Developer Tools · Devops
High-performance job queue for Bun — SQLite persistence, cron scheduling, DLQ, S3 backups, and a native MCP server, all without Redis.
Cherry Studio
AI Assistants
All-in-one AI desktop client with 300+ assistants and multi-model support
flue
AI Agents · Developer Tools
Build autonomous AI agents and powerful workflows with a programmable TypeScript harness that gives any model sessions, tools, sandboxes, and durable execution.
Grafana
Monitoring · Analytics
The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.
Kaneo
Product Management · Productivity · Project Management
Lightweight self-hosted project management that gives you kanban boards, GitHub sync, and full team collaboration without the enterprise bloat.
Kener
Monitoring · Devops
Stunning, self-hosted status pages with real-time uptime monitoring, incident management, and multi-channel notifications in a single Docker container.
Mastra Code
AI Code Assistants
"A coding agent that never compacts" — a terminal-based AI coding agent built on the Mastra framework, with Observational Memory instead of context compaction, multi-model support, and OAuth login for Claude Max or ChatGPT Plus.
Mistle
AI Agents · Developer Tools
Self-hostable platform for running autonomous coding agents in isolated, credentialless sandboxes with brokered credentials, reusable snapshots, and event-driven triggers.