Secrets and settings
Moving a .env file
A project that ran on your computer or another hosting often keeps its keys in a file named .env. This page explains how those keys move to BitHut without passing through the chat, and which variables BitHut sets in every project by itself.
The .env file is never uploaded
When your AI uploads a project, BitHut leaves the .env file out. If the code had one, the deploy result says which names it defined and which of them are not saved in BitHut yet.
Moving the keys
Your AI does this for you:
- It asks BitHut for a one-time command and runs it in the project folder, on the computer where the
.envfile is. The command works once, within 30 minutes. - The command sends the file straight to BitHut. Your AI does not read the values aloud or paste them into the chat.
- BitHut saves each line: names with a public prefix such as
VITE_orNEXT_PUBLIC_become build settings, the rest become secrets. - The answer lists only the names: what was saved, and what was skipped and why.
BitHut skips empty values, names it sets itself, and names that are not written in capital letters, digits and underscores.
A running project restarts with the new keys. A paused project gets them when you resume it, and a new project on its first deploy.
Values that point at your computer
Some values only work on the computer they came from. BitHut points them out:
- An address with
localhost, such as a database on your computer. BitHut cannot reach it. Your AI can give the project its own database on BitHut, or the value must point at a database reachable from the internet. - A path to a file, such as a SQLite database. Your AI sends the file to the project’s disk and changes the value to point there, for example
sqlite:////data/app.db. See Data.
To change one value later, add it again on the Keys tab. See Adding a secret.
Variables BitHut sets
Every project gets these variables from BitHut. You cannot save keys with these names.
| Name | Value | What it is for |
|---|---|---|
PORT |
8080, unless the code always uses another port |
The port a site listens on. Visitors are sent to it |
DATA_DIR |
/data |
The folder that stays when a new version goes online. Keep databases and saved files here |
BITHUT_POOL |
A technical value | BitHut uses it to apply your plan’s shared memory and processor. Your code does not need it |
Some features add their own variables when you turn them on: DATABASE_URL when the project gets its own Postgres database, BITHUT_MAIL_KEY when the project can send you email, BITHUT_GOOGLE_KEY when it gets access to your Google Sheets.