| name | notion-multi-env-setup |
| description | Configure Notion integrations across development, staging, and production environments.
Use when setting up multi-environment deployments, managing per-environment tokens,
or implementing environment-specific Notion configurations.
Trigger with phrases like "notion environments", "notion staging",
"notion dev prod", "notion environment setup", "notion config by env".
|
| allowed-tools | Read, Write, Edit, Bash(aws:*), Bash(gcloud:*), Bash(vault:*) |
| version | 1.38.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","productivity","notion"] |
| compatibility | Designed for Claude Code |
Notion Multi-Environment Setup
Overview
Configure separate Notion integrations for development, staging, and production. Each environment uses its own integration token, targets different databases, and applies environment-appropriate log levels and timeouts. This prevents dev data leaking into prod and enforces least-privilege per tier.
Prerequisites
- Notion workspace(s) per environment (one workspace can serve dev/staging via separate integrations)
@notionhq/client v2+ installed (npm install @notionhq/client)
- Python alternative:
notion-client (pip install notion-client)
- Secret management platform (AWS Secrets Manager, GCP Secret Manager, or HashiCorp Vault)
- CI/CD pipeline with per-environment variable injection
Instructions
The build has three steps. The lean skeleton below is enough to follow the workflow end to end; the full walkthrough carries the complete TypeScript and Python factories, every secret-manager command, and the CI/CD workflow.
Step 1: Per-environment integrations and an env-aware client
Create one integration per environment at https://www.notion.so/my-integrations, each with capabilities scoped to the tier — dev gets full access, prod gets the minimum required:
| Environment | Integration | Capabilities | Timeout | Log Level |
|---|
| Development | my-app-dev | All (read+update+insert+delete) | 60s | DEBUG |
| Staging | my-app-staging | Read + Update + Insert | 30s | WARN |
| Production | my-app-prod | Minimum required only | 30s | ERROR |
A single client factory reads NODE_ENV (or APP_ENV), pulls the token and database IDs from the environment, and applies the per-tier log level and timeout. It throws a descriptive error when NOTION_TOKEN is missing so misconfiguration fails loudly:
export function createNotionClient(): {
config = ();
({
: config.,
: config.,
: config.,
});
}