Why this matters
Protects credentials and prevents leaks in the client bundle.
Read secrets (process.env.*) only in Server Components, Route Handlers, or server actions. Client Components must use ONLY NEXT_PUBLIC_* variables.
Protects credentials and prevents leaks in the client bundle.
Side-by-side examples engineers can pattern-match during review.
'use client'
console.log(process.env.STRIPE_SECRET_KEY)export async function GET(){ const key = process.env.STRIPE_SECRET_KEY; return NextResponse.json({ configured: !!key }) }process.env.DB_URL inside a Client Componentprocess.env.DB_URL inside a Route HandlerFrom the same buckets as this rule.