@nestjs/schedule

Declarative cron, interval, and timeout job scheduling for NestJS applications via decorators.

Library
npm
v6.1.3
423stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
84/100Excellent
Development Activity100
Maintenance84
Community64
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
83/100Excellent
Architecture84
Code Quality85
Innovation74
Learning Curve88

@nestjs/schedule is the official NestJS module for running scheduled tasks, built on top of the cron package. It lets developers annotate provider methods with @Cron(), @Interval(), or @Timeout() decorators and have the framework register, start, and manage those jobs automatically as part of the application lifecycle.

Under the hood, a ScheduleExplorer scans providers at bootstrap for decorated methods and hands them to a SchedulerRegistry/SchedulerOrchestrator, which tracks live cron jobs, intervals, and timeouts so they can be looked up, dynamically added, or stopped at runtime via dependency injection — rather than living as free-standing timers outside the framework’s control.

What You Get

  • @Cron() decorator for cron-expression-based recurring jobs, including named jobs and timezone/UTC-offset options
  • @Interval() and @Timeout() decorators for simpler recurring or delayed execution
  • A SchedulerRegistry service for looking up, adding, or deleting cron jobs, intervals, and timeouts at runtime
  • Automatic discovery of decorated methods across all providers via ScheduleExplorer at application bootstrap
  • A ScheduleModule.forRoot() entrypoint that wires scheduling into the Nest module graph
  • Dynamic module support for registering jobs outside of decorators when schedules are computed at runtime

Common Use Cases

  • Running periodic maintenance tasks (cache cleanup, session expiry, report generation) inside a Nest backend
  • Polling external APIs or databases on a fixed interval from within a Nest service
  • Firing one-off delayed jobs after application startup via @Timeout()
  • Building admin tooling that lists, pauses, or reschedules cron jobs at runtime through the SchedulerRegistry

Under The Hood

Architecturelib/schedule.module.ts exposes a ScheduleModule.forRoot() dynamic module that wires together three collaborators: ScheduleExplorer walks the Nest module/provider graph at bootstrap (via DiscoveryService/MetadataScanner) looking for methods carrying SCHEDULE_CRON_OPTIONS/interval/timeout metadata set by the decorators; SchedulerRegistry is the injectable public API for looking up and mutating jobs by name; and SchedulerOrchestrator holds the actual live CronJob/timer instances and starts/stops them in response to lifecycle hooks (OnApplicationBootstrap, OnApplicationShutdown). Tech Stack — TypeScript targeting the Nest 11.x peer dependencies (@nestjs/common/@nestjs/core), with a single runtime dependency on the cron npm package for cron-expression parsing and timezone handling; builds with tsc, lints with oxlint, and tests with vitest (migrated off Jest). Code Qualitytests/ contains integration tests that boot a real Nest TestingModule and assert jobs get registered/executed, rather than only unit-testing decorators in isolation; the schedule.messages.ts module centralizes user-facing error strings for consistency; commit history shows steady dependency bumps via Renovate alongside human-authored feature/fix commits. API Design — decorators (@Cron(CronExpression.EVERY_MINUTE), @Interval(1000), @Timeout(5000)) read as plain annotations on ordinary provider methods, so adopting scheduling requires no boilerplate beyond importing ScheduleModule.forRoot() once; the CronExpression enum spares users from memorizing raw cron syntax for common schedules, and SchedulerRegistry gives an escape hatch to imperative control when the declarative decorator model isn’t enough.

Used by 18 apps in this directory

TypeScript
88%
Other

AFFiNE

Productivity · Project Management · Note Taking

71,668

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
68
Dependency
Built with
TypeScript88%
Updated today
TypeScript
72%
AGPL 3.0

APITable

Low Code Platforms · Databases

15,526

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
53
Repo Health
77
Technical
60
Dependency
Built with
TypeScript72%
Java22%
Updated 9 months ago
TypeScript
97%
AGPL 3.0

Bigcapital

Invoicing Finance

3,846

Self-hostable double-entry accounting platform with invoicing, inventory, multi-currency, and real-time financial reporting for small and medium businesses.

View details
91
Repo Health
77
Technical
64
Dependency
Built with
TypeScript97%
Updated yesterday
TypeScript
95%
AGPL 3.0

Docmost

Productivity · Note Taking · Collaboration

21,411

Self-hosted collaborative wiki and knowledge base with real-time editing, diagrams, AI assistance, and enterprise access controls — a modern alternative to Confluence and Notion.

View details
89
Repo Health
70
Technical
71
Dependency
Built with
TypeScript95%
Updated yesterday
TypeScript
74%
AGPL 3.0

Ghostfolio

Invoicing Finance

9,153

Track your stocks, ETFs, and crypto with a privacy-first, self-hostable wealth management platform built for data-driven investors.

View details
93
Repo Health
79
Technical
71
Dependency
Built with
TypeScript74%
HTML23%
Updated yesterday
TypeScript
98%
Other

Hexabot

AI Development · Automation

1,186

Build and run agentic workflows across channels with YAML, tools, and RAG

View details
79
Repo Health
76
Technical
70
Dependency
Built with
TypeScript98%
Updated yesterday
TypeScript
95%
AGPL 3.0

HeyForm

Forms Surveys · No Code Platforms

8,938

Open-source conversational form builder with AI generation, conditional logic, and 30+ integrations — self-host with full data ownership.

View details
86
Repo Health
67
Technical
69
Dependency
Built with
TypeScript95%
Updated today
TypeScript
71%
Other

highlight.io

Developer Tools · Analytics · Monitoring

9,367

Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.

View details
69
Repo Health
78
Technical
66
Dependency
Built with
TypeScript71%
Go16%
Updated yesterday
TypeScript
67%
MIT

Hoppscotch

Developer Tools

80,055

A lightweight, offline-capable API development ecosystem for testing HTTP, GraphQL, WebSocket, MQTT, and SSE endpoints across web, desktop, and CLI.

View details
91
Repo Health
83
Technical
66
Dependency
Built with
TypeScript67%
Vue23%
Updated 3 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search