Concepts
Environment Variables
Store API keys and configuration safely using .env files in your Motia apps.
Environment Variables
Environment variables let you store API keys, database URLs, and other configuration outside your code. This keeps sensitive information secure and makes it easy to use different settings for development and production.
Quick Setup
1. Create a .env
File
Create a .env
file in your project root:
2. Add to .gitignore
Make sure you never commit your .env
file:
3. Create Template for Your Team
Using Environment Variables in Steps
TypeScript/JavaScript
Python
Deployment
When you deploy your app, set environment variables through your hosting platform:
Motia Cloud
Important Security Tips
🔒 Keep Your Keys Safe
- Never commit
.env
files to git - Use different API keys for development and production
- Don't share API keys in code or messages
That's it! Environment variables are simple - just put them in .env
and use process.env.VARIABLE_NAME
in your code.
Need help? See our Community Resources for questions, examples, and discussions.