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: