Skip to content

Output Formats

Hush can output secrets in multiple formats to match what each package in your monorepo expects.

Available Formats

FormatOutput FileUse Case
dotenv.env.development / .env.productionNext.js, Vite, Expo, Remix, Node.js, etc.
wrangler.dev.varsCloudflare Workers & Pages
json.env.development.jsonAWS Lambda, serverless, JSON configs
shell.env.development.shCI/CD pipelines, Docker builds
yaml.env.development.yamlKubernetes ConfigMaps, Docker Compose

dotenv

Standard .env file format. The most common choice for Node.js applications.

Configuration

targets:
- name: app
path: ./packages/app
format: dotenv

Output

File: .env.development

Terminal window
DATABASE_URL=postgres://localhost/mydb
API_KEY=sk_test_xxx
DEBUG=true

Compatibility

Works with every major framework:

FrameworkClient Prefix
Next.jsNEXT_PUBLIC_*
ViteVITE_*
Create React AppREACT_APP_*
Vue CLIVUE_APP_*
NuxtNUXT_PUBLIC_*
AstroPUBLIC_*
SvelteKitPUBLIC_*
ExpoEXPO_PUBLIC_*
GatsbyGATSBY_*
Remix(server-only)
Node.js(any)

wrangler

Cloudflare Wrangler format for Workers development.

Configuration

targets:
- name: api
path: ./packages/api
format: wrangler

Output

File: .dev.vars

Terminal window
DATABASE_URL=postgres://localhost/mydb
STRIPE_SECRET_KEY=sk_test_xxx
JWT_SECRET=super-secret-key

Usage with Wrangler

Terminal window
# Local development reads from .dev.vars automatically
wrangler dev
# Production uses secrets set via wrangler secret
hush push # Pushes secrets to Cloudflare

Push to Production

Hush can push secrets to Cloudflare Workers:

Terminal window
# Preview what would be pushed
hush push --dry-run
# Push production secrets
hush push

This runs wrangler secret put for each variable.

json

JSON object format for applications that consume JSON configuration.

Configuration

targets:
- name: shared
path: ./packages/shared
format: json

Output

File: .env.development.json

{
"DATABASE_URL": "postgres://localhost/mydb",
"API_KEY": "sk_test_xxx",
"DEBUG": "true"
}

Use Cases

  • Configuration files that need JSON
  • Tools that read JSON config
  • API responses or fixtures
  • Type-safe config loading

shell

Sourceable shell script with export statements.

Configuration

targets:
- name: scripts
path: ./scripts
format: shell

Output

File: .env.development.sh

#!/bin/sh
export DATABASE_URL="postgres://localhost/mydb"
export API_KEY="sk_test_xxx"
export DEBUG="true"

Usage

Terminal window
# Source the file to set environment variables
source .env.development.sh
# Or in a script
#!/bin/bash
source ./scripts/.env.production.sh
./deploy.sh

Use Cases

  • CI/CD pipelines
  • Shell scripts
  • Docker build arguments
  • Makefile targets

yaml

YAML format for Kubernetes ConfigMaps, Docker Compose, and other YAML-based configuration.

Configuration

targets:
- name: k8s
path: ./k8s
format: yaml

Output

File: .env.development.yaml

DATABASE_URL: "postgres://localhost/mydb"
API_KEY: "sk_test_xxx"
DEBUG: "true"
REDIS_URL: "redis://localhost:6379"

Use Cases

  • Kubernetes ConfigMaps and Secrets
  • Docker Compose environment files
  • Helm chart values
  • Any YAML-based configuration

Creating a Kubernetes ConfigMap

Terminal window
# Generate the YAML
hush decrypt -e production
# Create ConfigMap from the generated file
kubectl create configmap my-app-config --from-file=k8s/.env.production.yaml
# Or use the file directly in your manifests

Docker Compose Integration

docker-compose.yml
services:
app:
env_file:
- ./config/.env.development.yaml

Choosing a Format

Your StackRecommended Format
Next.js, Vite, CRA, Vue, Nuxtdotenv
Astro, SvelteKit, Remixdotenv
Expo / React Nativedotenv
Gatsbydotenv
Cloudflare Workers & Pageswrangler
AWS Lambda, serverlessjson
Kubernetes, Docker Composeyaml
CI/CD pipelines, shell scriptsshell
Node.js / general backenddotenv

Multiple Formats

You can use different formats for different targets:

targets:
# Next.js app uses dotenv
- name: web
path: ./apps/web
format: dotenv
include:
- NEXT_PUBLIC_*
# Cloudflare Worker uses wrangler
- name: api
path: ./apps/api
format: wrangler
exclude:
- NEXT_PUBLIC_*
# Lambda functions use JSON
- name: lambda
path: ./packages/lambda
format: json
# Kubernetes uses YAML
- name: k8s
path: ./k8s
format: yaml
exclude:
- NEXT_PUBLIC_*
# CI scripts use shell
- name: ci
path: ./scripts
format: shell