Environment Variables & Secrets
Never hardcode API keys or passwords in your source code. Syvera provides a Secrets manager for storing sensitive values securely.
Adding a secret
- Open the Secrets panel from the left sidebar (lock icon)
- Click + New secret
- Enter a key (e.g.
OPENAI_API_KEY) and a value - Click Add secret
Your secret is now available as an environment variable in your Repl.
Accessing secrets in code
Node.js / JavaScript
js
const apiKey = process.env.OPENAI_API_KEY;Python
python
import os
api_key = os.environ.get("OPENAI_API_KEY")Special environment variables
Syvera automatically injects several variables into every Repl:
| Variable | Description |
|---|---|
REPL_ID | Unique identifier for this Repl |
REPL_SLUG | URL-safe name of the Repl |
REPL_OWNER | Username of the Repl owner |
DATABASE_URL | Connection string (if a database is attached) |
PORT | Port your server should listen on |
Secrets in deployments
Secrets from development are not automatically available in deployments. You must add them separately:
- Go to Deploy → Secrets
- Add each secret your production app needs
This separation ensures you can use different values for dev and prod.