Environment variables
Environment variables hold your app's configuration: an API URL, a feature flag, a database password. They're stored per environment, and given to your app's code when it runs at the edge.
Runtime only
Variables reach code that runs at the edge: Hono, Futon, and server-rendered Rasengan.js. They're not set during the build, so a frontend bundle (import.meta.env in Vite) never sees them. See Reading variables.
Adding variables
In the dashboard, open the project's Environment variables and choose Add variable:
- Enter one or more key and value pairs. Pasting the content of a
.envfile fills them all at once. - Choose the environments they apply to.
- Mark them as secret if their values are sensitive. See Secrets.
The project's page lists each key once, with the environments that have it, and whether the value is the same in each.
Keys and values
- Keys use uppercase letters, digits and underscores, and don't start with a digit:
DATABASE_URL,STRIPE_SECRET_KEY. - Values are up to 4,096 characters.
- A key exists once per environment. Adding one that already exists in an environment is refused, and the dashboard names the conflicts.
- Don't use
ASSETSas a key: it's the name your static files are served through.
Different values per environment
A key can have a different value in each environment: API_URL pointing at a staging API in staging and the real one in production. Edit the key and set each environment's value.
When changes apply
A change applies from the next deployment of each environment it touches; the deployment running now keeps the values it was published with. After a change, the dashboard offers to redeploy the affected environments.
- Deployed from GitHub: Redeploy from the dashboard.
- Deployed with the CLI: run
hiraiship deployagain.
See Redeploy.
Who can change them
Owners, admins and developers can add, edit and remove variables. Viewers see the keys, and the values of variables that aren't secret.