Environment Variables & Configuration
Learn how to configure your applications using environment variables, secrets, and runtime configuration.
Environment Variable Types
The Strongly platform supports three types of environment variables:
- Regular Variables: Standard configuration values
- Secrets: Encrypted sensitive data (passwords, API keys)
- Build-time Variables: Values injected during Docker build
Defining Variables in Manifest
Regular Environment Variables
Standard configuration values accessible at runtime:
env:
- name: API_URL
value: "https://api.example.com"
required: false
description: Backend API endpoint
- name: LOG_LEVEL
value: "info"
required: false
description: Application log level (debug, info, warn, error)
Secrets
Sensitive values marked with secret: true. Secret values are never baked into the built image and are excluded from client-side runtime config injection:
env:
- name: DATABASE_PASSWORD
value: "" # Provided by user during deployment
required: true
secret: true
description: PostgreSQL database password
- name: JWT_SECRET
value: ""
required: true
secret: true
description: Secret for JWT token signing
- name: API_KEY
value: ""
required: true
secret: true
description: Third-party API key
- Never commit secrets to version control
- Always mark sensitive values with
secret: true - Leave
valueempty for secrets - users provide them during deployment - Rotate secrets regularly
Build-time Variables
Values passed to Docker build as --build-arg:
env:
- name: NODE_ENV
value: "production"
buildtime: true
description: Node.js environment
- name: REACT_APP_VERSION
value: "1.0.0"
buildtime: true
description: Application version displayed in UI
- name: REACT_APP_API_URL
value: "https://api.acme.com"
buildtime: true
description: Baked into React build
Using in Dockerfile:
ARG NODE_ENV
ARG REACT_APP_VERSION
ARG REACT_APP_API_URL
ENV NODE_ENV=${NODE_ENV}
ENV REACT_APP_VERSION=${REACT_APP_VERSION}
ENV REACT_APP_API_URL=${REACT_APP_API_URL}
RUN npm run build
Variable Precedence
Environment variables can come from multiple sources. When the same name is set in more than one place:
- Platform-injected variables (listed below) always win, and an app's own variable cannot take one of their names.
- Manifest values override the app's own variables. To let users set a variable at deploy time or on the app's Settings tab, leave its
valueempty in the manifest. - The app's own variables (the deploy form, the Settings tab,
PUT /api/v1/apps/:id/env) apply when the manifest does not pin a value.
A variable's name is letters, digits, _, - or ., and does not start with a digit (the rule Kubernetes applies). Any other name (QA=BAD, 1ST, HAS SPACE) is refused where it is set, naming it, and nothing changes on the app.
Platform-Injected Variables
The platform sets these variables in every app at each deploy, start and restart. They are not stored as the app's own variables, so they are not in its environment on the Settings tab or in environmentVariables from the API:
Core Platform Variables
| Variable | Description | Example |
|---|---|---|
STRONGLY_URL | The path the browser reaches the app under (no domain): /api/proxy/<app id> without an apps domain; '' (empty: the app is at the root of its own host) with one | /api/proxy/app-xyz123 |
STRONGLY_HOST | Platform host URL (no trailing slash) | https://app.strongly.ai |
STRONGLY_BASE_URL | The platform's public URL (no trailing slash), for links shown to a person; the same in every app, workspace and job | https://app.strongly.ai |
STRONGLY_API_URL | The platform API's address from inside the app (append /api/v1). Calls to it are made as the app's owner, with no API key | http://dashboard.strongly.svc.cluster.local |
STRONGLY_PLATFORM_AUTH | auth-proxy: the app sends no key of its own to STRONGLY_API_URL; the Strongly SDK reads this | auth-proxy |
STRONGLY_APP_ID | The app's unique ID | app-xyz123 |
STRONGLY_MCP_SERVER_URL | The app's remote MCP server URL: what its users add to their AI client, and the audience of the access tokens it receives | https://app.strongly.ai/mcp/apps/app-xyz123 |
STRONGLY_MCP_ISSUER | The issuer of the remote MCP access tokens the app receives | https://app.strongly.ai/oauth/apps/app-xyz123 |
STRONGLY_SERVICES | JSON with all connected services | See STRONGLY_SERVICES |
HF_TOKEN | The app owner's Hugging Face token (Profile > Integrations > Hugging Face), read at each deploy, start, restart and environment change, for gated models and datasets. Absent when the owner has set none | hf_... |
HUGGING_FACE_HUB_TOKEN | The same token, under the name older huggingface_hub releases read | hf_... |
PORT | The port your app listens on: the one your manifest declares | 3000 |
APP_NAME | The app's name | my-app |
ENVIRONMENT | The platform environment the app runs in | production |
These are set last: an environment variable or manifest entry with the same name does not replace STRONGLY_API_URL, STRONGLY_PLATFORM_AUTH or STRONGLY_BASE_URL.
Calls From Your App to the Platform
Every call your app's server makes to a platform service (STRONGLY_API_URL, the AI Gateway's base_url in STRONGLY_SERVICES, and the other platform services) goes through the platform proxy that runs beside your app. What your app can expect from it:
- Identity. The proxy adds the app owner's token (
Authorization: Bearer ...) to every request. It removes anyAuthorizationyour code sets, and identity headers such asX-User-IdorX-Organization-Id.X-Strongly-User-Token, the signed-in user's signed token, is passed through unchanged. - Persistent connections. The proxy speaks HTTP/1.1 and keeps your app's connections open between requests, so use your HTTP client's normal connection pool (Node's
fetchand undici, Pythonrequestssessions andhttpxclients, Go'shttp.Client). You do not need a new connection for each call. - Idle connections. An idle connection stays open for 600 seconds. Each response says so in
Keep-Alive: timeout=600, and clients that read it (undici, Apache HttpClient) retire the socket first. Common client pools retire idle sockets sooner on their own (undici 4 seconds, httpx 5, aiohttp 15, Go 90, OkHttp 300), and Pythonrequestschecks that a pooled socket is still open before it reuses it. - Closing. When the proxy closes your connection after a response, that response carries
Connection: close, so your client never reuses the socket. It closes after a response when your request sentConnection: close, when the request was HTTP/1.0, when the service ended the response by closing the connection, or when the service answered before your request body was complete. - Streaming. Server-sent events (for example an agent run or
stream: trueon chat completions) and other streamed responses reach your app as the service writes them. WebSocket connections (Upgrade: websocket) work too. - Leaving. If your app closes its connection while a call is still running, the service sees the disconnect and stops the work.
- Requests the proxy refuses. The proxy reads each request strictly and answers these itself, with an RFC 9457 problem (
application/problem+json) andConnection: close, without sending anything to the service: a malformed request line or header (400),Transfer-Encodingtogether withContent-Length(400), aContent-Lengththat is not a single number (400), a transfer coding other thanchunked(501), a header block over 256 KB (431) andCONNECT(405). Standard HTTP clients never send any of these. - A service that cannot be reached. If the service cannot be reached, or the proxy cannot write your request to it, the proxy answers
503as a problem that names the service and says the request was not sent (safe to send again, aPOSTtoo). If the service closes the connection without answering, the proxy answers502. - Resending, once. The proxy reuses its own pooled connections to platform services. If a pooled connection turns out to be closed before the proxy wrote your request on it (the service closed it while it sat idle), or writing to it fails with the connection already closed and nothing of a response read, the proxy sends your request once more on a new connection, and your app sees only the answer. If the service closes a pooled connection after your request was written and before any of an answer (a replica shutting down closes its idle connections), the proxy sends the request once more on a new connection only when sending it twice is the same as sending it once: a
GET,HEAD,OPTIONS,TRACE,PUTorDELETEwith no body. APOST, aPATCHor a request with a body is never sent again once any of it may have reached the service. No request is sent more than twice, or again after a new connection fails: those are a502.
During image builds, the platform also passes the size you typed as STRONGLY_CPU, STRONGLY_MEMORY, and STRONGLY_DISK Docker build arguments (each only when set, for example 0.5 / 1GB / 10GB), along with the STRONGLY_* identity variables above.
STRONGLY_URL (Critical for Frontend Apps)
STRONGLY_URL is a relative path, not a full URL: the base path the browser reaches your app under.
- Without an apps domain:
/api/proxy/<app id>(e.g./api/proxy/app-xyz123). API calls must go to/api/proxy/app-xyz123/api/...; a bare/api/...reaches the platform, not your app. - With an apps domain:
''(empty). The app is served at the root of its own host (https://<slug>.<apps domain>/and its custom domains, Where an app opens), so/api/...is your app.
An empty STRONGLY_URL means "served at the root", not "missing": test it for undefined, never for falsy. Never hard-code /api/proxy/<app id>; take the base from STRONGLY_URL, from X-Forwarded-Prefix per request, or use relative URLs, and the same build runs in both modes.
Server-side: Inject runtime config into HTML
// In your Express server's static file handler
app.get('*', (req, res) => {
const indexPath = path.join(__dirname, '../client/dist/index.html');
fs.readFile(indexPath, 'utf8', (err, data) => {
if (err) return res.status(500).send('Server error');
// Build runtime config from platform environment variables
const runtimeConfig = {
STRONGLY_URL: process.env.STRONGLY_URL || '',
STRONGLY_HOST: process.env.STRONGLY_HOST || '',
STRONGLY_APP_ID: process.env.STRONGLY_APP_ID || '',
API_URL: '/api'
};
// Inject into HTML
const modifiedHtml = data.replace(
'</head>',
`<script>window.__RUNTIME_CONFIG__ = ${JSON.stringify(runtimeConfig)};</script></head>`
);
res.send(modifiedHtml);
});
});
Client-side: Use runtime config for API calls
// In your API service (e.g., api.ts)
function getApiBaseUrl() {
const config = window.__RUNTIME_CONFIG__ || {};
// STRONGLY_URL: /api/proxy/app-xyz without an apps domain, '' at the root
// of the app's own host (and when run locally). Append /api for your routes.
return `${(config.STRONGLY_URL ?? '').replace(/\/$/, '')}/api`;
}
const api = axios.create({
baseURL: getApiBaseUrl(),
timeout: 30000,
});
STRONGLY_SERVICES
JSON object containing all connected service credentials. See STRONGLY_SERVICES Integration for the complete structure and usage examples.
const services = JSON.parse(process.env.STRONGLY_SERVICES || '{}');
// Access addons (grouped by type)
const mongoAddons = services.services?.addons?.mongodb || [];
const firstMongo = mongoAddons[0];
// Access AI models
const aiGateway = services.services?.aigateway;
const models = aiGateway?.available_models || [];
User Identity Headers
The platform proxy adds identity headers to requests reaching your app, so your app never needs its own login page, user table, or session store:
| Header | Description |
|---|---|
X-Strongly-User-Token | Signed token identifying the signed-in user. Absent for anonymous visitors to a public app. |
X-Forwarded-Prefix | The path your app is under: /api/proxy/<app-id> without an apps domain, '' (empty) at the root of its own host with one. Treat a missing or empty header as the root |
A workflow that calls your app with the REST API node's Strongly app target (see Calling a Strongly app from a workflow) arrives as the workflow's run owner, and an agent's Call any REST API connector with the Strongly app target as the agent's owner: X-Strongly-User-Token is that user's, on scheduled and triggered runs alike (a deployed workflow's run owner is the user who deployed it; a draft run's is you).
To call the platform's agent routes for the signed-in user, forward X-Strongly-User-Token unchanged with the call: the agents your app creates are then that user's own (Agent Clones). The platform verifies the token and refuses one that does not verify (401).
The user token is a standard three-segment token whose payload segment is base64url-encoded JSON containing a user object with id, email, name, role and appRole. On an app that charges for access, a covered user's user object also carries plan (id, kind of individual or team, and status), so the app can gate features by plan.
appRole: the user's role in your app. Gate your app's features on this one:
admin: An app admin. The app's owner is alwaysadmin; any app admin makes one of the app's users an admin with the role selector on the app's Permissions tab,PATCH /api/v1/apps/:appId/users/:id{ "role": "admin" },apps.update_user(..., role="admin"), or by inviting them with roleadmin(App admins)user: User with standard access to the appviewer: Authenticated user of an app that allows all users
Open your app's admin features to appRole === 'admin', not to a list of email addresses in an env var: the app's admins then manage who that is from the Permissions tab.
role: the user's platform role (admin, developer or app), which the platform's services read. It says nothing about your app: an admin of your app who signed up through its branded page is role: "app", appRole: "admin". Never use role for your app's permissions.
Reading the user in Express:
// Decode the payload of the proxy-injected user token
function decodeUserToken(token) {
const parts = token.split('.');
if (parts.length !== 3) {
throw new Error('X-Strongly-User-Token is not in the expected format');
}
return JSON.parse(Buffer.from(parts[1], 'base64url').toString('utf8'));
}
app.use((req, res, next) => {
const token = req.headers['x-strongly-user-token'];
if (!token) {
// Anonymous access to a public app - a legitimate state, not an error
req.user = null;
return next();
}
try {
req.user = decodeUserToken(token).user; // { id, email, name, role, appRole }
} catch (err) {
return res.status(400).json({ error: 'Malformed user token' });
}
next();
});
// Use in routes
app.get('/api/profile', (req, res) => {
if (!req.user) {
return res.status(401).json({ error: 'Not authenticated' });
}
res.json({ user: req.user });
});
// Check for app admin access (the owner is an app admin too)
app.delete('/api/settings', (req, res) => {
if (!req.user || req.user.appRole !== 'admin') {
return res.status(403).json({ error: 'Admin access required' });
}
// ... handle admin action
});
Streamed Responses
A request that asks for a stream (Accept: text/event-stream) is passed to your app with its own
method and body (a POST of a chat message whose answer streams back works as it does without the
proxy) and your app's events reach the client as you write them. When your app answers it with
something other than 200 (a refusal, an error), the client gets that answer with its own status
and content type.
Signing Out
A link to _strongly/sign-out under the app's own address (<X-Forwarded-Prefix>/_strongly/sign-out, or /_strongly/sign-out at the root of the app's host on an apps domain) ends the user's platform session and shows them the app's sign-in page. Give it target="_top" so it replaces the whole page, not only the frame the app runs in:
<a href="_strongly/sign-out" target="_top">Sign out</a>
See Branded Sign-in & Sign-up for the script form and the app's own sign-out page.
Accessing Variables in Code
Node.js
// Access individual variables
const nodeEnv = process.env.NODE_ENV;
const apiKey = process.env.API_KEY;
// Parse STRONGLY_SERVICES
const services = JSON.parse(process.env.STRONGLY_SERVICES || '{}');
// Access a MongoDB addon
const mongoAddons = services.services?.addons?.mongodb || [];
if (mongoAddons.length > 0) {
const mongo = mongoAddons[0];
const connectionString = mongo.connection?.connection_string;
}
Python
import os
import json
# Access individual variables
flask_env = os.environ.get('FLASK_ENV', 'development')
api_key = os.environ.get('API_KEY')
# Parse STRONGLY_SERVICES
services = json.loads(os.environ.get('STRONGLY_SERVICES', '{}'))
# Access a MongoDB addon
mongo_addons = services.get('services', {}).get('addons', {}).get('mongodb', [])
if mongo_addons:
mongo = mongo_addons[0]
connection_string = mongo.get('connection', {}).get('connection_string')
React (Build-time)
Variables prefixed with REACT_APP_ are embedded at build time:
// Access in React components
const apiUrl = process.env.REACT_APP_API_URL;
const version = process.env.REACT_APP_VERSION;
console.log('API URL:', apiUrl);
React environment variables must be prefixed with REACT_APP_ and marked as buildtime: true in the manifest.
Runtime Configuration Injection
For React apps (type: react with a static.config_file configured), the platform injects runtime configuration without rebuilding:
Manifest Configuration
type: react
static:
root: /app/build
config_file: /app/build/config.js
config_placeholder: __APP_CONFIG__
Template File
Create public/config.js with placeholder:
window.__APP_CONFIG__ = __APP_CONFIG__;
HTML Reference
Include in public/index.html:
<!DOCTYPE html>
<html>
<head>
<script src="%PUBLIC_URL%/config.js"></script>
</head>
<body>
<div id="root"></div>
</body>
</html>
Access in React
const config = window.__APP_CONFIG__;
function App() {
const apiUrl = config.REACT_APP_API_URL;
return <div>API: {apiUrl}</div>;
}
At container start, the platform writes the actual values into the config file and replaces __APP_CONFIG__ in index.html:
window.__APP_CONFIG__ = {
"REACT_APP_API_URL": "https://api.acme.com"
};
Only runtime variables are injected: build-time variables (buildtime: true) and secrets (secret: true) are excluded from the runtime config.
Updating Variables
During Deployment
- Navigate to Apps and click Deploy App
- Add environment variables as key/value pairs in the deploy form, including values for your required secrets
- Deploy the application
After Deployment
- Navigate to the app details page
- Click the Settings tab: Environment Variables lists the app's own variables
- Add, edit or remove a variable
A change to a running app rolls out as soon as it is saved, with no downtime: a new instance starts with the new environment and the old one is retired once the new one is ready. A stopped app gets it when it starts. Apply changes rolls out the current variables again.
The variables the platform sets (see Platform-Injected Variables) are not in this list: they are set at every rollout, are listed under System Environment Variables, and a variable of yours cannot take one of their names.
System Environment Variables (on the Settings tab) lists each variable the platform sets in the running app with the value its container was started with: click the eye next to a value to show it, and the refresh button to read them again. It is shown to the users who may manage the app, since STRONGLY_SERVICES carries the app's connections, credentials included. While the app is not running it says Not running and lists the names without values.
Validation
How the platform handles your manifest's environment variables:
- Required variables without a value are flagged during deployment
- Secret variables are never baked into the built image or exposed in client-side runtime config
- Build-time variables are passed to the Docker build as build arguments
Best Practices
Naming Conventions
env:
# Good: Uppercase with underscores
- name: DATABASE_URL
- name: JWT_SECRET
- name: MAX_CONNECTIONS
# Bad: Lowercase or mixed case
- name: databaseUrl # Avoid
- name: jwtSecret # Avoid
Secret Management
env:
# Store as secret
- name: DB_PASSWORD
secret: true
required: true
# Store as regular variable
- name: DB_HOST
value: "postgres.example.com"
secret: false
Documentation
env:
- name: CACHE_TTL
value: "300"
description: Cache time-to-live in seconds
- name: MAX_RETRIES
value: "3"
description: Maximum number of retry attempts for failed requests
Troubleshooting
Variable Not Found
Problem: Application can't find environment variable
Solutions:
- Check variable is defined in manifest
- Verify variable name matches exactly (case-sensitive)
- A variable added while the app is stopped reaches it when it starts; one added while it runs rolls out when saved (the app shows Running again once it has)
- Check the app's Runtime Logs for startup errors
Secret Value Empty
Problem: A secret variable is empty at runtime
Solutions:
- Verify the secret value was provided during deployment
- Check the variable is marked with
secret: truein the manifest - A value changed on the Settings tab rolls out when saved; wait until the app shows Running again
Build-time Variable Not Available
Problem: Variable not available during Docker build
Solutions:
- Ensure
buildtime: trueis set in manifest - Add
ARGdirective in Dockerfile - Check build logs for variable injection