Where to Find Them
Go to Settings > Environment in your project. You’ll see tabs for:- Production — your live site
- Staging — pre-release testing
- Development — local dev / preview branches
Adding a Variable
Open the right environment
Click Production (or Staging/Development) based on where this variable should apply.
Or Ask the AI
Build-Time vs Runtime
This distinction matters.- Build-time (NEXT_PUBLIC_*)
- Runtime (everything else)
Variables prefixed with
NEXT_PUBLIC_ are baked into the browser bundle at build time.- Used on the client (React components, browser JS)
- Visible to anyone who views source — never put secrets here
- Require a redeploy after changing the value
NEXT_PUBLIC_ANALYTICS_ID, NEXT_PUBLIC_API_URL, NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY.Auto-Injected Variables
Hiveku sets these for you automatically — you don’t need to add them:| Variable | Meaning |
|---|---|
NODE_ENV | production, development, etc |
AWS_REGION | The region your project runs in |
HIVEKU_PROJECT_ID | Unique project identifier |
DATABASE_URL | Postgres connection (if a DB is provisioned) |
process.env.DATABASE_URL.
Never Hardcode Secrets
Bad:Per-Environment Variables
You’ll often want the same key with different values per environment.Reading Variables in Code
- Server-side (Node)
- Client-side (React)
- API routes
Verifying a Variable Is Set
After adding or changing a variable:Troubleshooting
process.env.MY_VAR is undefined in the browser
process.env.MY_VAR is undefined in the browser
Only
NEXT_PUBLIC_* variables reach the browser. Rename to NEXT_PUBLIC_MY_VAR and redeploy. Regular env vars work server-side only.I added a variable but my app still errors 'undefined'
I added a variable but my app still errors 'undefined'
Two common causes:
- You added it to Staging but your app is running Production (check the environment tab)
- It’s a build-time var (
NEXT_PUBLIC_*) and you haven’t redeployed yet — runtime vars take effect on the next container restart, build-time vars need a full redeploy
I accidentally committed a secret to git
I accidentally committed a secret to git
Rotate the key immediately at the provider (Stripe, OpenAI, etc.) — assume it’s compromised. Then remove it from your source, commit the removal, and store the new value in Hiveku env vars only.
My secret is larger than 4KB
My secret is larger than 4KB
Most env systems have a size limit. For large blobs (like a full JSON config or a certificate), store them in AWS Secrets Manager or a similar store, and keep just the pointer / reference in env vars.
Variable shows in Hiveku but not in my container
Variable shows in Hiveku but not in my container
Check you’re reading from the right environment.
process.env.NODE_ENV should match the tab where you set the variable. If it still fails, redeploy — occasionally runtime injection lags a previous deploy.What’s Next?
Deploy your site
Push env changes live
Set up a database
Uses DATABASE_URL automatically