Configure isolated Deepgram environments for development, staging, and production with environment-aware config, client factory, Docker Compose profiles, Kubernetes overlays, and Terraform modules.
Create separate projects in Deepgram Console for dev, staging, and production. Generate environment-specific API keys with appropriate scopes.
Define typed config per environment: model (Base for dev, Nova-2 for staging/prod), features (diarization off in dev), limits (5 concurrent dev, 100 prod), and callback URLs.
Create singleton Deepgram clients per environment using a Map. Auto-apply environment config (model, features) to all transcription calls.
Define development, staging, and production profiles with environment-specific API keys, project IDs, and port mappings. Use x-common anchor for shared config.
Use Kustomize with base ConfigMap and per-environment overlays. Store API keys in SecretGenerator. Override model, concurrency, and env vars per overlay.
Run validation script that tests each environment: API key validity, project access, and transcription capability. Report pass/fail per environment.
See detailed implementation for advanced patterns.
| Issue | Cause | Solution |
|---|---|---|
| Wrong API key | Env mismatch | Validate key prefix per environment |
| Missing config | Env var not set | Throw descriptive error on startup |
| Cross-env access | Shared key | Use separate projects per environment |
| Deployment failure | Bad config | Run validation script before deploy |
| Environment | Model | Max Concurrent | Features |
|---|---|---|---|
| Development | base | 5 | Smart format only |
| Staging | nova-2 | 20 | All features |
| Production | nova-2 | 100 | All features |
# Development
DEEPGRAM_API_KEY_DEV=...
DEEPGRAM_PROJECT_ID_DEV=...
# Staging
DEEPGRAM_API_KEY_STAGING=...
DEEPGRAM_PROJECT_ID_STAGING=...
# Production
DEEPGRAM_API_KEY_PRODUCTION=...
DEEPGRAM_PROJECT_ID_PRODUCTION=...