crumpled paper texture

Redenv

A developer-first, zero-knowledge secret management system for the serverless era. Encrypt client-side, centralize in Upstash Redis, and break free from the 'rebuild to rotate' cycle.

TypescriptRedisNodejsPython

Security

1,381 views

RepositoryLive Site

Configuration management in modern software engineering is broken in two distinct ways:

  1. The Traditional Nightmare (Local .env Chaos): As soon as a team grows beyond one person, local .env files drift apart. Developers waste hours debugging phantom bugs caused by outdated API keys, or worse, copy-paste production credentials into Slack and Discord DMs.
  2. The Modern Nightmare (The "Rebuild to Rotate" Cycle): On serverless and edge platforms like Vercel and Netlify, environment variables are treated as immutable, build-time constants. When an API key leaks on a Friday night, rotating it requires editing a cloud dashboard, triggering a full 4-minute production build, and praying unrelated test suites don't fail.

Configuration is dynamic. Code is static. Forcing an entire build pipeline just to rotate a credentials string is a fundamental architectural failure.

Redenv re-imagines how applications handle secrets. It is a CLI-first, end-to-end encrypted secret management system that centralizes your variables in an Upstash Redis database you control. All encryption happens client-side. Your apps fetch and decrypt secrets at runtime in under 2 milliseconds - zero redeployments required.

Redenv Cover


Core Architectural Pillars

Redenv is built on four core engineering invariants:

Zero-Knowledge Architecture

Secrets are encrypted client-side using AES-256-GCM and PBKDF2-HMAC-SHA256 with 310,000 iterations. The database is treated as hostile; plaintext never touches Redis.

Built for Upstash Redis

Runs over standard HTTP REST without TCP connection bottlenecks. Blazing sub-millisecond cold starts and serverless pricing tailored for CLI and edge runtimes.

Decoupled Runtime SDK

Lightweight client with built-in Stale-While-Revalidate (SWR) in-memory caching. Rotate secrets in production with zero downtime and zero redeploys.

Immutable Version History

Every write operation is versioned and written atomically via Lua scripts. Revert a bad secret configuration in 2 seconds directly from your terminal.


How Redenv Compares

FeatureRedenvTraditional .envAWS / GCP Secret ManagerHashiCorp Vault
Security Model Zero-Knowledge (E2EE) Plaintext on disk Server-side cloud KMS Server-side encryption
Hosting Model Your Own Upstash Redis Local machines Vendor locked-in cloud Heavy self-hosted cluster
Setup Time Under 60 seconds Instant (manual) Complex IAM roles Days of DevOps infra
Dynamic Updates Yes (Sub-second via SDK) Requires file copy & restart Yes (Heavy cloud SDK) Yes (API polling)
Cost Free / Serverless tier Free Per-secret / per-API fees High compute & ops overhead

The Zero-Knowledge Cryptographic Flow

Redenv isolates every project into its own cryptographic boundary:

Project Encryption Key (PEK)

During redenv register, an isolated 256-bit symmetric Project Encryption Key (PEK) is generated locally via the Web Crypto API.

Master Password Wrapping

Your Master Password never leaves your machine. It is derived using PBKDF2-HMAC-SHA256 with 310,000 iterations (following OWASP recommendations) with a unique cryptographic salt to produce a Key-Encrypting Key (KEK) that wraps the PEK.

Encrypted Storage in Upstash

Redis stores only the wrapped PEK, salt, and ciphertext values under project-scoped hashes (meta@<project> and <env>:<project>). Even if the database is seized or dumped, attackers possess only uncrackable encrypted noise.

Scoped Service Tokens

Production apps and CI/CD pipelines use scoped Service Tokens (Public ID + Secret Key) to decrypt the PEK locally in runtime memory - allowing least-privilege team access without sharing the root Master Password.

Atomic Writes via Lua: To guarantee zero race conditions when multiple developers or CI/CD pipelines sync secrets simultaneously, Redenv executes write and rollback operations through atomic Redis Lua scripts.


The Workflows Developers Actually Use

Everything you need to manage credentials directly in your terminal:

# 1. Connect Upstash credentials and register vault
redenv setup
redenv register my-app

# 2. Add or update secrets with instant AES-256-GCM encryption
redenv add STRIPE_SECRET_KEY "sk_live_51P..."
redenv add DATABASE_URL "postgres://user:pass@host/db"

# 3. View decrypted values locally
redenv view STRIPE_SECRET_KEY

# 4. Promote verified secrets from staging to production
redenv promote --from staging --to production

# 5. Inspect version history and execute a 2-second rollback
redenv history --env production
redenv rollback v2 --env production

Consume secrets dynamically inside Next.js, Node.js, Bun, or Deno apps with zero latency overhead:

src/lib/redenv.ts
import { Redenv } from "@redenv/client";

export const redenv = new Redenv({
  project: "my-app",
  environment: process.env.NODE_ENV || "production",
  tokenId: process.env.REDENV_TOKEN_ID,
  token: process.env.REDENV_TOKEN_KEY,
  upstash: {
    url: process.env.UPSTASH_REDIS_REST_URL!,
    token: process.env.UPSTASH_REDIS_REST_TOKEN!,
  },
  // In-memory cache with background stale-while-revalidate
  cache: {
    ttl: 60_000,
    staleWhileRevalidate: true,
  },
});

// Sub-millisecond runtime access
const env = await redenv.load();
export const DB_URL = env.DATABASE_URL;

Avoid repeating database hosts, ports, and base URLs across multiple keys. Redenv features built-in variable reference expansion:

redenv add DB_HOST "aws.postgres.internal"
redenv add DB_PORT "5432"
redenv add DATABASE_URL "postgres://admin:pass@\${DB_HOST}:\${DB_PORT}/prod"
  • Dynamic Resolution: Expanding ${DB_HOST} happens automatically when loaded by the CLI or runtime SDK.
  • Circular Dependency Guard: The expansion engine detects circular references and safely escapes literals with \${.

Prefer a visual dashboard? Redenv includes an extensible plugin system. The @redenv/studio plugin brings a visual local web dashboard:

# Install the studio plugin
bun add -D @redenv/studio

# Launch local GUI
redenv studio

Opens a localhost dashboard where you can visually edit secrets across environments, inspect audit logs, and manage service tokens - while retaining full zero-knowledge local encryption.


The Monorepo Ecosystem

Redenv is architected as an extensible monorepo with dedicated workspace packages:

  • @redenv/core: Universal cryptographic engine, secret reference expansion, and Lua script generators.
  • @redenv/cli: Complete terminal command suite built with Commander and interactive prompts.
  • @redenv/client: Ultra-lightweight runtime SDK for serverless and Node.js environments.
  • @redenv/studio: Local web dashboard plugin for visual multi-environment auditing.
  • @redenv/python-client: First-class Python runtime support for AI/ML and Django/FastAPI workloads.

Why Redenv Matters

Most developers know their secret-sharing habits are unsafe, but they stick with them because enterprise vaults are painfully complex and .env files are effortless.

Redenv bridges that chasm: the cryptographic security of an air-gapped vault, paired with the speed and joy of a modern developer CLI. No more "rebuild to rotate." No more plaintext Slack keys. Just seamless, zero-knowledge configuration from local dev to production.


Explore the open-source repository on GitHub.