Skip to content
Skillv1.0.0

notion-multi-env-setup

Configure Notion integrations across development, staging, and production environments. Use when setting up multi-environment deployments, managing per-environment tokens, or implementing environment-

by jeremylongshore(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from jeremylongshore/tons-of-skills-marketplace (skills/.curated/notion-multi-env-setup/SKILL.md). Install upstream with npx skills add jeremylongshore/tons-of-skills-marketplace --skill notion-multi-env-setup. Copyright stays with the author (MIT).

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(): Client {
  const config = getConfig(); // reads NODE_ENV, token, per-tier defaults
  return new Client({
    auth: config.token,
    logLevel: config.logLevel,
    timeoutMs: config.timeoutMs,
  });
}

Full TypeScript getConfig/getDatabaseId and the Python equivalent: implementation.md, Step 1.

Step 2: Secret management and environment files

Keep dev/staging tokens in git-ignored per-environment files (.env.development, .env.staging). Never store production tokens in files — put them in a secret manager and inject at deploy time:

# AWS example — prod secret stored once, injected by the platform
aws secretsmanager create-secret --name "notion/production" \
  --secret-string '{"token":"ntn_prod_...","tasks_db":"...","users_db":"..."}'

AWS Secrets Manager, GCP Secret Manager (with Cloud Run injection), and HashiCorp Vault commands: implementation.md, Step 2.

Step 3: Environment guards and CI/CD

Add guards so a destructive call cannot run in the wrong tier — requireNonProduction() blocks seeding/test writes in prod, requireEnvironment('production') gates migrations. A startup validator fails fast on missing vars and catches an obvious token/tier mismatch:

function requireNonProduction() {
  if (process.env.NODE_ENV === 'production') {
    throw new Error('Destructive operation blocked in production');
  }
}

Full guard set, startup validation, and the per-environment GitHub Actions deploy workflow: implementation.md, Step 3.

Output

  • Separate Notion integrations per environment with scoped capabilities
  • Environment-aware client factory (TypeScript and Python)
  • Secrets stored in platform-appropriate secret managers (never in files for production)
  • Startup validation that fails fast on misconfiguration
  • Guards preventing cross-environment mistakes (no prod data in dev, no test data in prod)
  • CI/CD pipeline deploying with per-environment secrets

Error Handling

Issue Cause Solution
NOTION_TOKEN not set Missing env var Check the per-environment .env file or secret manager config
Wrong database in prod Env var misconfigured Add startup validation to compare token prefix with env
Token for wrong environment Secret manager mapping error Validate token prefix at startup
Dev data written to prod DB Missing environment guard Add requireNonProduction() to destructive operations
401 Unauthorized Token revoked or expired Regenerate at notion.so/my-integrations, update secret
database_id not found Page not shared with integration Share target database with the correct env integration

Examples

Two end-to-end examples live in examples.md:

  • Full initialization pattern — chains validateNotionConfig(), the client factory, and a live connectivity + database-access check into one initNotion() boot function.
  • Quick environment check script — a verify-notion-env.sh pre-deploy script that confirms the injected token authenticates and reports the workspace it points at.
# verify-notion-env.sh (excerpt) — confirm the injected token before deploy
curl -sf https://api.notion.com/v1/users/me \
  -H "Authorization: Bearer ${NOTION_TOKEN}" \
  -H "Notion-Version: 2022-06-28" | jq '{name, type}'

Resources

For monitoring your Notion integration health across environments, see the notion-observability skill.

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/jeremylongshore-tons-of-skills-marketplace-notion-multi-84576a/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

jeremylongshore-tons-of-skills-marketplace-notion-multi-84576a.ocm.jsonjson
{
  "ocm": "1",
  "id": "jeremylongshore-tons-of-skills-marketplace-notion-multi-84576a",
  "kind": "skill",
  "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\".",
  "publisher": "jeremylongshore",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "saas",
      "productivity",
      "notion",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "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\"."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/jeremylongshore/tons-of-skills-marketplace",
      "path": "skills/.curated/notion-multi-env-setup/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/jeremylongshore/tons-of-skills-marketplace/blob/HEAD/skills/.curated/notion-multi-env-setup/SKILL.md",
      "key": "jeremylongshore/tons-of-skills-marketplace/skills/.curated/notion-multi-env-setup/SKILL.md"
    },
    "compatibility": "Designed for Claude Code",
    "allowed_tools": [
      "Read,",
      "Write,",
      "Edit,",
      "Bash(aws:*),",
      "Bash(gcloud:*),",
      "Bash(vault:*)"
    ],
    "license": "MIT"
  },
  "instructions": "# Notion Multi-Environment Setup\n\n## Overview\n\nConfigure 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.\n\n## Prerequisites\n\n- Notion workspace(s) per environment (one workspace can serve dev/staging via separate integrations)\n- `@notionhq/client` v2+ installed (`npm install @notionhq/client`)\n- Python alternative: `notion-client` (`pip install notion-clien",
  "cost": {
    "context_tokens": 1539
  }
}

Fetch it by URL: GET /api/v1/registry/jeremylongshore-tons-of-skills-marketplace-notion-multi-84576a/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.