Cover image

NotionDB

About

Copy heading link

NotionDB is an object modelling tool designed to interface with Notion. It is a tool to allows developers to easily spin up a cloud-based database using Notion Databases. Notion Databases consist of a series of Notion Pages (database rows) with various Properties (database columns).

NotionDB leverages the official Notion API and provides developers with easy-to-use classes and helper functions to easily retrieve, write, update, and delete data.

Why use Notion as a database?

Copy heading link
  • On top of the standard primitive types, Notion provides advanced types such as Dates with Time (start and end), People, URLs, Emails, Phone Numbers, Formulas, Relations, Rollups, and more.
  • Notion provides great facilities for Filtering (compound and/or filtering and nested filtering) and multi-level Sorting. This makes querying and sorting through data seamless for developers.
  • To visualize the data, the Notion user interface can display the database data in various views such as Table, Board, Timeline, Calendar, List, and Gallery views.
  • Being able to access and write data to a Notion Database from a server-side environment opens up endless opportunities to interface Notion with other databases, services, and APIs.

Open source

Copy heading link

The project is Open Source and can be viewed on GitHub & NPM.

Features

Copy heading link

Databases

Copy heading link
  • Get all Databases associated with an integration key.
  • Get a single Database by Database ID or Database Notion URL.
  • Create a Database using a Schema of Properties (column definitions).

Users

Copy heading link
  • Get all Users from a Database.
  • Get a single User by User ID.

Pages

Copy heading link
  • Get all Pages from a Database.
  • Get a single Page by Page ID or Page Notion URL.
  • Filter down and Sort Pages from a Database using Notion's powerful Filter and Sort tools.
  • Create a Page (a database row) inside a Database.
  • Delete a Page from a Database.
  • Restore a deleted Page from a Database.

Blocks

Copy heading link
  • Get all supported children Blocks from a Page.

Technologies used

Copy heading link

Examples

Copy heading link

Create a products database

Copy heading link
TypeScript
image-30346aa66e7a454e77fe3ee4be7f393084dc226e-640x358-gif

Create a new page (record)

Copy heading link
TypeScript
image-f45a9c9f05e008a186afafd54383bac60ff03918-640x370-gif

Get all Products that are "Cooked Foods" AND less than $2 from the Database (Sort by product_id).

Copy heading link
TypeScript
image-623033a06106f4b0ea364bc4ff2f511ab6490eba-640x388-gif