env-management

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Environment Variable Management

环境变量管理

Complete environment variable management with type-safe validation, Vercel dev workflow, and prebuild validation.
具备类型安全验证、Vercel开发工作流和预构建验证的完整环境变量管理方案。

Cookbook - Complete These Recipes in Order

操作指南 - 按顺序完成以下步骤

Type-Safe Environment Configuration

类型安全的环境配置

Type-safe environment variable validation using Zod with a Drizzle-like schema API. Supports server/public fields, feature flags, either-or constraints, and client-side protection.
bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/config-schema-setup
使用Zod配合类Drizzle的Schema API实现类型安全的环境变量验证。支持服务端/公开字段、功能标志、二选一约束以及客户端保护。
bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/config-schema-setup

Environment Variable Management with Vercel

基于Vercel的环境变量管理

Manage environment variables across Vercel environments. Sync with Vercel CLI, handle local overrides, and load env vars in scripts.
bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/env-workflow-vercel
在Vercel多环境中管理环境变量。与Vercel CLI同步,处理本地覆盖,并在脚本中加载环境变量。
bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/env-workflow-vercel

Build-Time Environment Variable Validation

构建时环境变量验证

Validate environment variables on server start and before builds. Catch missing or invalid variables early with clear error messages.
bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/env-validation
在服务端启动时和构建前验证环境变量。通过清晰的错误信息提前捕获缺失或无效的变量。
bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/env-validation