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

@envra/next

v0.1.2

Published

Next.js adapter for envra

Readme

@envra/next

Next.js adapter for envra: split server vs client env schemas, enforce NEXT_PUBLIC_ on client keys, and block secrets on the client block.

Install

pnpm add @envra/next @envra/core
# or
npm install @envra/next @envra/core

Peers: next >= 14 (optional for typing in non-Next contexts), @envra/core ^0.1.2 (install explicitly so a single copy is used — avoids duplicate FieldBuilder types in TypeScript).

Example (full server + client)

import { defineNextEnv, str, url, secret } from "@envra/next";

export const env = defineNextEnv({
  server: {
    DB_URL: secret(url()),
  },
  client: {
    NEXT_PUBLIC_APP_URL: url(),
  },
  runtimeEnv: process.env,
});

Client-only helper (defineNextPublicEnv)

Use when you only validate NEXT_PUBLIC_* keys and want a module that is safe to import from Client Components (no server secrets in that file):

import { defineNextPublicEnv, url } from "@envra/next";

export const publicEnv = defineNextPublicEnv({
  client: {
    NEXT_PUBLIC_APP_URL: url(),
  },
  runtimeEnv: process.env,
});

For secrets and server-only variables, keep a separate module with import "server-only" and defineNextEnv (or defineEnv from @envra/core).

Next.js App Router: server vs client modules

  1. Server env — e.g. lib/env.ts with import "server-only" at the top, then defineNextEnv with both server and client (or server-only schema via @envra/core).
  2. Public env — e.g. lib/env-public.ts without server-only, using defineNextPublicEnv or only the client block patterns above.
  3. Do not import the server env module from code that is bundled for the client (Client Components, or shared services/ / lib/ pulled in by them). Use publicEnv for anything that needs env inside client bundles.

pnpm / duplicate @envra/core

If TypeScript reports that FieldBuilder types are incompatible (separate declarations of a private property), you likely have two versions of @envra/core installed. Fix with a single version, for example:

{
  "pnpm": {
    "overrides": {
      "@envra/core": "0.1.2"
    }
  }
}

Re-exports

@envra/next re-exports common builders (str, int, secret, …), FieldBuilder, InferSchema, and defineEnv from @envra/core so you can use one import path in Next apps:

import { defineNextEnv, str, type InferSchema } from "@envra/next";

Documentation

github.com/hasansmadix/envra

License

MIT — see LICENSE in the monorepo.