Skip to content

Environment variables, stack by stack

How popular frameworks, runtimes and hosting platforms read environment variables: which .env files load first, which values reach the browser, when values are fixed, and where each platform keeps its own secrets.

About these pages: 20 stacksSources last checked October 30, 2026

Every page opens with the same four facts.

Frameworks

11 pages

Web frameworks load .env files themselves, and the ones that build browser code decide which names reach it.

  • TypeScript

    Astro environment variables

    Astro reads env variables through Vite at build time and through astro:env at runtime. Which values reach the browser, and how to run Astro with Crunu.

    Build and runtimePUBLIC_

  • Python

    Django environment variables

    Django reads settings from Python code, not .env files. How to load SECRET_KEY and other secrets from the environment, rotate them, and run Django with Crunu.

    At runtime

  • Python

    FastAPI environment variables

    FastAPI reads settings through pydantic-settings, where environment variables beat .env files. Types, caching, secret files and running FastAPI with Crunu.

    At runtime

  • Python

    Flask environment variables

    The flask command loads .env and .flaskenv, but production servers don't. How Flask config reads the environment, FLASK_ prefixes and running Flask with Crunu.

    At runtime

  • PHP

    Laravel environment variables

    Laravel loads .env through phpdotenv, lets real environment variables win, and stops reading .env after config:cache. APP_KEY rotation and Crunu included.

    At runtime

  • JavaScript

    Next.js environment variables

    How Next.js picks values from process.env and four .env files, when NEXT_PUBLIC_ values are frozen into the bundle, and how to run Next.js with Crunu.

    Build and runtimeNEXT_PUBLIC_

  • TypeScript

    Nuxt environment variables

    Nuxt reads .env only in dev and build, then overrides runtimeConfig from NUXT_ variables at runtime. How the mapping works and how to start Nuxt with Crunu.

    Build and runtimeNUXT_PUBLIC_

  • Ruby

    Ruby on Rails environment variables

    Rails keeps secrets in encrypted credentials opened by a master key, and lets ENV override some of them. When to use which, and how to run Rails with Crunu.

    At runtime

  • Java

    Spring Boot environment variables

    Spring Boot ranks OS environment variables above application.properties and maps them with relaxed binding. Profiles, config trees and Crunu explained.

    At runtime

  • TypeScript

    SvelteKit environment variables

    SvelteKit 3 declares env variables in src/env.ts and reads them through $app/env. Public, private, static and dynamic explained, plus the legacy $env modules.

    Build and runtime

  • JavaScript

    Vite environment variables

    How Vite loads .env files per mode, why only VITE_ variables reach client code, and how to build a Vite app with values from Crunu instead of .env files.

    At buildVITE_

Hosting platforms

5 pages

Platforms keep variables in their own dashboard and hand them to your build and your running app.

  • Any language, deployed as a Docker image

    Fly.io environment variables

    Fly.io stores secrets in an encrypted vault and injects them as environment variables at runtime, never into builds. How that works, and where crunu run fits.

    At runtime

  • JavaScript and TypeScript sites and functions

    Netlify environment variables

    Netlify variables have scopes and deploy contexts: builds, functions and runtime each see different values. What netlify.toml can't do, and where Crunu fits.

    Build and runtime

  • Any language, built by Railway or from a Dockerfile

    Railway environment variables

    Railway gives builds and deployments service, shared and reference variables, with sealed values for secrets. Staged changes, railway run and Crunu explained.

    Build and runtime

  • Any language, native runtimes or Docker

    Render environment variables

    Render sets variables per service or through environment groups, adds secret files under /etc/secrets and passes values into Docker builds. Pitfalls and Crunu.

    Build and runtime

  • TypeScript for Edge Functions on Deno; any language for clients

    Supabase environment variables

    Supabase publishable keys can go in the browser, secret keys bypass Row Level Security and must not. Edge Function secrets, legacy keys and Crunu explained.

    At runtime

Runtimes

3 pages

Runtimes read the process environment, and some can load a .env file before your code starts.

  • TypeScript

    Bun environment variables

    Bun loads up to four .env files on its own, lets shell variables win over all of them, and can inline values into bundles. What that means for your secrets.

    At runtime

  • Go

    Go environment variables

    Go reads environment variables with os.Getenv and os.LookupEnv and has no .env loader. Empty versus unset, godotenv's order, and running Go with Crunu.

    At runtime

  • JavaScript

    Node.js environment variables

    Node.js reads only process.env unless you pass --env-file. How the flag, loadEnvFile and dotenv behave, which value wins, and how crunu run fits in.

    At runtime

Containers

1 page

Container tools pass variables into each service from the shell, a file or the compose file itself.

  • YAML

    Docker Compose environment variables

    Compose uses .env and your shell to fill in compose.yaml, and passes values to containers only through environment, env_file or secrets. Precedence and Crunu.

    At runtime

How these pages are checked

Each page is checked against the stack's own documentation. The sources are listed at the end of the page, with the date we last checked each one.

The Crunu command on each page is a real crunu command. When Crunu has no dedicated integration for a stack, it is marked Recipe: the general setup, not a built-in feature.

Examples use Kiteline, a fictional company. If something is out of date or wrong, write to support@crunu.com.

Keep your .env values in one place

Free during early access. Values are encrypted on your devices, each environment has its own key, and crunu run hands them to your app without writing a file.