Overview
OmniSearches uses environment variables to configure API keys and settings. Environment variables are loaded from a.env file in development mode and should be set directly in your hosting platform for production deployments.
Required Variables
These environment variables are required for OmniSearches to function properly. The application will fail to start if any of these are missing.Your Google API key with access to the Gemini API. This is used for the main AI-powered search functionality.How to obtain:
- Visit Google AI Studio
- Create a new API key
- Ensure the key has access to Gemini 2.0 Flash API
Your OpenRouter API key with access to the Deepseek reasoning model. This powers the advanced reasoning mode.How to obtain:
- Visit OpenRouter
- Create an account and generate an API key
- Ensure access to Deepseek distilled llama 70b API
The base URL for the OpenRouter API endpoint. This should be set to the OpenRouter API URL.Default value:
Optional Variables
These environment variables are optional and have default values if not specified.The specific model name to use for reasoning operations. Defaults to the Deepseek R1 distilled llama 70b model.Default value:Other options:
- Any OpenRouter-compatible model endpoint
- Check OpenRouter Models for available options
The environment mode for the application. Affects logging, error handling, and whether
.env files are loaded.Possible values:development(default) - Loads.envfile, enables debug loggingproduction- Expects environment variables from hosting platform
Legacy/alternative API key for Deepseek. This is currently defined in the environment setup but may be used for direct Deepseek API access.
Setting Up Environment Variables
Local Development
- Create a
.envfile in the root directory of your project:
- Add your environment variables:
.env
- The
.envfile will be automatically loaded when you run the development server:
Production Deployment
For production deployments, set environment variables directly in your hosting platform:- Railway: Set variables in the Variables tab of your project
- Vercel: Configure in Project Settings → Environment Variables
- Heroku: Use
heroku config:set VARIABLE_NAME=value - Docker: Pass variables with
-eflag or use a.envfile with--env-file
Environment Variable Validation
The application validates required environment variables at startup. If any required variables are missing, the application will throw an error:server/env.ts:19-28 to ensure all necessary configuration is present before the application starts.
Security Best Practices
Never Commit API Keys
Always keep your
.env file in .gitignore. Never commit API keys to version control.Use Separate Keys
Use different API keys for development and production environments.
Rotate Keys Regularly
Periodically rotate your API keys, especially if they may have been exposed.
Monitor Usage
Track your API usage in the Google Cloud Console and OpenRouter dashboard.
Troubleshooting
Variables Not Loading
If your environment variables aren’t being loaded:- Check that your
.envfile is in the root directory (same level aspackage.json) - Verify
NODE_ENVis not set toproductionin development - Restart your development server after changing
.envvalues - Check for syntax errors in your
.envfile (no quotes, no spaces around=)
Missing Variable Errors
If you see “Missing required environment variables” errors:- Verify all required variables are set in your
.envfile or hosting platform - Check for typos in variable names (they are case-sensitive)
- Ensure no trailing spaces in variable values
API Key Issues
If you’re experiencing API authentication errors:- Verify your API keys are valid and active
- Check that your Google API key has Gemini API access enabled
- Ensure your OpenRouter account has sufficient credits
- Confirm the API URLs are correct and accessible
Need help with environment variables? Check the deployment guide or consult the official documentation.