0.0.2 • Published 2 years ago
nuxt3-zod-env v0.0.2
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
- 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
- Add
nuxt3-zod-env
to themodules
section ofnuxt.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