Scheduler
@veloxts/scheduler provides expressive, fluent task scheduling with cron expressions.
Installation
Section titled “Installation”pnpm add @veloxts/schedulerQuick Start
Section titled “Quick Start”import { schedulerPlugin, schedule } from '@veloxts/scheduler';
app.register(schedulerPlugin);
schedule('cleanup-sessions') .call(async () => { await db.session.deleteMany({ where: { expiresAt: { lt: new Date() } }, }); }) .daily() .at('03:00');Scheduling Patterns
Section titled “Scheduling Patterns”// Every minuteschedule('task').call(fn).everyMinute();
// Hourlyschedule('task').call(fn).hourly();
// Daily at specific timeschedule('task').call(fn).daily().at('09:00');
// Weekly on Mondayschedule('task').call(fn).weekly().on('monday');
// Weekdays onlyschedule('task').call(fn).weekdays().at('09:00');
// Custom cronschedule('task').call(fn).cron('0 */6 * * *');Options
Section titled “Options”schedule('sync-data') .call(syncData) .hourly() .timezone('America/New_York') .withoutOverlapping() .onSuccess((ctx, duration) => { console.log(`Completed in ${duration}ms`); }) .onFailure((ctx, error) => { console.error('Failed:', error); });Next Steps
Section titled “Next Steps”- Queue - Background jobs
- Ecosystem Overview - All packages