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

@confkit/next

v1.0.0

Published

[![npm](https://img.shields.io/npm/v/%40confkit%2Fnext)](https://www.npmjs.com/package/@confkit/next) [![license](https://img.shields.io/badge/license-MIT-blue)](https://github.com/alexdotpink/confkit/blob/main/LICENSE) ![node](https://img.shields.io/badg

Downloads

12

Readme

@confkit/next

npm license node

Next.js helpers and dev overlay integration for Confkit.

Install:

pnpm add @confkit/next

Inject client env

// next.config.mjs
import { withConfkit } from '@confkit/next';
export default await withConfkit({});

Or with the core loader:

import { loadConfig } from 'confkit/load';
const { clientEnv } = await loadConfig({ file: './conf/config.ts' });
export default { env: clientEnv };
  • Helpers

  • withConfkit(nextConfig, { file?, typesOutFile? }) – merges env with clientEnv, enables import 'confkit:client', and auto‑generates confkit-env.d.ts for typed client env (set typesOutFile: false to disable)

  • withConfkitDevOverlay(nextConfig, { file? }) – injects loader + runtime to surface validation in Next dev overlay

  • envFromConfkit({ file? }) – returns clientEnv

  • middlewareEnsureConfkit({ file?, devOnly? }) – Next middleware that validates config and returns JSON errors in dev

  • ensureConfkitDev({ file? }) – throws an annotated error if validation fails in dev

Client env module

Preferred for Next.js (works with Turbopack and Webpack):

import env from '@confkit/next/client';
console.log(env.NEXT_PUBLIC_APP_NAME);

You can also import the Vite‑style alias (Webpack builds only):

import env from 'confkit:client';

Typing

  • Types are generated automatically when using withConfkit/defineNextConfig on next dev/next build.
  • Configure output with typesOutFile or CONFKIT_TYPES_OUT; disable with typesOutFile: false or CONFKIT_TYPES_DISABLE=1.
  • Manual alternative: npx confkit types (or --watch) to write confkit-env.d.ts.

Dev overlay diagnostics (optional)

Show validation errors in the Next overlay (Webpack dev) by applying the overlay loader to a small stub module and injecting it into the client entry during development.

// next.config.mjs
import path from 'node:path';

/** @type {import('next').NextConfig} */
const config = {
  webpack: (cfg, { dev }) => {
    if (dev) {
      cfg.module.rules.push({
        test: new RegExp(path.sep + '@confkit' + path.sep + 'next' + path.sep + 'dist' + path.sep + 'overlay' + path.sep + 'runtime\\.js$'),
        use: [{ loader: '@confkit/next/overlay/loader', options: { file: path.resolve(process.cwd(), 'conf/config.ts') } }],
      });
      const origEntry = cfg.entry;
      cfg.entry = async () => {
        const entries = await origEntry();
        const key = Object.keys(entries).find((k) => k === 'main-app' || k === 'pages/_app' || k === 'app');
        if (key) {
          const runtimeMod = '@confkit/next/overlay';
          const list = Array.isArray(entries[key]) ? entries[key] : [entries[key]];
          if (!list.includes(runtimeMod)) entries[key] = [runtimeMod, ...list];
        }
        return entries;
      };
    }
    return cfg;
  },
};

export default config;

Reference:

  • Helpers: packages/confkit-next/src/index.ts:5
  • Overlay loader: packages/confkit-next/src/overlay/loader.ts:14

Docs: docs/integrations/next.mdx in this repo.