Secrets and settings
Public build settings
Some sites need values while they are built, not while they run: the address of an API, a public key of a payment form, the name of the site. These are build settings. This page explains how they differ from secrets and how to set them.
What a build setting is
Many tools that build sites put certain values straight into the pages. Everyone who opens the site can see these values in its code. That is why they are public settings, not secrets.
BitHut treats a name as a build setting when it starts with one of these prefixes:
VITE_NEXT_PUBLIC_REACT_APP_PUBLIC_NUXT_PUBLIC_EXPO_PUBLIC_
Your AI can also mark another name as a build setting when the build needs it.
Never put a secret into a build setting. A token in VITE_API_KEY ends up in the site’s pages, where anyone can read it. Keep such keys on the server side of the project as secrets.
Setting one
Because a build setting is public, it can go through the chat. Your AI sets it with its value, for example “set VITE_API_URL to https://api.example.com”. You can also add one on the project’s Keys tab with Add a key or password: a name with one of the prefixes above is saved as a build setting.
The Keys tab shows build settings with their values, marked “public setting”.
When it takes effect
A build setting is built into the site, so a new value takes effect only with the next deploy. After you change one, ask your AI to deploy again.
If the code uses a build setting that is not set, the deploy stops before the build and names it.
From a .env file
When your AI moves a .env file to BitHut, values with these prefixes become build settings by themselves, and the rest become secrets. See Moving a .env file.
For a project deployed from a GitHub repository, your AI sets the build settings before the deploy.