Skip to content

RaymondWHZ/notion-cms-adaptor

Repository files navigation

Notion CMS Adaptor

Type-safe Notion database toolbox for using Notion as a headless CMS.

const schema = createDBSchemas({
  posts: {
    _id: metadata("id"),
    title: title().plainText(),
    tags: multi_select().stringEnums('tech', 'life'),
    status: status().stringEnum('draft', 'published'),
  },
});

const posts = await client.query('posts');
// posts: { _id: string, title: string, tags: ('tech' | 'life')[], status: 'draft' | 'published' }[]

Features

  • Type-safe - Define schemas, get full TypeScript inference
  • Auto-discovery - Reference databases by name, not IDs
  • Flexible - Pre-defined converters with custom handler support
  • Mutations - Type-safe insert, update, and delete
  • Minimal - Thin wrapper around official Notion SDK

Installation

npm install notion-cms-adaptor

Documentation

See the full documentation for guides and API reference.

Development

bun install
bun test
bun build

License

MIT

About

🗒️ The Ultimate Type-Safe Notion Database Toolbox You Need to Use Notion as a Headless CMS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors