On Discovering GraphQL

June 10, 2019

While building this blog, I was really impressed with the simplicity of GraphQL, and its ability to quickly query any sort of relational database, given the right Gatsby plugin.

Imagine there is some kind of database with a couple of generic tables, each with some generic columns. Instead of having to write some kind of adapter to get DB data into your view, Gatsby along with GraphQL makes it super simple to keep the queries and data in one place.

If you wanted to query two tables for their data, all you would have to do is to define the outline of what you want in a JSON-like syntax (formally called the GraphQL Schema Definition Language (SDL)), and you’re all good to go!

query IndexQuery {
    rootNode {
        childNode {
    allAnotherRootNode {
        childNodes {
            anotherChildNode {

If you’re using Javascript, all you need to do to use the data would be to write something like this:

allAnotherRootNode.childNodes.forEach((node) => {

There is a little more to it, but I just wanted to go over a little about what I’ve covered while writing a super simple couple of blog posts.

Really good stuff here, more to come later. Stay tuned!

Steven Wright

Written by Steven Wright who lives and works in Sacramento building useful things.