better-envpar neondatabase

Better environment variable management for agents and humans with full type safety, CLI-based remote environment synchronization, and environment validation.…

npx skills add https://github.com/neondatabase/better-env --skill better-env

Work With better-env In A Repo

Type-safe environment config modules

Follow this best practice to manage environment variables in TypeScript applications with full type safety and clear server/public boundaries.

better-env exports configSchema to define typed env modules and recommends placing them in feature-level config.ts files (for example src/lib/auth/config.ts and src/lib/database/config.ts).

Learn more:

  • references/config-schema.md

Validate existence of all env variables in the current environment

Run env validation early so missing or invalid values fail fast before dev, build, or deploy steps.

better-env validate --environment <name> loads .env* files with Next.js semantics, discovers src/lib/*/config.ts modules, and checks every declared variable from your configSchema modules.

If your dotenv files intentionally include keys that are not referenced by config modules, add per-env suppressions in better-env.ts:

environments.<env>.ignoreUnused: string[]

These suppress only the selected local environment during validate. Adapter defaults are merged in automatically; for Vercel, VERCEL_OIDC_TOKEN is ignored by default in development, preview, and production.

Learn more:

  • references/env-validation.md

Configure runtime syncing between local files and hosted providers

Use runtime configuration to keep local dotenv targets aligned with provider environments while preserving safe defaults.

Create better-env.ts with defineBetterEnv(...) and an adapter (vercelAdapter, netlifyAdapter, railwayAdapter, or cloudflareAdapter), then define environment mappings, env-file targets, and gitignore behavior.

Learn more:

  • references/config.md
  • references/runtime.md

Use the CLI for day-to-day environment operations

The CLI gives a consistent workflow for initialization, sync, validation, and remote variable management, which is great for local development and CI automation.

Choose the command runner to match the repo:

  • Use npx in npm/pnpm-based repos (for example lockfiles like package-lock.json or pnpm-lock.yaml and scripts run via npm/pnpm).
  • Use bunx in Bun-based repos (for example bun.lock and scripts run via bun).
  • Keep commands aligned with the project's existing package manager/runtime conventions; do not mix runners unless the repo already does.

Recommended flow in a repo:

  1. Run better-env init once to verify adapter prerequisites.
  2. Run better-env pull --environment <name> to sync local env files.
  3. Run better-env validate --environment <name> before app startup/build.
  4. Use add, upsert, update, delete, and load for remote env changes.

Choose command behavior intentionally:

  • upsert for idempotent automation and scripts
  • add when duplicate keys should fail
  • update when missing keys should fail
  • delete to remove remote keys
  • load for batch updates from dotenv files

Learn more:

  • references/cli.md
  • references/vercel-adapter.md

Plus de skills de neondatabase

claimable-postgres
by neondatabase
Instant Postgres databases for local development, demos, prototyping, and test environments. No account required. Databases expire after 72 hours unless claimed to a Neon account.
neon-postgres-branches
by neondatabase
The outcome of this skill should be a created Neon branch (or a clear, actionable next step if creation cannot proceed). Choose the correct branch type, then execute branch creation via MCP or CLI.
neon-postgres-egress-optimizer
by neondatabase
Guide the user through diagnosing and fixing application-side query patterns that cause excessive data transfer (egress) from their Postgres database. Most high egress bills come from the application fetching more data than it uses.
plugin-manager
by neondatabase
Manage plugin structure and configuration for this repository across both Cursor and Claude Code. Use when creating, updating, or reviewing plugin folders…
skill-creator
by neondatabase
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's…
add-neon-docs
by neondatabase
Use this skill when the user asks to add documentation, add docs, add references, or install documentation about Neon. Adds Neon best practices reference links…
neon-auth
by neondatabase
Sets up Neon Auth for your application. Configures authentication, creates auth routes, and generates UI components. Use when adding authentication to Next.js,…
neon-drizzle
by neondatabase
Creates a fully functional Drizzle ORM setup with a provisioned Neon database. Installs dependencies, provisions database credentials, configures connections,…

NotebookLM Web Importer

Importez des pages web et des vidéos YouTube dans NotebookLM en un clic. Utilisé par plus de 200 000 utilisateurs.

Installer l'extension Chrome