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

entrykit

v0.1.3

Published

<div align="center"> <h1>entrykit</h1> <p>Structured entrypoints for Node.js services.</p> <p>A tiny wrapper for defining service entrypoints with validated environment variables, setup/teardown lifecycle hooks, and graceful shutdown handling. Built

Readme

Installation

To install entrykit, simply use your favourite Node.js package manager.

bun add entrykit
pnpm add entrykit
yarn add entrykit
npm install entrykit

Usage

Basic Entrypoint

import { entry } from "entrykit";

entry({
  name: "my-service",
  main: () => {
    console.log("Service started.");
    return () => console.log("Shutting down.");
  },
});

The function returned from main is automatically registered as a SIGTERM and SIGINT handler for graceful shutdown.

Environment Validation

Use the re-exported type from ArkType to define and validate your environment variables at startup.

import { entry, type } from "entrykit";

entry({
  name: "api-server",
  env: type({
    DATABASE_URL: "string",
    PORT: "string",
  }),
  main: ({ env }) => {
    // env.DATABASE_URL and env.PORT are validated and typed
    console.log(`Connecting to ${env.DATABASE_URL}`);
  },
});

If any required variable is missing or fails validation, ArkType throws before main ever runs.

Setup Lifecycle

For services that need async initialization (database connections, cache warming, etc.), use the setup function. Its return value is passed to main as extras.

import { entry, type } from "entrykit";

entry({
  name: "api-server",
  env: type({
    DATABASE_URL: "string",
    PORT: "string",
  }),
  setup: async ({ env }) => {
    const db = await connectToDatabase(env.DATABASE_URL);
    return { db };
  },
  main: ({ env, extras }) => {
    // extras.db is the resolved value from setup
    startServer(extras.db, env.PORT);

    return () => extras.db.disconnect();
  },
});

API

entry(options)

Defines and immediately runs a service entrypoint. Returns Promise<MaybeCleanupFunction>.

| Option | Type | Description | |--------|------|-------------| | name | string | Service name | | env | Type | ArkType schema for process.env validation | | setup | (options: { env }) => MaybePromise<T> | Optional async setup, result passed to main as extras | | main | (options: { env, extras? }) => MaybePromise<CleanupFn> | Service entrypoint, may return a cleanup function |

If main returns a function, it is registered as a handler for both SIGTERM and SIGINT.

Re-exports

type is re-exported from arktype for convenience, so you don't need it as a direct dependency.

Contribute

Feel free to contribute to the repository. Pull requests and issues with feature requests are super welcome!