How do I set environment variables in a Node.js app deployed on Dongee Live?
On Dongee Live you define environment variables per app, even on Live Free, read them with process.env and get DATABASE_URL ready-made. Keep secrets in the backend, never in VITE_ or NEXT_PUBLIC_ variables.
On Dongee Live, a platform for publishing apps, you can deploy nodejs environment variables per app quite simply: define your own, even on Live Free, and read them with process.env; your MySQL database already arrives in DATABASE_URL. Secrets stay in the backend: VITE_ or NEXT_PUBLIC_ variables reach the browser. Below: local testing and common mistakes.
Updated November 24, 2026 · Dongee Team
What are environment variables, and why does your app need them?
They are values your app gets from the server it runs on, instead of having them written into the code. You use them to store passwords, API keys and connection details that should never end up in the repository. That way, the same code runs on your computer and on Dongee Live, and each place has its own values. If you built your app with ChatGPT, Lovable, Bolt, Cursor or Claude Code, it very likely already uses several.
Typical examples:
DATABASE_URL: the connection to your app's MySQL database. Live creates it for you.SMTP_HOST,SMTP_PORT,SMTP_USERandSMTP_PASS: for sending email.OPENAI_API_KEY, or the key for Dongee AI Router (Dongee's prepaid API for accessing AI models), with names such asAI_ROUTER_API_KEYandAI_ROUTER_BASE_URL.SESSION_SECRET: for signing sessions or cookies.- Supabase keys, if you use that external service.
How do you set them up step by step on Dongee Live?
- List the variables your code uses. Search for
process.envacross the whole project, or ask your AI: "list every environment variable this app uses". - Create each variable in your app's panel on Dongee Live, with its name and value. You don't need to create
DATABASE_URL, because Live already provides it. - Read each variable in your code with
process.env.NAME. Only set a default value for data that isn't secret, such asPORT. A key should never have a fallback value written in the code. - Publish the app. You can install the skill with
npx skills add dongeelive/skills -g -yand tell your assistant "publish" (via MCP), or push to the GitHub repository you connected. If you connect GitHub, every push publishes the app; see how in publishing a Bolt app from GitHub on every push. - Check that everything works with a
/healthroute that responds with, for example,{"db": true, "smtp": true}. It should report whether each variable exists, but never show its value.
If a change to a variable doesn't seem to take effect, double-check its name and value, and if it persists, ask Dongee's 24/7 human support in your language (the platform translates on the fly).
How do I do it locally without uploading my keys?
Keep your values in a .env file and add .env to your .gitignore. To load it, use the Node.js --env-file option (Node 20.6 or later): node --env-file=.env server.js. On older versions you can use the dotenv package. In the repository, commit only a .env.example file with the variable names and no values.
It's a good idea to validate the variables at startup, so the app stops with a clear message if one is missing:
// config.js (ESM)
const required = ['DATABASE_URL', 'SMTP_HOST', 'SMTP_USER', 'SMTP_PASS', 'AI_ROUTER_API_KEY'];
const missing = required.filter((name) => !process.env[name]);
if (missing.length > 0) {
console.error(`Missing environment variables: ${missing.join(', ')}`);
process.exit(1);
}
export const config = {
port: Number(process.env.PORT ?? 3000),
databaseUrl: process.env.DATABASE_URL,
smtp: {
host: process.env.SMTP_HOST,
port: Number(process.env.SMTP_PORT ?? 587),
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS,
},
aiRouter: {
apiKey: process.env.AI_ROUTER_API_KEY,
baseUrl: process.env.AI_ROUTER_BASE_URL,
},
};To see these variables in use, check the guides on connecting an Express app to MySQL with DATABASE_URL and sending email from Node.js with Nodemailer and SMTP. Live allows outgoing SMTP on ports 587 and 465.
Which variables reach the browser, and which don't?
| Variable type | Example | Visible in the browser? | Where it's defined |
|---|---|---|---|
| VITE_* in a static site | VITE_API_URL | Yes, it's embedded in the build | In your app's panel on Live; if you publish from GitHub, Live passes them to the build |
| NEXT_PUBLIC_* | NEXT_PUBLIC_SITE_NAME | Yes | Wherever the app is built: the value ends up inside the build |
| No prefix, on the Node server | SESSION_SECRET | No | In your app's panel on Live |
| Database | DATABASE_URL | No, only the backend uses it | Live creates it |
| AI API keys | AI_ROUTER_API_KEY | They must never be visible: call them from a route in your backend | In your app's panel on Live, without a public prefix |
If you suspect your app is already exposing a key, follow this guide to check an AI-built app for exposed keys.
What are the most common mistakes?
- Getting
undefinedbecause the name doesn't match or the capitalization changes:SMTP_PassandSMTP_PASSare different variables. - Putting a secret key in a
VITE_variable, which lets any visitor read it. - Pushing the
.envfile to GitHub. If that already happened, deleting it isn't enough: rotate the key, that is, generate a new one and revoke the old one. - Leaving extra quotes or spaces in the value when pasting it into the panel.
- Not encoding special characters in the password inside
DATABASE_URL. Encode them withencodeURIComponent. - Expecting a static site to read variables at runtime. In a static site, variables are read at build time, so after changing them you need to generate the build again.
What does each Live plan include?
| Live Free | Live Pro | Live Team | |
|---|---|---|---|
| Price | 0 USD | 15 USD/month | 29 USD/month |
| Apps | 1 | 3 | 10 |
| Environment variables | Yes | Yes | Yes |
| MySQL database | 1 per app | 1 per app | 1 per app |
| Your own domain | Yes, you can connect one | Each app can have its own | Each app can have its own |
If you move from Live Free to Pro or Team, your app stays published exactly as it is.
Frequently asked questions
Does Live Free have environment variables?
Yes. You can define your own environment variables on Live Free, just like on Pro and Team.
Where do I get DATABASE_URL?
You don't have to create it. Live generates it for your app's MySQL database, and your code only has to read it with process.env.DATABASE_URL.
Can I use Supabase with Live variables?
Yes. Live supports external services such as Supabase: store its URL and keys as environment variables, and keep the service key in the backend only.
Does Live publish my AI model if I add the key?
No. Live publishes apps, not AI models. The key only connects your app to the model's API, for example Dongee AI Router's.
Are my variables visible to others?
They're managed in your app's panel and used by your backend. Don't print them in logs or return them in your responses, and don't give them public prefixes.
In short: list your variables, create them in the panel, validate them at startup and keep secrets out of the browser. If something doesn't add up, Dongee's 24/7 human support in your language (the platform translates on the fly) can help you review it by chat or WhatsApp.
Comenta lo que quieras
Unete a la charla
Solo ingresa tu email