StoicBuilder

HandbookII the ForumBuild vs runtime

IIthe Forum, The shape of an app

Build vs runtime

1 min readUpdated 28 November

In plain words

The build is the step before launch that turns your code into files ready to serve, and runtime is when those files run for real visitors.

Where you see it

The deploy log on Vercel or Netlify: npm run build, a minute of output, then a line saying the build finished. An error in that log stops the deploy; an error after it only shows up when someone uses the site.

src/lib/supabase.tsbrowser
// Vite swaps this for the real text during the buildconst url = import.meta.env.VITE_SUPABASE_URL;
Change the value on your host and nothing happens until the next build.

What goes wrong

  1. Changing a public variable without rebuilding

    VITE_ and NEXT_PUBLIC_ values are pasted into the code during the build. Update one on your host and the live site keeps the old value until you redeploy.

  2. Trusting the preview over the build

    The dev preview is forgiving and the production build is strict. A TypeScript error the preview ignored can fail the deploy.

  3. Reading the database during the build

    Data fetched at build time is frozen at that minute. New posts won't appear until the next deploy unless the page is set to refresh.

What to tell your agent

Copy this into Lovable, Bolt, Cursor or any agent
Run the production build locally and fix every error it prints, not only what the preview shows. Then tell me which environment variables are baked in at build time and need a redeploy when they change.

Quick check

Sign in to earn +10 XP for it

You change VITE_API_URL on Netlify, but the live site still calls the old address. Why?

Got a prompt that touches build vs runtime?

Paste it. You get a better prompt first, then the cards that explain it.

Check your own prompt

Free, no sign-up.