Michał Tyszkiewicz
8/28/2020
If you’re interested in a writeup about GraphQL itself head on over here. In this piece, we’ll take a look at some of the many handy GraphQL tools that make using it even more worthwhile. Bear in mind there’s quite a few of them so we’re not going to get through the lot of them in one go.
As mentioned before, working with GraphQL will require you to set up a database. Well, there’s also BaaS so you can outsource it, but what if you don't want to? This is where Prisma comes in, it’s a clever middle ground between doing it yourself and outsourcing. Prisma is an ORM library that lets you interact with the database from the server in the language you choose. So if you want to write to your MySQL database you don't have to do it in SQL, Prima lets you do it in Python, JavaScript or some other language you prefer.
You might think: "Yeah, but that’s just what a regular ORM library does". True, but Prisma comes with a few added functions:
Relay is a JavaScript framework created by Facebook for fetching and managing GraphQL data. Relay is supposed to be the go-to tool for GraphQL users with a focus on validating and optimizing your code. Another focal point is being a bridge between GraphQL and React. Relay lets you set up your data requirements using GraphQL and then it will handle the fetching, collecting queries into network requests to get you exactly what you wanted.
Relay is composed of three main loosely coupled modules:
The APOLLO platform is an implementation of GraphQL that transfers data from the server to your UI. Apollo-client is a comprehensive state management library for JavaScript that lets you manage both local and remote data with GraphQL. The aim is to enable you to build UI components that fetch data via GraphQL. Apollo-server is a quick way for building an API for GraphQL using data from any source by using a spec-compliant server that can be queried from any GraphQL client, including the Apollo-client.
Let’s look at the Apollo-client features:
Hasura is a GraphQL engine that boasts its high speed and performance. It gives you instant realtime GraphQL APIs on any Postgres database, with remote schemas for business logic and webhook triggers on database events.
The focus is to help quickly build GraphQL apps backed by Postgres or use Postgres to help move existing apps to GraphQLs:
urql is a versatile and highly adaptable GraphQL client by Formidable labs. It uses React hooks and components and intends to be a lighter client than the others. A versatile tool that you can customize to fit your needs and fine-tune as you get further along working with GraphQL.
The aim is hitting a middle ground, keeping it somewhat simple while also being able to handle complex assignments by:
Well, that’s it for the first look at GraphQL tools. Remember that that’s only five of them and GraphQL has plenty of other tools to choose from. So if I missed your favorite, just mention it in the comments and stay tuned for the next parts!