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

gut-punch

v0.1.7

Published

Job definitions and core types for GutPunch

Readme

Gut Punch

A class-first, modular job scheduler for TypeScript, supporting both Node.js and Bun runtimes.

Features

  • Define jobs as classes extending BaseJob, with built-in status tracking and automatic rescheduling via reschedule & rescheduleIn flags.
  • YAML-based global configuration (config.yaml).
  • Flexible build process using either Vite or Bun's bundler.
  • Output structure: dist/jobs/ for jobs, dist/cli.cjs for CLI.
  • Persistent job definitions and runs using Drizzle ORM + SQLite.
  • Priority queues, retry/backoff strategies, and customizable rescheduling.
  • CLI tools to list jobs, queues, upcoming schedules, or run the scheduler.
  • Support for both Node.js and Bun runtimes.

Prerequisites

  • Node.js >= 18 or Bun >= 1.0.0
  • SQLite (via better-sqlite3)

Installation

Using Node.js with pnpm

git clone <repository-url>
cd gut-punch
pnpm install

Using Bun

git clone <repository-url>
cd gut-punch
bun install

Build

Using Node.js with Vite

Build all jobs and CLI with a single command:

pnpm run build

Using Bun

Build with Bun's bundler:

bun run build:bun

Both methods will output jobs to dist/jobs/ and the CLI to dist/cli.cjs.

Configuration

Edit config.yaml to set the database file, jobs path, and queue priorities. Note: After building, jobs are loaded from the dist/jobs directory.

database:
  file: ./gut-punch.db
jobsDirectory: dist/jobs
queues:
  default:
    priority: 1
  critical:
    priority: 10

Build & Database Migrations

Build all jobs and CLI (output to dist/):

# Using Node.js
pnpm run build

# Using Bun
bun run build:bun

Generate and apply migrations for the updated schema:

# Using Node.js
pnpm run db:generate
pnpm run db:migrate

# Using Bun
bun run db:generate
bun run db:migrate

Defining Jobs

Create classes in src/jobs/ that extend BaseJob. These will be automatically built into dist/jobs/ and loaded by the scheduler at runtime:

import { BaseJob } from '../core/base-job';
import { JobStatus } from '../core/types';

export class MyJob extends BaseJob {
  public readonly name = 'MyJob';
  public readonly reschedule = true;
  public readonly rescheduleIn = 1000 * 60 * 30; // 30 minutes

  public async run(): Promise<{ status: JobStatus; output?: unknown }> {
    // Your job logic
    return { status: JobStatus.Success, output: { doneAt: new Date().toISOString() } };
  }
}

CLI Usage

Run locally in development:

# Using Node.js
pnpm run dev

# Using Bun
bun run dev:bun

Use the CLI commands:

# Using Node.js
npx ts-node src/cli.ts list-jobs     # Show loaded job definitions
npx ts-node src/cli.ts list-queues   # Show current queue counts
npx ts-node src/cli.ts upcoming      # List upcoming scheduled jobs
npx ts-node src/cli.ts run           # Start scheduler (blocks)

# Using Bun
bun run src/cli.ts list-jobs         # Show loaded job definitions
bun run src/cli.ts list-queues       # Show current queue counts
bun run src/cli.ts upcoming          # List upcoming scheduled jobs
bun run src/cli.ts run               # Start scheduler (blocks)

Production

Build and start:

# Using Node.js
pnpm run build
pnpm start

# Using Bun
bun run build:bun
bun start

Contributing

  1. Fork the repo
  2. Create a feature branch
  3. Open a PR

License

MIT

Testing

Run tests:

# Run tests
bun test

# Run tests with coverage
bun test --coverage

Updated on 2025-05-31