Description
Schema first toolkit for Notion Data Sources with TypeScript builders, codecs, and helpers for typed tables and page access. Developers can define tables with Drizzle style builders, validate them against existing Notion data sources, and perform CRUD and query operations with predictable input and output types across both standalone pages and structured rows.
Features
defineTable()for schema first table definitions with 17 column builders (text, number, date, select, relation, etc.)- Chainable modifiers (
.title(),.optional(),.nullable(),.default()) for column customization - Type safe CRUD operations:
insert(),select(),update(),archive(),restore() - Query filtering with type safe predicates (
eq, comparisons), sorting, and cursor based pagination - Two phase relation setup with single property and bidirectional relation types
- Standalone page handles (
NotionPage) with block management for reading, creating, updating content - Thin API wrappers for pages, databases, data sources, blocks, and comments when lower level access is needed
- Type utilities:
InferInput,InferOutput,InferEnvelopefor compile-time safety - Bi directional codec system with Zod based validation for every Notion property type
- Block factories for building text, media, layout, and advanced Notion blocks
Tech Stack
- TypeScript (strict mode)
- @notionhq/client (Notion API SDK)
- Zod (schema validation and codecs)
- Vitest + MSW (testing with API mocking)
- pnpm, ESLint, Prettier
- Node.js