DEV Community

Cover image for Understanding GraphQL and its Design Principles
Calleb Joel Miquissene
Calleb Joel Miquissene

Posted on

Understanding GraphQL and its Design Principles

Welcome to this article!
Now that you know what GraphQL is, its history and how it works, it's time to understand it better.
If you fell randomly in this article, I am pleased to inform you that this is the second article in a series that covers GraphQL and will guide you through the creation of your first GraphQL API using JavaScript.
If you haven't read the first article in the series, you can take a look at it afterwards because it has a very important content in case you want to understand better about the emergence of GraphQL and its operation.
I hope you have a wonderful reading.

What language to use to create my API?

Programming languages
As mentioned in the previous article, GraphQL is a declarative query language, this means that it allows you to query exactly and exclusively the data needed without worrying about how get for them. (It probably may not be very clear now, but I will discuss this point later :)).
GraphQL Server libraries exist for several programming languages ​​including JavaScript, C #, Java, Groovy, .NET, PHP, Scala, Python, Ruby, Erlang, Clojure, Elixir and Go.
The techniques that will be used in this series to build GraphQL services can be applied in any programming language, but this series is focused in the use of JavaScript create them.

GraphQL is actually a specification!
A specification refers to the description of characteristics of a language. The advantage of a specification is that it offers a common vocabulary and good practices for using the language.
GraphQL is a language specification for client-server communication.

GraphQL design principles


It is not because GraphQL allows you to build your API in any way and language you want, that it does not offer you principles for building your service.

Hierarchical
A GraphQL query is hierarchical. Fields are nested within other fields and the query is shaped like the data that it returns.

Product centric
GraphQL is driven by the data needs of the client and the language and runtime that support the client.

Strong typing
A GraphQL server is backed by the GraphQL type system. In the schema, each data point has a specific type against which it will be validated.

Client-specified queries
A GraphQL server provides the capabilities that the clients are allowed to consume.

Introspective
The GraphQL language is able to query the GraphQL server’s type system.

In the next article, you'll see GraphQL in practice, the famous queries and how to do them. For this I will use a public API where we will make our queries.
If you have any questions, suggestions or comments regarding the content covered in this article, leave it in the comments!
If you liked the article don't forget to leave your LIKE ❤!

Top comments (2)

Collapse
 
faruquebraimo profile image
FaruqueBraimo

Greit...

Collapse
 
callebdev profile image
Calleb Joel Miquissene

Thanks Faruque Ibraimo!