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

statikapi

v0.6.4

Published

Build a folder of JSON endpoints from simple files, then preview them in a lightweight UI.

Downloads

8

Readme

statikapi — Static API generator (CLI)

Build a folder of JSON endpoints from simple files, then preview them in a lightweight UI.

Requires Node 18+.

Install

Use without installing (recommended):

npx statikapi --help

Or add to a project
pnpm add -D statikapi
# npm i -D statikapi
# yarn add -D statikapi

Commands

statikapi <command> [options]

Commands:
  build       Build static JSON endpoints
  dev         Watch & rebuild on changes

Global:
  -h, --help      Show help
  -v, --version   Show version

##Quick start

# 1) Create a folder with API sources

mkdir src-api
echo "export default { hello: 'world' }" > src-api/index.js

# 2) Build

npx statikapi build --pretty

# 3) Preview (opens http://127.0.0.1:8788/_ui)

npx statikapi preview

Project layout

  • src-api/: your source files (default; configurable)
  • api-out/: generated JSON, one folder per route (default)

Examples of file → route mapping:

File Route Output file src-api/index.js / api-out/index.json src-api/blog/archive.js /blog/archive api-out/blog/archive/index.json src-api/users/[id].js /users/:id dynamic (see below) src-api/docs/[...slug].js /docs/*slug catch-all (see below)

Dynamic routes

For src-api/users/[id].js, export a paths() function that returns the concrete IDs to prebuild:

// src-api/users/[id].js
export async function paths() {
return ['1', '2', '3']; // builds /users/1, /users/2, /users/3
}

export async function data({ params }) {
return { id: params.id };
}

Catch-all works similarly:

// src-api/docs/[...slug].js
export async function paths() {
return [['a', 'b'], ['guide']]; // → /docs/a/b and /docs/guide
}
export async function data({ params }) {
return { slug: params.slug, path: params.slug.join('/') };
}

Producing data

Each module can export either:

  • export async function data(ctx) { ... } → its return value is serialized, or
  • export default <value|function> → if a function, it’s called and awaited.

Returned data must be JSON-serializable (plain objects/arrays, finite numbers, no functions, etc.).

Config

You can optionally add statikapi.config.js in your project root:

export default {
srcDir: 'src-api',
outDir: 'api-out',
};

You can override via flags: --srcDir <dir>, --outDir <dir>.

Flags (per command)

build

  • --pretty (or --minify=false) — pretty-print JSON.
  • --srcDir, --outDir — override config paths.

dev

  • Rebuilds on changes, updates the preview UI via SSE.
  • --previewHost, --previewPort — where to notify the preview server.
  • --srcDir, --outDir — override config paths.
  • --host (default 127.0.0.1)
  • --port (default 8788)
  • --open — try to open the browser
  • UI source:
    • --uiDir <path> — serve a built UI from this directory
    • Otherwise, uses the embedded UI bundled with the CLI
    • If missing, proxies to a dev UI at http://127.0.0.1:5173 (override with --uiDevHost, --uiDevPort)

Examples

There are two example projects in this repo under example/:

# from repo root

pnpm -C example/basic dev
pnpm -C example/basic build

pnpm -C example/dynamic dev
pnpm -C example/dynamic build

pnpm -C example/showcase dev
pnpm -C example/showcase build

Troubleshooting

  • Dynamic routes not emitted: make sure the file exports a valid paths() function returning strings (or arrays of strings for catch-all).

License

MIT – see LICENSE