Skip to content
PluginStats

@pixelmatters/validate-env weekly downloads statistics

By pixelmatters (2 listings) · npm · Webpack plugins

Validate environment variables against a Standard Schema when Vite, webpack, Rspack, Rsbuild or Next.js starts

View on npm Fresh · Dec 6, 2026

@pixelmatters/validate-env has 257 recorded weekly downloads on npm, a change of -57.6% over the past 7 days, ranking #2423 of 3,247 tracked listings.

Weekly downloads
257
Official API · Dec 5, 2026
7-day growth
-57.6%
-349 weekly downloads
30-day growth
—
Insufficient history
90-day growth
—
Insufficient history
Rank
#2423
▼ 313 in 7 days

About @pixelmatters/validate-env

@pixelmatters/validate-env

npm license

Validate environment variables against a Standard Schema such as Zod, Valibot, or ArkType before your dev server or build starts. Use it in Vite, webpack, Rspack, Rsbuild, Next.js, or Node scripts to stop startup on missing or invalid values.

Highlights

  • Fail before startup. Missing or invalid variables print one line each and exit with code 1, before your build or dev server starts.
  • Bring your own schema. Any validator that implements Standard Schema works, such as Zod, Valibot or ArkType, synchronous or async.
  • Fits each bundler. Each bundler's subpath checks what that bundler loads, from Vite to Next.js, without adding a bundler dependency.
  • Run without a bundler. Import the package root in any Node script to validate a record, filter it by prefix and format the issues.

Install

pnpm add -D @pixelmatters/validate-env

Install a Standard Schema library such as zod if your project does not have one yet. All bundler peer dependencies are optional, so you only need the bundler your project uses. See Requirements for supported versions and CommonJS setup.

Quick start

// vite.config.ts
import { defineConfig } from 'vite'
import * as z from 'zod'

import { validateEnv } from '@pixelmatters/validate-env/vite'

const envSchema = z.object({
  VITE_API_URL: z.url(),
})

export default defineConfig({
  plugins: [validateEnv(envSchema)],
})

When Vite resolves your config, the plugin validates the VITE_ variables loaded from your .env* files and process environment. If any variable is missing or invalid, it prints one line per issue and exits with code 1.

========================================
❌ Environment variables issues:
    VITE_API_URL: Invalid input: expected string, received undefined
========================================

Write your schema

import * as z from 'zod'

const envSchema = z.object({
  VITE_API_URL: z.url(),
  VITE_TIMEOUT_MS: z.coerce.number().int().positive(),
  VITE_ENABLE_ANALYTICS: z.enum(['true', 'false']),
})

Standard Schema is a shared interface supported by Zod, Valibot, ArkType, and other validation libraries. Match your schema keys to the prefix your bundler entry checks. Use VITE_ for Vite, PUBLIC_ for Rsbuild, NEXT_PUBLIC_ for Next.js, or your chosen envPrefix for webpack and Rspack.

Every variable arrives as a string, so parse numbers and booleans from strings as shown above. Validation only checks values and does not change what your application reads at runtime.

Schemas can validate synchronously or asynchronously. If a schema throws or rejects, the validator logs the error message and throws Invalid environment variables with the original error as cause. Issues with no path print under root.

Configure your bundler

Each bundler has its own subpath export. Choose the one your project uses.

Vite
// vite.config.ts
import { defineConfig } from 'vite'
import * as z from 'zod'

import { validateEnv } from '@pixelmatters/validate-env/vite'

const envSchema = z.object({
  VITE_API_URL: z.url(),
})

export default defineConfig({
  plugins: [validateEnv(envSchema)],
})

The plugin runs in Vite's configResolved hook and validates what Vite's loadEnv returns for the current mode. It reads .env* files from envDir and the process environment, filtered by envPrefix (VITE_ by default). Changes other plugins make to root, envDir, or envPrefix are already applied.

Moving from @pixelmatters/vite-plugin-validate-env only requires changing the dependency and import path to @pixelmatters/validate-env/vite. The plugin, its name, and its output stay the same.

webpack and Rspack
// webpack.config.mjs (use '@pixelmatters/validate-env/rspack' in rspack.config.mjs)
import * as z from 'zod'

