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

station-adapter-sqlite

v1.0.3

Published

SQLite adapter for station-signal using better-sqlite3

Downloads

408

Readme

station-adapter-sqlite

SQLite storage adapter for station-signal using better-sqlite3.

Install

pnpm add station-adapter-sqlite

Requires station-signal as a peer dependency.

pnpm 10+

better-sqlite3 is a native Node.js addon that compiles C++ code during installation. pnpm 10 blocks dependency lifecycle scripts by default. You must explicitly allow better-sqlite3 to build by adding this to your project's package.json:

{
  "pnpm": {
    "onlyBuiltDependencies": ["better-sqlite3"]
  }
}

Then reinstall:

pnpm install

Without this, you will see: The native binary for better-sqlite3 hasn't been compiled.

Usage

Configure globally:

import { configure } from "station-signal";
import { SqliteAdapter } from "station-adapter-sqlite";

configure({ adapter: new SqliteAdapter() });

Options

interface SqliteAdapterOptions {
  /** Path to the SQLite database file. Defaults to "station-signal.db". */
  dbPath?: string;
  /** Table name. Defaults to "entries". */
  tableName?: string;
}

Example with options:

const adapter = new SqliteAdapter({
  dbPath: "./data/jobs.db",
  tableName: "signal_entries",
});

With SignalRunner

The configModule pattern lets you share a single adapter instance across the runner and all spawned child processes.

  1. Create a config module (e.g. src/adapter.config.ts):
import { configure } from "station-signal";
import { SqliteAdapter } from "station-adapter-sqlite";

configure({ adapter: new SqliteAdapter({ dbPath: "./jobs.db" }) });
  1. Pass it to the runner:
import { SignalRunner } from "station-signal";
import { fileURLToPath } from "node:url";

const runner = new SignalRunner({
  signalsDir: "./src/signals",
  configModule: fileURLToPath(new URL("./adapter.config.ts", import.meta.url)),
});

await runner.start();

The runner imports the config module on startup and passes its path to every spawned child process via an environment variable, so they all connect to the same SQLite database.

Graceful shutdown

const adapter = new SqliteAdapter();
// ... use adapter ...
adapter.close();

Details

  • WAL mode is enabled by default for better concurrent read/write performance.
  • Table and indexes are created automatically on first use (CREATE TABLE IF NOT EXISTS).
  • Date fields are stored as ISO-8601 text strings.
  • All methods are async (to satisfy the SignalQueueAdapter interface) but use synchronous better-sqlite3 under the hood.