Hosting and deploys
Sort out your environment variables
Something is undefined in production and you’re not sure which keys go where.
- What you get
- One table of every variable, where it must be set and whether it’s safe for the browser, plus an up-to-date example .env file.
- Paste it into
- Your AI tool, in your project
The prompt
Make an inventory of every environment variable this project reads: the app, its scripts, CI, and any serverless or edge functions. Include names read indirectly, for example through a helper or process.env[name]. For each one, give me: its name, the file and line that reads it, what it's for, whether it's required or optional, whether it's a secret or safe to show in the browser, whether it's needed when the project is built or only while it runs, and whether it needs a different value in each environment this project has. Flag any secret exposed to browser code through a public prefix such as NEXT_PUBLIC_ or VITE_, and any name in my .env files that no code reads. Then find the project's example .env file, or create one if there's none, and make sure git isn't ignoring it. Give it every name with a placeholder, never a real value. Don't print values from any .env file. Finish with where each variable has to be set (my host, the database provider, CI). Say so if you're unsure where a screen is.
Use it
Open your AI tool (Claude Code, Codex or Cursor) in your project folder and paste it in. Replace the parts in [brackets] with your own details first.
More in Hosting and deploys
Refreshing a page gives a 404
Links work when you click them, but a refresh or a shared link lands on Not Found.
Pick a host that fits this project
Vercel, Netlify, Cloudflare, Railway, a VPS: everyone recommends something different.
Requests time out in production
A slow request finishes locally but gets cut off on the host.
Keep test data out of your real database
Preview deploys and local testing talk to the same database and keys as the live site.