import { validateEnv } from '@pixelmatters/validate-env/webpack'

const envSchema = z.object({
  PUBLIC_API_URL: z.url(),
})

export default {
  plugins: [validateEnv(envSchema, { envPrefix: 'PUBLIC_' })],
}

validateEnv(schema, options) returns a ValidateEnvPlugin, which you can also create with new ValidateEnvPlugin(schema, options). It validates process.env once per compiler before the first run or watchRun hook. That covers builds, --watch, and dev servers.

Neither bundler reads .env files on its own. Load them first with node --env-file=.env or dotenv. Without envPrefix, the plugin validates all of process.env.

Rsbuild
// rsbuild.config.ts
import { defineConfig } from '@rsbuild/core'
import * as z from 'zod'

import { validateEnv } from '@pixelmatters/validate-env/rsbuild'

const envSchema = z.object({
  PUBLIC_API_URL: z.url(),
})

export default defineConfig({
  plugins: [validateEnv(envSchema)],
})

The plugin runs in modifyRsbuildConfig after other plugins and validates every import.meta.env.* entry in source.define. That includes public variables Rsbuild loaded from .env* files and process.env for your --env-mode and --env-dir. It also covers values added by other plugins or source.define.

This validates the exact values your bundle receives. A build that disables env loading, such as --no-env or createRsbuild() without loadEnv, injects no variables and fails any required key. Pass envPrefix to narrow validation to matching names.

Next.js
// next.config.ts
import type { NextConfig } from 'next'
import * as z from 'zod'

import { withValidateEnv } from '@pixelmatters/validate-env/next'

const envSchema = z.object({
  NEXT_PUBLIC_API_URL: z.url(),
})

const nextConfig: NextConfig = {}…

Description from the npm listing.

  • environment
  • nextjs
  • pixelmatters
  • rsbuild
  • rsbuild-plugin
  • rspack
  • rspack-plugin
  • schema
  • standard
  • tanstack-intent
  • validate
  • variables
  • vite
  • vite-plugin
  • webpack
  • webpack-plugin

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

@pixelmatters/validate-env weekly downloads on npm, last 90 days: 257 weekly downloads as of Dec 5, 2026.@pixelmatters/validate-envWeekly downloads on npm · Last 90 days257downloads / week0100200300400500600700Sep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
@pixelmatters/validate-env weekly downloads on npm, last 90 days: 257 weekly downloads as of Dec 5, 2026.

7/30/90-day growth

@pixelmatters/validate-env weekly downloads growth on npm: -57.6% over 7 days, 30-day growth unavailable, 90-day growth unavailable.@pixelmatters/validate-envWeekly downloads growth on npm257downloads / week now7-day growth-349 weekly downloads-57.6%30-day growth+257 weekly downloadsInsufficient history90-day growth+257 weekly downloadsInsufficient historyGrowth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
@pixelmatters/validate-env weekly downloads growth on npm: -57.6% over 7 days, 30-day growth unavailable, 90-day growth unavailable.

Ranking history

@pixelmatters/validate-env npm ranking history: currently #2423 (by weekly downloads).@pixelmatters/validate-envnpm ranking · by weekly downloads · Last 90 days#2423current rank#1600#1800#2000#2200#2400#2600Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankNov 24, 2026 – Dec 6, 2026 · 13 observations · Updated Dec 5, 2026pluginstats.com
@pixelmatters/validate-env npm ranking history: currently #2423 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,084 shown · page 122, #3 (overall #2,423)
All npm: every listing in weekly downloads order

Listing placement

Webpack plugins349 listings · 18 pages · page 7, #7 (overall #127)
Webpack plugins: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (128)
Recent weekly downloads observations for @pixelmatters/validate-env
Date (UTC)Weekly downloadsChange vs. previous
257+1
256-170
426-9
435+10
425-85
510-102
612+6
606+10
596+164
432+38
394+35
359+49
310-230
540—

Similar npm Webpack plugins plugins

All 20 @pixelmatters/validate-env alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/@pixelmatters/validate-env. First seen Nov 24, 2026; last successful collection Dec 6, 2026. See the methodology.