Skip to content

A simple GraphQL server for the Notion API using NextJS

Notifications You must be signed in to change notification settings

karadalex/nextjs-notion-graphql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL server for Notion API

A simple GraphQL server for the Notion API using NextJS and Apollo Server (micro)

Features

  • Dynamic Types schema generation based on Notion Databases
  • Dynamic Get Resolvers generation based on Notion Databases
  • Update mutators
  • Delete mutators
  • Notion API Caching (To reduce number of calls to the Notion API)

Examples

Database

Consider the following Notion database, on its own page

then an example query for this database is the following (the schema was generated automatically)

query {
  blogPosts {
    id
    created_time
    children {
      object
      has_more
      results {
        type
        ...on ParagraphBlock {
          paragraph {
            text {
              plain_text
            }
          }
        }
      }
    }
  }
}

Another example is the following search query that searches using the search API endpoint

query {
  search(parameters: {
    query: "blog post",
    sort: {
      direction: descending
      timestamp: last_edited_time
    }
  })
}

Deployment

Deploy the example using Vercel:

Deploy with Vercel

About

A simple GraphQL server for the Notion API using NextJS

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published