SlideShare a Scribd company logo
GraphQL
Joel Corrêa
Software Engineer at @ilegra
@joelcorrea_
GraphQL is a query language created by Facebook in 2012 which
provides a common interface between the client and the server for
data fetching and manipulations
Design considerations
Hierarchical
- "We don't think of data in terms of resource URLs, secondary keys,
or join tables; we think about it in terms of a graph of objects and
the models we ultimately use in our apps like NSObjects or JSON."
- The query is shaped just like the data it returns
- Natural way for clients to describe data requirements
GraphQL
Product‐centric
- Driven by the requirements of views and the front‐end
engineers that write them
- GraphQL starts with their way of thinking the requirements and
build the language and runtime necessary to enable that
Strong‐typing
- Every GraphQL server defines an application‐specific type
system
- Given a query, tools can ensure that the query is both syntactically
correct and valid within the GraphQL type system before execution
- At the development time, and the server can make certain
guarantees about the shape and nature of the response.
Type system
Client‐specified queries
- It is the client that is responsible for specifying exactly how it will consume
those published capabilities.
- These queries are specified at field‐level granularity
- In the majority of client‐server applications written without GraphQL, the
server determines the data returned in its various scripted endpoints. A
GraphQL query, on the other hand, returns exactly what a client asks for
and no more.
Introspective
- A GraphQL server’s type system must be queryable by the GraphQL
language itself
GraphQL
Version free
- When you're adding new product features, additional fields can be added to the
server, leaving existing clients unaffected. When you're unsetting older features,
the corresponding server fields can be deprecated but continue to function.
- Gradual, backward-compatible process which removes the need for an
incrementing version number
- Facebook still support three years of released Facebook applications on the same
version of our GraphQL API
GraphQL
Transport independent
HTTP is just one option - GraphQL is transport independent, so you can
use it with websockets or even mqtt.
Goals
- A powerful and productive environment for building client
applications
- Product developers and designers building applications against
working GraphQL servers can quickly become productive without
reading extensive documentation and with little or no formal
training.
Query
GraphQL
References
- https://facebook.github.io/graphql/
- https://code.facebook.com/posts/1691455094417024/graphql-a-data-query-
language/
- https://www.youtube.com/watch?v=WQLzZf34FJ8
- JS Reference Server impl:
- https://github.com/graphql/graphql-js

More Related Content

GraphQL

  • 1. GraphQL Joel Corrêa Software Engineer at @ilegra @joelcorrea_
  • 2. GraphQL is a query language created by Facebook in 2012 which provides a common interface between the client and the server for data fetching and manipulations
  • 4. Hierarchical - "We don't think of data in terms of resource URLs, secondary keys, or join tables; we think about it in terms of a graph of objects and the models we ultimately use in our apps like NSObjects or JSON." - The query is shaped just like the data it returns - Natural way for clients to describe data requirements
  • 6. Product‐centric - Driven by the requirements of views and the front‐end engineers that write them - GraphQL starts with their way of thinking the requirements and build the language and runtime necessary to enable that
  • 7. Strong‐typing - Every GraphQL server defines an application‐specific type system - Given a query, tools can ensure that the query is both syntactically correct and valid within the GraphQL type system before execution - At the development time, and the server can make certain guarantees about the shape and nature of the response.
  • 9. Client‐specified queries - It is the client that is responsible for specifying exactly how it will consume those published capabilities. - These queries are specified at field‐level granularity - In the majority of client‐server applications written without GraphQL, the server determines the data returned in its various scripted endpoints. A GraphQL query, on the other hand, returns exactly what a client asks for and no more.
  • 10. Introspective - A GraphQL server’s type system must be queryable by the GraphQL language itself
  • 12. Version free - When you're adding new product features, additional fields can be added to the server, leaving existing clients unaffected. When you're unsetting older features, the corresponding server fields can be deprecated but continue to function. - Gradual, backward-compatible process which removes the need for an incrementing version number - Facebook still support three years of released Facebook applications on the same version of our GraphQL API
  • 14. Transport independent HTTP is just one option - GraphQL is transport independent, so you can use it with websockets or even mqtt.
  • 15. Goals
  • 16. - A powerful and productive environment for building client applications - Product developers and designers building applications against working GraphQL servers can quickly become productive without reading extensive documentation and with little or no formal training.
  • 17. Query
  • 19. References - https://facebook.github.io/graphql/ - https://code.facebook.com/posts/1691455094417024/graphql-a-data-query- language/ - https://www.youtube.com/watch?v=WQLzZf34FJ8 - JS Reference Server impl: - https://github.com/graphql/graphql-js