Requirements
- AdonisJS v6.2.0 or higher
- Node.js v18 or higher
Installation steps
Install the package
Run the following command in your AdonisJS project:This command will:
- Install the
adonisjs-schedulerpackage from npm - Register the scheduler provider in your
adonisrc.tsfile - Register scheduler commands for running the scheduler
- Create a
start/scheduler.tsfile with example schedules - Add the scheduler file to the preload configuration
Verify the configuration
After installation, your
adonisrc.ts should include the following additions:The provider is configured to run in the
console environment by default. This means it only loads when running Ace commands, not during HTTP requests.Review the starter file
The installation creates a You can modify this file to add your own scheduled tasks.
start/scheduler.ts file with example schedules:start/scheduler.ts
Available commands
After installation, you’ll have access to the following scheduler commands:Manual installation
If you prefer to install manually or need more control over the configuration:Environment configuration
By default, the scheduler provider runs only in theconsole environment. If you need to run the scheduler in other environments (e.g., web, test), modify the provider configuration:
adonisrc.ts
Next steps
Quickstart
Now that you have AdonisJS Scheduler installed, learn how to create your first scheduled task