Socket
Book a DemoInstallSign in
Socket

nuxt-required-env

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-required-env

Ensure that all required environment variables exist.

1.0.8
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

nuxt-required-env

npm version npm downloads License Nuxt

Ensure that all required environment variables exist.

Features

  • ✅ Define required environment variables
  • 🔒 Fails fast in dev or build if any are missing
  • ⚙️ Checks both .env and runtimeConfig
  • 🛠 Improves deployment safety and DX

Quick Setup

Install the module to your Nuxt application with one command:

npx nuxi module add nuxt-required-env

Create a file called env-schema.ts in your project root:

import { z } from 'zod'

export const EnvSchema = z.object({
  NUXT_PUBLIC_SITE_URL: z.string().url(),
  STRIPE_KEY: z.string(),
  SUPABASE_URL: z.string().url(),
  MY_SECRET: z.string().min(10),
})

If your schema is in a different path, set it via module options:

export default defineNuxtConfig({
  modules: ['nuxt-required-env'],
  requiredEnv: {
    schemaPath: 'config/env-schema', // path relative to project root, without extension
  },
})

That's it! You can now use nuxt-required-envin your Nuxt app ✨

Contribution

Local development
# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release

FAQs

Package last updated on 27 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.