Demand driven Applications with GraphQL

30
Demand Driven Applications with Vinci Rufus @areai51 GraphQL

Transcript of Demand driven Applications with GraphQL

Page 1: Demand driven Applications with GraphQL

Demand Driven Applicationswith

Vinci Rufus@areai51

GraphQL

Page 2: Demand driven Applications with GraphQL

3 Eras of Web based Applications

MonolithicServer Side Applications

De-CoupledHeadless

Applications

REST

Demand DrivenApplications

Demand Driven

Page 3: Demand driven Applications with GraphQL

C O P Y R I G H T S A P I E N T R A Z O R F I S H | C O N F I D E N T I A L 3

What’s the problem with REST

Page 4: Demand driven Applications with GraphQL

C O P Y R I G H T S A P I E N T R A Z O R F I S H | C O N F I D E N T I A L 4

Over Fetching & Under Fetching

The Power of Positive Thinking

Lorem ipsum dolor sit amet, consectetur

adipiscing elit. Curabitur porttitor, purus quis

ultricies rutrum, erat nisl facilisis erat, in

maximus massa libero nec ipsum. Cras eget

leo sed est scelerisque sodales vel eget justo.

Vestibulum ante ipsum primis in faucibus orci

luctus et ultrices posuere cubilia Curae;

Aenean feugiat ante id bibendum imperdiet.

Nunc gravida mollis est, nec tincidunt diam

sodales ultricies. Etiam consequat lobortis

tellus, eu pretium dui lacinia ac. Phasellus

faucibus eros in luctus tempor. Vestibulum vel

ultrices orci. Nullam in augue libero. Nam

dapibus velit nec pellentesque porttitor.

Author - John Doe

5 Comments - View All

Page 5: Demand driven Applications with GraphQL

C O P Y R I G H T S A P I E N T R A Z O R F I S H | C O N F I D E N T I A L 5

Agree on JSON Contracts

Frontend Developer Backend Developer

Page 6: Demand driven Applications with GraphQL

API Documentation

Page 7: Demand driven Applications with GraphQL

C O P Y R I G H T S A P I E N T R A Z O R F I S H | C O N F I D E N T I A L 7

API Rigidity and Bloat

Page 8: Demand driven Applications with GraphQL

C O P Y R I G H T S A P I E N T R A Z O R F I S H | C O N F I D E N T I A L 8

API versioning

API - V1 API – V2 API – V3

Page 9: Demand driven Applications with GraphQL

Demand Driven Architecture

Page 10: Demand driven Applications with GraphQL

David Nolen

Kovas Boguta

WTH is Demand Driven Architecture?

• Driven from the client side app. Clients demand their data

needs.

• Server knows how to parse this demand structure

recursively, fetching all data that is needed.

• Query up. Render down,

Page 11: Demand driven Applications with GraphQL

FALCOR GraphQLBy

Netflix2011

By

Facebook2012

Page 12: Demand driven Applications with GraphQL

GraphQL is a query language for your API, and a

server-side runtime for executing queries by using

a type system you define for your data.

Page 13: Demand driven Applications with GraphQL

"The biggest mistake we made as a company was betting too much on HTML5 instead of native... We burnt two years.”

Tech Crunch- Disrupt (2012)

Page 14: Demand driven Applications with GraphQL

Evolution

2012Internal

Development at Facebook

2015Open sourced

2016Deemed

Production Ready

Page 15: Demand driven Applications with GraphQL

Popular brands using Graphql

Page 16: Demand driven Applications with GraphQL

GraphQL Specifications

facebook.github.io/graphql

Page 17: Demand driven Applications with GraphQL

Server Implementations

No Language Server Libraries

1 JavaScript GraphQL.js, express-graphql, Apollo Server

2 Ruby Graphql-ruby

3 Python Graphene

4 Scala Sangria

5 Java Graphql-java

6 Clojure Graphql-clj

7 Go Lang Graphql-gp , graphql-relay-go

8 PHP Graphql-php , graphql-relay-php

9 C# / .Net Graphql-dotnet, graphql-net

10 Elixir Absinthe, graphql-elixir

Page 18: Demand driven Applications with GraphQL

GraphQL is NOT

! a Graph database

! a client side state management library

! Limited to React, Relay or Web

! Limited to JavaScript & Node

Not related to Facebook’s Social Graph

Page 19: Demand driven Applications with GraphQL

GraphQL Clients

Relay

lokka

React | Angular | iOS | Android | VanillaJS

Page 20: Demand driven Applications with GraphQL

RESTGraphQL

src: http://slides.com/gerardsans/ngeurope-ng2-loves-graphql#/3/5

RESTGraphQL

Page 21: Demand driven Applications with GraphQL

GraphQL Topology

GraphQL

PIM OMS Inventory RDBMS

Microservices

Gql QueryGql Query

Page 22: Demand driven Applications with GraphQL

Authentication & Authorization

HTTP

Authentication

GraphQL

Business Logic

Authorization

REST

Data Layer

src: https://www.youtube.com/watch?v=6GyubnT38EQ

Page 23: Demand driven Applications with GraphQL

GraphQL Query

• Single Endpoint.

• No more crazy parsing logic for JSON data

• No Need for Versioning

Page 24: Demand driven Applications with GraphQL

3 Types of Operations

•Query

Query data by passing an empty object of fields you want data for.

•Mutations

Cary out write operations on the dataset.

•Subscriptions

Real-time (read-only) updates of data.

Page 25: Demand driven Applications with GraphQL

GraphiQL

Page 26: Demand driven Applications with GraphQL

demo:

bit.ly/git-stars

code:

bit.ly/git-stars-code

Page 27: Demand driven Applications with GraphQL

Upcoming Features

Page 28: Demand driven Applications with GraphQL

@defer

Page 29: Demand driven Applications with GraphQL

Live Queries

Page 30: Demand driven Applications with GraphQL

• Vinci Rufus• @areai51