0.0.2 • Published 2 years ago

nuxt3-zod-env v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Simple nuxt3 zod env validation module

Simple and user-friendly environment variable validation package for Nuxt 3 projects, leveraging the power of the Zod schema validation library.

Features

  •  Required variables validation
  • 🌍 Support for multiple environments
  • 💡 Environment variable auto-completion
  • 🔄 Default value assignment

Quick Setup

  1. Add nuxt3-zod-env dependency to your project
# Using pnpm
pnpm add -D nuxt3-zod-env

# Using yarn
yarn add --dev nuxt3-zod-env

# Using npm
npm install --save-dev nuxt3-zod-env
  1. Add nuxt3-zod-env to the modules section of nuxt.config.ts
import { zod } from 'nuxt3-zod-env'
export default defineNuxtConfig({
  modules: [
    'nuxt3-zod-env'
  ],
  nuxt3ZodEnv: {
    //example
    schema: {
      evelopment: {
        DEVELOPMENT_API_URL: zod.string().url(),
        NODE_ENV: zod.literal('development')
      }
    }
  }
})

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

# Release new version
npm run release
0.0.2

2 years ago

0.0.1

2 years ago