Environment Variables
Configure the ReadOnly client using environment variables:Required
READONLY_API_KEY (required)
Your project API key from the ReadOnly dashboard.
Optional
READONLY_API_URL (optional, defaults to https://api.readonly.store)
Custom API URL (useful for self-hosted instances).
READONLY_CACHE_DIR (optional, defaults to .cache)
Cache directory name (relative to node_modules/).
node_modules/.cache/readonly/
READONLY_OUTPUT_DIR (optional, defaults to _generated)
Output directory for generated TypeScript files (relative to node_modules/).
node_modules/_generated/readonly/
Configuration Methods
1. Environment Variables (Recommended)
Create a.env file in your project root:
.env
.env to .gitignore:
.gitignore
2. Shell Export
Export variables in your shell:3. Inline Command
Prefix commands with environment variables:4. CI/CD Secrets
For CI/CD pipelines, use your platform’s secret management:Directory Structure
The default directory structure:Customizing Directories
Change the cache and output directories:.env
TypeScript Configuration
No special TypeScript configuration is required. The client uses standardnode_modules resolution.
However, if you want to add path aliases, you can configure tsconfig.json:
tsconfig.json
Security Best Practices
Never commit API keys
Never commit API keys
Always use
.env files and add them to .gitignore: bash .gitignore .env .env.local .env.*.local Use different keys per environment
Use different keys per environment
Create separate projects for development, staging, and production:
bash # Development READONLY_API_KEY=ro_dev_abc123... # Production READONLY_API_KEY=ro_prod_xyz789... Rotate keys regularly
Rotate keys regularly
Regenerate API keys periodically from the dashboard: 1. Go to your project settings 2. Click “Regenerate API
Key” 3. Update your environment variables
Use CI/CD secrets
Use CI/CD secrets
Store API keys in your CI/CD platform’s secret management: - GitHub Actions: Repository Secrets - GitLab CI:
CI/CD Variables - CircleCI: Environment Variables
Production Configuration
Docker
Dockerfile
Docker Compose
docker-compose.yml
Kubernetes
deployment.yaml