π Secure & validate your .env files with encryption, schema validation, and CLI tools.
Think of it as dotenv on steroids β with guardrails for production-ready apps.
This is a monorepo containing:
- @ibnushahraa/dotenv-guard - Core library with encryption, validation, and multi-env support
- @ibnushahraa/vite-plugin-dotenv-guard - Vite plugin for seamless integration
- @ibnushahraa/nuxt-dotenv-guard - Nuxt 3 module with auto mode detection
- AES-256-GCM Encryption with authenticated encryption
- Zero-config master key generation (no native dependencies!)
- Selective encryption - choose what to encrypt via
env.enc.json - Built-in migration tools from legacy formats
- Schema validation with regex, enums, and required fields
- Multi-framework support (Node.js, Vite, Nuxt)
- Auto mode detection (development/production)
- Cross-platform - works on Windows/macOS/Linux/Docker
- CLI tools for quick setup and management
- Drop-in replacement for dotenv (no breaking changes)
- TypeScript definitions included
- 109 tests across all packages
npm install @ibnushahraa/dotenv-guardimport { config } from "@ibnushahraa/dotenv-guard";
config({ validator: true });npm install @ibnushahraa/vite-plugin-dotenv-guard// vite.config.js
import dotenvGuard from '@ibnushabraa/vite-plugin-dotenv-guard';
export default defineConfig({
plugins: [dotenvGuard({ validator: true })]
});β Full Vite Plugin Documentation
npm install @ibnushahraa/nuxt-dotenv-guard// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@ibnushahraa/nuxt-dotenv-guard'],
dotenvGuard: {
validator: true
}
});β Full Nuxt Module Documentation
| Feature | dotenv | dotenv-guard |
|---|---|---|
| Load .env files | β | β |
| Encryption | β | β AES-256-GCM |
| Zero native deps | β | β Built-in crypto |
| Selective encryption | β | β Config-based |
| Schema validation | β | β Regex + Enum |
| Multi-environment | β | β Auto-load |
| CLI tools | β | β Full-featured |
| Vite plugin | β | β First-class |
| Nuxt module | β | β Auto mode detection |
| Cross-platform | β | β No build required |
Not a replacement for dotenv β a secure extension for production apps.
This is a monorepo managed with npm workspaces.
# Install dependencies
npm install
# Run all tests
npm test
# Test specific package
npm run test:core
npm run test:vite-plugin
npm run test:nuxt-module- Core Package - Full API reference and usage examples
- Vite Plugin - Vite-specific integration guide
- Nuxt Module - Nuxt 3 module integration guide
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Ways to contribute:
- Report bugs and suggest features
- Submit pull requests
- Improve documentation
- Develop plugins for other frameworks
MIT Β© 2025