Skip to content

GraphQL API server for ammarahmed.ca created with Node.js, TypeGraphQL, Typegoose and Notion Client.

Notifications You must be signed in to change notification settings

ammar-ahmed22/ammarahmedca-server

Repository files navigation

ammarahmed.ca Website Logo

GraphQL Server for ammarahmed.ca

👨‍💻 Tech Stack

A high-level overview of the tech stack this website uses:

Front-end

  • React with TypeScript is used for the functionality of the website.
  • TailwindCSS is used as the UI framework.
  • NextUI is used to create the standardized and aesthetic UI.
  • Apollo Client is used to handle making GraphQL requests.

Back-end

Hosting

🔧 How does it work?

server architecture for ammarahmed.ca

A high-level diagram of how the server and API is set up.

Website Data

With previous iterations of my website, I found that it was quite annoying to go back into the code everytime I wanted to add/edit a project, experience or blog post to the website. I was using Notion to edit and write out my posts, experiences and project descriptions anyway, so, with the release of the official Notion API, I thought it would be simplify my experience greatly to pull data straight from there into the website. This is precisely what this backend was designed to-do.

All the data for my website is store in a Notion database. When a request is made to the server, the resolver pulls the data, parses it and sends it to the website. Here's a breakdown of the steps for a project post query:

  1. Request made to GraphQL server with the query projectMetadata
  2. Resolver for projectMetadata makes a request to the Notion database using the Notion API
  3. Data from Notion is parsed into fields and types that I have defined
  4. Data is sent as a response to the query

Technology Choices

Node.js (TypeScript)
As I'm quite comfortable with TypeScript, this was the obvious choice for me.

GraphQL
GraphQL API's are the status quo for modern API's due to their obvious advantages over REST API's. GraphQL API's allow for more fine-tuned requests which saves on data as the user can request exactly which fields they need. It also makes for easier implementation as all requests are made to the same endpoint.

TypeGraphQL
With a typical GraphQL API, types would need to be re-defined in many places when using TypeScript. The types would need to be set in the GraphQL schema as well as with the resolver functions for the API. TypeGraphQL allows you to create a single TypeScript class which will auto-generate the schema as well as be used as a regular TypeScript class for the resolvers.

💬 Feedback

If you have any feedback, please reach out to me at ammar.ahmed1@uwaterloo.ca. If you find any bugs, please create an issue or feel free to make a PR with a fix.

📋 Articles/References

Docs

About

GraphQL API server for ammarahmed.ca created with Node.js, TypeGraphQL, Typegoose and Notion Client.

Topics

Resources

Stars

Watchers

Forks

Languages