Skip to main content

Task Scheduler for AdonisJS

Build reliable cron jobs and scheduled tasks with an elegant, decorator-based API. Features overlapping prevention, timezone support, and hot-reloading during development.

AdonisJS v6+TypeScriptMIT License

Quick Start

Get up and running with scheduled tasks in minutes

1

Install the package

Install AdonisJS Scheduler using the Ace CLI:
node ace add adonisjs-scheduler
This command automatically configures the provider and creates the necessary files.
2

Define your first schedule

Open start/scheduler.ts and define a scheduled task:
import scheduler from 'adonisjs-scheduler/services/main'

scheduler
  .call(() => {
    console.log('This runs every minute!')
  })
  .everyMinute()
3

Run the scheduler

Start the scheduler worker to execute your scheduled tasks:
node ace scheduler:run
For development, use the --watch flag to enable hot-reloading:
node ace scheduler:run --watch

Key Features

Everything you need for robust task scheduling

Intuitive Frequency API

Expressive methods like .everyMinute(), .daily(), and .weekly() make scheduling readable and maintainable.

Decorator Scheduling

Use the @schedule decorator to define schedules directly on your command classes.

Overlap Prevention

Built-in locking ensures tasks don’t run concurrently, preventing race conditions.

Tag-Based Filtering

Organize and run specific groups of scheduled tasks using tags.

Timezone Support

Schedule tasks in any timezone for international deployments.

Lifecycle Hooks

Execute custom logic before and after each scheduled task runs.

Ready to get started?

Install AdonisJS Scheduler and build your first scheduled task in minutes.

View Installation Guide

Build docs developers (and LLMs) love