Registry / database / simple-notion-orm

simple-notion-orm

JSON →
library0.0.15jsnpmunverified

Simple Notion ORM is a schema-first TypeScript ORM for Notion's Data Sources API, built on top of @notionhq/client. Current version 0.0.15 is early and experimental, with no stable release cadence. It provides Drizzle-inspired table definitions, column builders (text, number, status, relation, people, and metadata helpers), and two page abstractions (standalone pages and database rows) with typed codecs for parsing and encoding Notion payloads. Requires Node.js >= 22 and pnpm; ESM-only. Key differentiator: turns Notion's flexible but verbose API into a typed, Drizzle-like workflow with automatic payload transformation.

npm install simple-notion-orm
INSTALL
IMPORT
SIG · SIMPLE-NOTION-ORM
S
simple-notion-orm
databasejavascriptv0.0.15
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

defineTable
import { defineTable } from 'simple-notion-orm'
const { defineTable } = require('simple-notion-orm')
ESM-only package; require() will throw. Also, note that the package uses subpath exports; ensure your runtime supports them.
text
import { text } from 'simple-notion-orm/schema'
import { text } from 'simple-notion-orm'
Column builders are exported from 'simple-notion-orm/schema', not the main entry. This is a common mistake.
status
import { status } from 'simple-notion-orm/schema'
import { status } from 'simple-notion-orm'
Same as text; all column builders are under the /schema subpath.

Defines a Notion table schema using Drizzle-style column builders, inserts a row, and selects all rows.

import { defineTable, text, status, people } from 'simple-notion-orm/schema'; const tasks = await defineTable( 'Tasks', { title: text('Name').title(), assignees: people('Assignees').optional(), status: status('Status').nullable(), }, { databaseId: process.env.NOTION_TASKS_DB ?? '' } ); await tasks.insert({ title: 'Ship ORM codecs', assignees: [{ id: 'user-123' }], status: { name: 'In Progress' }, }); const rows = await tasks.select(); console.table(rows);
Debug
Known issues
breakingRequires Node.js >= 22.0.0; lower versions will fail to run.
fix
Upgrade Node.js to v22 or later.
affects: >=0.0.0
breakingESM-only package (type: module). CommonJS require() will throw ERR_REQUIRE_ESM.
fix
Use import syntax or dynamic import() if in a CJS context.
affects: >=0.0.0
gotchaColumn builders (text, number, status, etc.) must be imported from 'simple-notion-orm/schema', not the main module.
fix
Use import { text } from 'simple-notion-orm/schema'.
affects: >=0.0.0
deprecatedPassing databaseId directly to defineTable options is the only supported way; older alpha versions used a different config shape.
fix
Use { databaseId: string } as the third argument to defineTable.
affects: <0.0.15
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module not supported
Using CommonJS require() on an ESM-only package with 'type': 'module'.
fix
Change to import syntax or use dynamic import() in a CommonJS module.
Cannot find module 'simple-notion-orm/schema'
Your runtime does not support subpath exports or the package version is too old.
fix
Ensure Node.js >= 22 and update the package to the latest version 0.0.15.
TypeError: Cannot read properties of undefined (reading 'title')
Column builder .title() method called on undefined; likely forgot to call text() first.
fix
Use text('Name').title().
Upgrade
Version history
0.0.15latest on npm
Audit
Dependencies
@notionhq/clientrequiredUnderlying Notion API client
Agent activity
13 hits · last 30 days
node
10
Meta
2
Resources
simple-notion-orm — npm install simple-notion-orm · libregistry