Secrets and source control
Store secrets and variables
Keep API keys and settings out of your code and chat, per environment, and read them from server code.
Secrets & variables keep the keys and settings your app needs, such as a payment provider's secret key or a support email address, outside the code. Secrets are write-only, so once saved, nobody can see them again, not even the build AI. Each environment has its own values. It is available in every app.
When to use it
- The app calls a service that needs an API key.
- A setting differs between the preview and the published app.
How to use it
When the build AI needs a key, it shows a Secure input for a secret in the chat. Paste the value there and select Save secret; it never enters the conversation. A chat message that looks like it contains a secret is refused, because secrets go in the secure input, never in chat.
To add one yourself:
- Open Secrets & variables.
- Choose Development (the preview) or Production (the published app).
- Select Add a secret or variable, enter a name such as
STRIPE_SECRET_KEY, choose Secret or Variable, and enter the value.
The preview then picks up development changes within a few seconds. Production values reach your published app the next time you publish.
Server code reads a value by its name, as in env('STRIPE_SECRET_KEY') from @ahamo/runtime. Secrets are never sent to
the browser.
Plans and limits
The same on every plan.
| Limit | Value |
|---|---|
| Entries per environment | 50 |
| Value | 5 KB |
| Name | Up to 64 characters of capital letters, digits and _, starting with a letter or _ |
| Reserved | Names starting with AHAMO_ |
| Browser values | A VITE_ variable is public in the browser, so a secret can't use that name |
Editing development values needs edit access to the app; production values need permission to publish it. Download App includes the names of your secrets, never their values.
Troubleshooting
"That value looks like a key or password. Save it as a secret instead." Choose Secret instead of Variable.
The published app doesn't see a new value. Production values arrive with the next publish. Publish again.
You lost a secret's value. It can't be shown again. Get a new key from the provider and Replace it.