Demand driven Applications with GraphQL

Post on 28-Jan-2018

317 views 1 download

Transcript of Demand driven Applications with GraphQL

Demand Driven Applicationswith

Vinci Rufus@areai51

GraphQL

3 Eras of Web based Applications

MonolithicServer Side Applications

De-CoupledHeadless

Applications

REST

Demand DrivenApplications

Demand Driven

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

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

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

API Documentation

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

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

Demand Driven Architecture

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,

FALCOR GraphQLBy

Netflix2011

By

Facebook2012

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.

"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)

Evolution

2012Internal

Development at Facebook

2015Open sourced

2016Deemed

Production Ready

Popular brands using Graphql

GraphQL Specifications

facebook.github.io/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

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

GraphQL Clients

Relay

lokka

React | Angular | iOS | Android | VanillaJS

RESTGraphQL

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

RESTGraphQL

GraphQL Topology

GraphQL

PIM OMS Inventory RDBMS

Microservices

Gql QueryGql Query

Authentication & Authorization

HTTP

Authentication

GraphQL

Business Logic

Authorization

REST

Data Layer

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

GraphQL Query

• Single Endpoint.

• No more crazy parsing logic for JSON data

• No Need for Versioning

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.

GraphiQL

demo:

bit.ly/git-stars

code:

bit.ly/git-stars-code

Upcoming Features

@defer

Live Queries

• Vinci Rufus• @areai51