managing-secrets

Validate and secure environment variables in Next.js applications on Vercel.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/alexejluft/brudi --skill managing-secrets-alexejluft
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: managing-secrets
Source: https://github.com/alexejluft/brudi/tree/main/skills/managing-secrets
Command: npx skills add https://github.com/alexejluft/brudi --skill managing-secrets-alexejluft

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill prevents the accidental exposure of sensitive credentials like API keys and database passwords in Next.js applications, ensuring secure handling of environment variables across different deployment stages.

Core Features & Use Cases

  • Environment Variable Scoping: Differentiates between client-side and server-side variables, preventing leakage.
  • Secure Key Management: Enforces best practices for handling secrets with Vercel and Supabase.
  • Runtime Validation: Implements startup checks to ensure all required environment variables are present and correctly formatted.
  • Use Case: Securely store your Supabase service role key and database URL, making them accessible only on the server-side, while exposing only the public Supabase URL and anon key to the client.

Quick Start

Use the managing-secrets skill to ensure the Supabase service role key is not exposed to the client.

Frequently Asked Questions about managing-secrets

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent exposing Supabase secrets in a Next.js app deployed on Vercel?

To prevent exposing Supabase secrets in Next.js, avoid prefixing sensitive API keys with `NEXT_PUBLIC_` so they remain server-side only, and use runtime validation with Zod to verify required variables are present. Keep production keys out of preview environments to avoid accidental leakage.

What is the difference between client-side and server-side environment variables in Next.js?

Client-side environment variables in Next.js require the `NEXT_PUBLIC_` prefix and are exposed to the browser, while server-side variables are only accessible on the server. Scoping ensures sensitive credentials like database URLs and API keys do not leak to the client.

How do I validate environment variables at startup in a Next.js application?

Validate environment variables at startup in Next.js by implementing runtime checks with Zod. This enforces that all critical variables are present and correctly formatted before the application fully initializes, preventing runtime errors caused by missing configuration.

Why should I not commit the .env file when managing secrets in Next.js?

You should not commit the `.env` file because it leads to the accidental exposure of sensitive credentials like API keys and database passwords. Secure handling of secrets requires storing them directly in the Vercel environment configuration instead of the repository.

Can I use production Supabase keys in Vercel preview environments?

No, using production Supabase keys in Vercel preview environments is a common mistake that risks accidental exposure. Secure key management requires separate, scoped credentials for different deployment stages to isolate preview deployments from production data.