Skip to content

Environment Variables Reference

최규민

May 26, 20262 min read

Environment Variables Reference

Environment variables

Code-accurate environment variable notes

✅
NOTION_API_KEY is the only required secret for the Notion client. NOTION_DATA_SOURCE_ID is required to fetch posts. NOTION_AUTHORS_DATA_SOURCE_ID is optional; when omitted, the app falls back to the plain Notion People name.
  • NOTION_IMAGE_SIGNING_SECRET is optional. If omitted, image proxy signing falls back to NOTION_API_KEY.
  • NOTION_IMAGE_CACHE_SECONDS is optional and capped at 3300 seconds by the API route.
  • TOKEN_FOR_REVALIDATE is optional, but /api/revalidate returns 401 unless it is set and the request sends the matching Bearer token.
plain text
NOTION_API_KEY=...
NOTION_DATA_SOURCE_ID=...
NOTION_AUTHORS_DATA_SOURCE_ID=...
TOKEN_FOR_REVALIDATE=...
NOTION_IMAGE_SIGNING_SECRET=...
NOTION_IMAGE_CACHE_SECONDS=3300
NEXT_PUBLIC_GA_ID=...

Environment variables connect the application to Notion and enable optional production features. Store them in .env.local for local development and in your deployment platform for production.

Core variables

  • NOTION_API_KEY — Internal integration secret. Treat it like a password.
  • NOTION_DATA_SOURCE_ID — Posts data source id. In recent Notion API versions this can differ from the database id.
  • NOTION_AUTHORS_DATA_SOURCE_ID — Optional Authors data source id.

Runtime variables

  • TOKEN_FOR_REVALIDATE — Bearer token for /api/revalidate.
  • NOTION_IMAGE_SIGNING_SECRET — Secret for signed Notion image proxy URLs.
  • NOTION_IMAGE_CACHE_SECONDS — CDN cache duration for proxied Notion files.
  • NEXT_PUBLIC_GA_ID — Optional Google Analytics measurement id.

Example

plain text
NOTION_API_KEY=secret_value_here
NOTION_DATA_SOURCE_ID=posts_data_source_id
NOTION_AUTHORS_DATA_SOURCE_ID=authors_data_source_id
TOKEN_FOR_REVALIDATE=random_secret
NOTION_IMAGE_SIGNING_SECRET=random_secret
NOTION_IMAGE_CACHE_SECONDS=3300
NEXT_PUBLIC_GA_ID=

Security checklist

  • Never commit .env.local.
  • Rotate secrets that were pasted into chats, issues, logs, or screenshots.
  • Use separate random values for revalidation and image signing.
  • Only variables that must be public should use NEXT_PUBLIC_.