Home / Guides / Are VITE_ and NEXT_PUBLIC_ env variables public? Yes.

Are VITE_ and NEXT_PUBLIC_ env variables public? Yes.

Any env var prefixed VITE_, NEXT_PUBLIC_, or REACT_APP_ is compiled into your JavaScript bundle. What belongs there and what doesn't.

Check your live site

Run the free ShipLatch scan on your own site without leaving this page.

Uses 1 of your 3 free scans today; a site scanned in the last 24 hours answers from that scan. Passive and read-only: we only look at what any browser can see. Only check sites you own or may test.

What the free scan checks

  • Leaked keys in your live JavaScript (AI, payment and cloud keys), including a Supabase service_role key
  • Files that should never be public, like /.env and /.git
  • Supabase and Firebase secrets in the browser: an sb_secret_ key, a Supabase access token or a Firebase service-account file
  • HTTPS and security headers (CSP, HSTS, clickjacking protection)

It only reads what any visitor's browser can see. It doesn't log in, read your tables or check App Check.

Short answer: yes. Build tools replace import.meta.env.VITE_* (Vite), process.env.NEXT_PUBLIC_* (Next.js) and process.env.REACT_APP_* (Create React App) with their literal values at build time. The value ends up in the JS file every visitor downloads. The prefix exists precisely to mark a variable as safe to expose.

Fine to expose

Never prefix these

How to check your live site

Open DevTools → Sources (or Network → JS files) and search for sk-, sk_live, service_role, postgres://. Anything found is public already: move the call to a server route or edge function, then rotate the key. Removing it from the code does not un-leak it.

Copy-paste into your AI builder
List every environment variable this app reads. For each one with a VITE_, NEXT_PUBLIC_ or REACT_APP_ prefix, tell me whether it is safe to be public. Move any secret ones into a server route or edge function, call that from the frontend instead, and tell me which keys I must rotate.

Related: Hide API keys · Leaked OpenAI key

Scan your app free

Paste your URL. ShipLatch checks for leaked keys, exposed /.env and /.git, and flags Supabase/Firebase so you know what to lock down. The free scan finds the issues; the $29 Fix Pack gives you fix prompts written for your app and re-scans that prove each fix worked.

Scan free at shiplatch.com → See the Fix Pack · $9 playbook

Update (Oct 2026): EXPO_PUBLIC_ works the same way, and ShipLatch now flags secret-looking values in any public env var. Read the update →

Want the whole pre-launch process in one place? See what's inside App Security for Vibe Coders, our $9 PDF playbook, or go straight to checkout.

More guides