Want to make creations as awesome as this one?

Wild Code School

Transcript

Brief Introduction to

GraphQL

Index

1. The Story

2. What is GraphQL ?

3. What GraphQL is not?

4. Advantages

5. Limitations

6. GraphQL VS REST

7. Stop talking, demo time

The Story

1

The industry shift to mobile

2011

Facebook mobile app face performance issues

Facebook decide to build the mobile app from scratch

2012

But what was the problem to solve ?

A lot of informations to fetch !

Gather the data need to access multiple round trips between the client and server

Under fetching

Downloads more informations than is actually required

Over fetching

Unnecessary energy consumption

🌱

It's not
Environment

Friendly

GraphQL
idea
was
Born !

Feb 2012

Facebook first mobile app for iOS was released with GraphQL

August 2012

the GraphQL
first spec
published

2015

Which of these statements is true?

  1. GraphQL is a database technology
  2. GraphQL can only be used together with SQL
  3. GraphQL was invented by Facebook
  4. GraphQL was developed by Netflix and Coursera

Which of these statements is true?

  1. GraphQL is a database technology
  2. GraphQL can only be used together with SQL
  3. GraphQL was invented by Facebook
  4. GraphQL was developed by Netflix and Coursera

Unlock the next chapter

πŸ”“

βœ…

So what is GraphQL?

2

" A query language for your API "

" GraphQL makes it easier for app developers to get the data they need without needing to know which sources it’s coming from "

" GraphQL is a syntax that describes how to ask for data "

" Allows to query deeply nested associations "

  • Query

  • Mutation

  • Subscription


Operations Type

Can change their result over time by
mainting active connection
to the server (via websocket)
enabling the server to push updates.

Retrieve Data

Manipulate Data ( add, delete, update )

What are GraphQL subscriptions used for?

  1. Event-based realtime functionality
  2. Schema-based realtime functionality
  3. You use them to subscribe to the GraphQL Weekly newsletter
  4. They combine Queries and Mutations and allow you to read and write data

Unlock the next chapter

πŸ”“

What are GraphQL subscriptions used for?

  1. Event-based realtime functionality
  2. Schema-based realtime functionality
  3. You use them to subscribe to the GraphQL Weekly newsletter
  4. They combine Queries and Mutations and allow you to read and write data

βœ…

What is NOT ?

3

IS NOT Frontend technology

IS NOT Only for React
Developer's

Fetching IS NOT works
Magically

GraphQL IS NOT SQL

IS NOT a Database

GraphQL and REST, CAN co-exist

GraphQL Misconceptions

Why using
Graphql ?

4

performance

1

Under fetching

Prevents multiple round-trips

Ask for what you need,

Get exactly that !



To reduce bandwidth, especially on mobile and low-energy devices.

Language agnostic

2

plenty of client and server libraries are available

More than 23 languages already supported

Documentation

3

Introspection

  • Learn about the available fields and types of a GraphQL schema

  • Documentation is automatically generated
    and always up-to-date

Strongly Typed

4

Robust static types

  • Code is predictable

  • Earlier detection of errors and speeds development

  • The response in a simple, secure, and predictable shape

Developer Experience

5

Flexibility & Evolution

  • Add new fields and types to GraphQL API without breaking changes ( incremental )

  • Developers don’t have to maintain multiple versions of the API

  • Single source of truth

6

Community

Powerful developer tools

🧰

Widespread adoption


Widespread adoption


Limitations

5

Pain points

  • Lack of resources on the backend part ( Java )

  • A single endpoint make caching complicated => should use tools

  • Learning curve

  • Move complexity to backend (Query Complexity)



GraphQL VS
REST

6

But wait !
what is REST?

  • A client-server architecture

  • Stateless operations such as POST, PUT, DELETE, GET, ...

  • Caching Mechanism (using the same URL )

  • Easily Scalable


What is GraphQL Good for?


What is REST Good for?


  • Error Reporting and Monitoring
    ( graphql return 200 OK status )
  • Caching
  • Security

  • Performance
  • Better DX
  • A humain-readable query
  • Single endpoint
  • get exactly what you need !
  • Evolution

🎌

Key Differences

Which is Better ? GraphQL will Replace REST ?

Demo

7

Wrapping Up

8

What's an API ?

Client

Kitchen

Waiter

Application

API

Server

To summarize

  • Graphql is solving many problems
  • Graphql has some drawbacks that shouldn't be ignored
  • Avoid "Hype Driven Development"

What's next ?

9

if we do it, we know it

  • Graphql tutorial


  • Official website introduction:


  • talk about REST VS Graphql


  • Lessons from 4 Years of GraphQL



https://www.howtographql.com/




https://graphql.org/learn/




https://www.youtube.com/watch?v=yLf0rIaRtRc




https://www.youtube.com/watch?v=zVNrqo9XGOs&t=2s


Thanks!