FeaturesCMS
PreviousNext

Notion

Configure Notion as a typed content backend.

In this guide, we gonna implement a blog using Notion as a content management system.

Create a notion database

The easiest way is to import our database template.

Download the database template.

Blog Template

Import it in your Notion workspace.

Importing the blog database template in Notion

Set your Notion Connection to expose your data

Add a new integration.

In the browser, go to https://www.notion.so/profile/integrations and add a "New integration".

Configure your integration settings.

In "Configuration" tab > Capabilities we gonna need :

  • Select "Read content" only (remove the other capabilities)
  • Select "No user information" (in the "User capabilities" section)

Set the NOTION_INTEGRATION_SECRET environment variable.

Show the "Internal Integration Secret" field and copy the value.

Use the copied value to set the NOTION_INTEGRATION_SECRET environment variable.

NOTION_INTEGRATION_SECRET=your-integration-secret

Set your config file

Create a config/cms.config.ts file in your application and set the NOTION_INTEGRATION_SECRET environment variable.

config/cms.config.ts
'server-only';
 
import { parseNotionConfig } from '@kit/notion/config';
import { envs } from '~/envs';
 
export const notionConfig = parseNotionConfig({
    auth: envs().NOTION_INTEGRATION_SECRET,
    contentTypes: {
        // edit this object to fit your needs
        // your content types here ...
    },
});
PropTypeDefault
contentTypes*
Record<string, { id: string; def: AnyContentTypeDef; }>
auth*
string

Add a new content type

Connect you database

Connect you database to your previously created integration

Connecting your database to your previously created integration

Get your database source id

Getting your database source id

Set the NOTION_POSTS_DB_ID environment variable.

NOTION_POSTS_DB_ID=your-database-source-id

Set your notion definition in the config file

To let the @kit/notion package to know the nature of your database, you need to add it in the contentTypes object.

config/cms.config.ts
'server-only'; import { parseNotionConfig } from '@kit/notion/config'; import { envs } from '~/envs'; export const notionConfig = parseNotionConfig({ auth: envs().NOTION_INTEGRATION_SECRET, contentTypes: { posts: { id: envs().NOTION_POSTS_DB_ID, def: { categories: 'multi_select', language: 'select', description: 'rich_text', slug: 'rich_text', image: 'files', status: 'status', title: 'title', }, }, }, });

Use the following tool to get your notion definition.

What It Does

@kit/notion maps Notion database schemas to typed content models and provides client, UI, and API helpers.

When To Use

  • Non-technical editors manage content in Notion.
  • You need API-backed docs/blog content with typed mapping.

Prerequisites

  • Notion integration secret.
  • Database IDs and property definitions.

How To Use

Define Notion config.

import { parseNotionConfig } from '@kit/notion/config'; export const notionConfig = parseNotionConfig({ auth: process.env.NOTION_INTEGRATION_SECRET!, contentTypes: { posts: { id: process.env.NOTION_POSTS_DB_ID!, def: { title: 'title', slug: 'rich_text', description: 'rich_text', status: 'status', }, }, }, });

Use content client and helpers.

  • NotionContentClient for content retrieval/markdown.
  • API handlers from @kit/notion/api for search/render/export endpoints.

MCP Context

capability: notion_content_backend
entrypoints:
  - @kit/notion/config
  - @kit/notion/client
  - @kit/notion/api
inputs:
  - integration_secret
  - content_type_schema_mapping
outputs:
  - typed_notion_content
constraints:
  - each content type must satisfy required fields (slug/title or roadmap rules)
side_effects:
  - Notion API read traffic

Agent Recipe

  1. Create Notion integration and get secret.
  2. Map each content type schema in parseNotionConfig.
  3. Add API routes and page loaders using notion helpers.

Troubleshooting

  • Validation errors usually indicate wrong property types in def mapping.
  • Empty results often mean integration not connected to target database.

How is this guide?

Last updated on 3/23/2026