npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@naskot/node-cron-scheduler

v1.0.2

Published

A tiny framework-agnostic cron scheduler for Node.js with auto job loading from a directory.

Readme

node-cron-scheduler

Node.js cron scheduler.

  • Linux-like minute scheduling (mm hh jj MMM JJJ)
  • In-process runner
  • Auto-loading jobs from your own directory
  • No Express dependency

Install

npm install @naskot/node-cron-scheduler

Official Documentation

Quick Start

1) Keep jobs in your app (not in the package)

Example tree in your API project:

src/
  services/
    cron.service.ts
  cron/
    jobs/
      audits-purge.job.ts
      rabbitmq-cleanup.job.ts

Each job must export a CronModule (default export recommended):

import type { CronModule } from "@naskot/node-cron-scheduler";

const mod: CronModule = {
  config: {
    atBoot: false,
    lines: [{ mm: 0, hh: "*", jj: "*", MMM: "*", JJJ: "*" }],
  },
  run: async () => {
    // call your service here
  },
};

export default mod;

2) Write it in your src/services/cron.service.ts

import { join } from "node:path";
import { CronService } from "@naskot/node-cron-scheduler";

export const cronService = new CronService({
  jobsDir: join(__dirname, "../cron/jobs"),
  recursive: false,
  missingDirectoryBehavior: "warn",
  logger: {
    info: (message, meta) => console.info(message, meta),
    warn: (message, meta) => console.warn(message, meta),
    error: (message, meta) => console.error(message, meta),
  },
});

3) Start from bootstrap/init

Call this when your app/API is starting as a singleton.

await cronService.start();

4) Documentation

How-to guide (usage documentation):

API

  • CronRunner: low-level scheduler (manual registration)
  • loadCronJobsFromDirectory(runner, options): scan/require/register jobs from a folder
  • CronService: high-level wrapper that receives jobsDir and auto-loads on start()

Notes

  • The scheduler uses the Node.js process timezone.
  • Recommended pattern: keep the service in src/services/cron.service.ts and jobs in src/cron/jobs, then use join(__dirname, "../cron/jobs").
  • Jobs are loaded with require, exactly in the original starter template spirit.
  • Keep business logic in dedicated domain services; jobs should orchestrate calls only.