Connection Examples
OpenAI API connection
Connect to OpenAI for language models:modus.json
PostgreSQL database
Connect to a PostgreSQL database:modus.json
Dgraph database
Connect to a Dgraph database for graph operations:modus.json
Environment variables
Naming convention
Hypermode uses a consistent naming pattern for environment variables:MODUS_<CONNECTION_NAME>_<PLACEHOLDER>
For a connection named openai
with placeholder {{API_KEY}}
:
- Environment variable:
MODUS_OPENAI_API_KEY
Local development
Set environment variables in.env.dev.local
:
.env.dev.local
Production environment
Configure production environment variables in the Hypermode console:
- Navigate to your app in the console
- Click on the Environment Variables tab
- Add your environment variables with the proper naming convention
- Save the configuration
Testing connections
Local testing
Test connections during development:Production testing
Verify connections in production:Best practices
- Never commit secrets: Use environment variables for all sensitive data
- Use least privilege: Grant minimal necessary permissions to API tokens
- Test locally first: Use
modus dev
to debug connection issues before deploying - Monitor usage: Track API calls and database connections in production