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

@kilog/nextjs-plugin

v1.3.1

Published

Next.js plugin for kilog structured logging

Downloads

438

Readme

@kilog/nextjs-plugin

Next.js plugin for kilog. Captures console, fetch, and uncaught errors from both the browser and the Node server runtime — with one next.config.ts edit and nothing else.

Install

pnpm add -D @kilog/nextjs-plugin

Requires Next.js 15.3 or newer.

Usage

// next.config.ts
import { withKilog } from "@kilog/nextjs-plugin";

export default withKilog({
  // your existing Next config
});

Run next dev. That's it. The plugin:

  • Generates instrumentation.ts and instrumentation-client.ts at the project root (gitignored).
  • Starts a localhost HTTP receiver on a random port.
  • Adds a /__kilog rewrite so the browser script reaches the receiver.

next build and next start are no-ops — instrumentation is dev-only.

Options

withKilog(nextConfig, { terminal: true }); // mirror events to stdout (colored)
withKilog(nextConfig, { terminal: "warn" }); // only warn/error
withKilog(nextConfig, { persist: true }); // keep logs across dev restarts

| Option | Type | Default | Description | | ---------- | --------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------- | | terminal | boolean \| "debug" \| "info" \| "warn" \| "error" | false | Also print captured events to stdout. true = all; a level threshold filters events that have a level. | | persist | boolean | false | Keep previously captured logs across dev server restarts. Default wipes .kilog/raw/*.jsonl and .kilog/index/. |

How it works

Both bundlers (Webpack and Turbopack) discover Next 15.3+'s instrumentation.ts and instrumentation-client.ts from the filesystem. By materializing those files for you on next dev, the plugin captures both runtimes without asking you to edit app/layout.tsx, _document.tsx, or write your own instrumentation hook.

Generated files carry a marker comment so re-running next dev is idempotent. If you already authored instrumentation.ts (or its client counterpart), the plugin warns and bails on that file — add the one-line import yourself:

// instrumentation.ts
import { registerServer } from "@kilog/nextjs-plugin/register-server";

export async function register() {
  await registerServer();
}
// instrumentation-client.ts
import "@kilog/nextjs-plugin/register-client";

The receiver runs in-process with next dev and is bound to 127.0.0.1 only.

View logs

npx kilog logs              # print logs across every .kilog/ under cwd
npx kilog logs -f           # follow live
npx kilog logs --since 10m | rg TypeError
npx kilog ui                # browser UI

Environment variables

| Var | Default | Description | | --------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------- | | KILOG_DIR | process.cwd() | Base directory that holds .kilog/. | | KILOG_PERSIST | unset | Set to 1 to keep previous logs across restarts. Default wipes .kilog/raw/*.jsonl + .kilog/index/ on each process start. |