Skip to main content

Environment Variables

Configure the ReadOnly client using environment variables:

Required

READONLY_API_KEY (required) Your project API key from the ReadOnly dashboard.
Never commit this to version control. Use .env files.

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/).
Files will be cached in node_modules/.cache/readonly/ READONLY_OUTPUT_DIR (optional, defaults to _generated) Output directory for generated TypeScript files (relative to node_modules/).
Types will be generated in node_modules/_generated/readonly/

Configuration Methods

Create a .env file in your project root:
.env
Add .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
Result:
Changing these directories will affect import paths. Make sure to update your tsconfig.json if needed.

TypeScript Configuration

No special TypeScript configuration is required. The client uses standard node_modules resolution. However, if you want to add path aliases, you can configure tsconfig.json:
tsconfig.json
Then use:

Security Best Practices

Always use .env files and add them to .gitignore: bash .gitignore .env .env.local .env.*.local
Create separate projects for development, staging, and production: bash # Development READONLY_API_KEY=ro_dev_abc123... # Production READONLY_API_KEY=ro_prod_xyz789...
Regenerate API keys periodically from the dashboard: 1. Go to your project settings 2. Click “Regenerate API Key” 3. Update your environment variables
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

Next Steps

CLI Reference

Learn about all available commands.

Usage Guide

Learn how to import and use files.

Quickstart

Get up and running quickly.

Troubleshooting

Common issues and solutions.