SlideShare a Scribd company logo
Exploring
Relay-land
Stefano Masini
@stefanomasini
Relay
• Automatic fetching of data, no more Ajax
• Colocation of queries and code
• Caching
• Good for API mashup
• Why not?
A new beginning
• How to fetch data from the server?
• How to write data to the server?
• How to handle URL routing?
• How to manage application (UI) state?
• How to propagate server push notifications?
Size of libraries
LOC - *.js in github project as of Feb 2016
0 K
20 K
40 K
60 K
80 K
100 K
React Relay GraphQL React

Router
Redux
Popularity of libraries
# stars in github project as of Feb 2016
0 K
8 K
16 K
24 K
32 K
40 K
React Relay GraphQL React

Router
Redux
Stars per Line Of Code
AKA what's the smartest idea out there? :-)
React Relay GraphQL React

Router
Redux
Topics
• How to fetch data from the server?
• How to write data to the server?
• How to handle URL routing?
• How to manage application (UI) state?
• How to propagate server push notifications?
GraphQL
• GOALS:
• Space efficient (on the wire)
• Computationally efficient (server side)
GraphQL
DEMO
GraphQL is a type system
User
Site Site
Project Project Project
User
Type
Site
Type
Project
Type
SitesOfUser
Type
ProjectsOfSite
Type
Edges
Edges
Node
Node
Node
Relay enhanced Type
System
User
Site Site
Project Project Project
User
Type
Site
Type
SitesOfUser
Type
Project
Type
ProjectsOfSite
Type
Relay caching (UI)
User X Site A Project 1 Project 2
Relay cache
React view
Server
Schema
let schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'RootQueryType',
fields: () => ({
node: nodeField,
loggedUser: {
type: UserType,
description: 'The logged user',
resolve: (_, _, {rootValue: {loggedUser}}) => loggedUser,
},
})
}),
});
The User Type
let UserType = new GraphQLObjectType({
name: 'User',
interfaces: [nodeInterface],
fields: () => ({
id: globalIdField('User', user => user.id),
node: nodeField,
sites: {
type: UsersInSiteConnection,
description: 'All sites the logged user has access to',
resolve: (user, args, {rootValue: {db}}) =>
connectionFromPromisedArray(
db.getSitesForAUser(user),
args
),
},
})
});
Querying with REST
User
Site Site
Project Project Project
/user/14/all_my_sites
SELECT *
FROM users
LEFT JOIN sites
LEFT JOIN projects
WHERE ...
GraphQL is like an ORM
User
Site Site
so, beware!
query {
user(userId: "14") {
sites {
...
}
}
}
GraphQL is like an ORM
User
Site Site
Project Project Project
so, beware!
query {
user(userId: "14") {
sites {
projects {
...
}
}
}
}
GraphQL is like an ORM
User
Site Site
Project Project Project
so, beware!
resolve(...)
resolve(...)
SELECT *
FROM sites
WHERE ...
SELECT *
FROM projects
WHERE ...
n x
Topics
• How to fetch data from the server?
• How to write data to the server?
• How to handle URL routing?
• How to manage application (UI) state?
• How to propagate server push notifications?
Mutations
Server
Client
"Fat query"
Topics
• How to fetch data from the server?
• How to write data to the server?
• How to handle URL routing?
• How to manage application (UI) state?
• How to propagate server push notifications?
@relayContainer({
fragments: {
user: () => Relay.QL`
fragment on User {
firstName,
lastName,
}
`,
},
})
class UserFullName extends React.Component {
render() {
return <p>
{this.props.user.firstName} {this.props.user.lastName}
</p>;
}
}
Rendering in Relay
Query Configuration
Relay Container
Rendering in Relay
Component
Rendering in React-Router
/user/14/settings
/ <Application>
user/14 <User>
settings <Settings>
/ Q RC <Application>
user/14 Q RC <User>
Relay + Router NAIVE
/user/14/settings
settings Q RC <Settings>
Smart Root Container
/ RC <Application>
user/14 RC <User>
react-router-relay
/user/14/settings
settings RC <Settings>
Topics
• How to fetch data from the server?
• How to write data to the server?
• How to handle URL routing?
• How to manage application (UI) state?
• How to propagate server push notifications?
Relay + Redux
Relay

data store
Redux

data store
• Site Name
• Projects in a Site
• Dialog (open/close)
• New project form
Edit existing project form
???
Topics
• How to fetch data from the server?
• How to write data to the server?
• How to handle URL routing?
• How to manage application (UI) state?
• How to propagate server push notifications?
Keeping clients in sync
Server
Client
Cache
Client
Cache
Client
Cache
AKA: Live Queries
Subscriptions*
• GraphQL "subscription" operator
• Modeled after "events"
• Client must register/deregister
• Server must fire the right events in the right
places
* yet to come, as of Feb 2016
I like Relay and GraphQL
• Modeling this way is fun
• It Just Makes Sense®
• It scales well
RELAY IS
AWESOME but...
Limitations*
• Poor error handling
• ORM-like, hard to optimize DB access
• Root queries
• Subscriptions
* as of Feb 2016
Relay is COMPLEX
Is you app
COMPLEX too?
YES
Give it a try!
NO
Wanna
learn?
Not today, thanks
Stay with REST
and Redux
YES
Thanks!
@stefanomasini
video and slides

More Related Content

What's hot

LowlaDB intro March 2015
LowlaDB intro March 2015LowlaDB intro March 2015
LowlaDB intro March 2015
Teamstudio
 
Logging in The World of DevOps
Logging in The World of DevOps Logging in The World of DevOps
Logging in The World of DevOps
DevOps Indonesia
 
Airflow introduction
Airflow introductionAirflow introduction
Airflow introduction
Chandler Huang
 
Airflow tutorials hands_on
Airflow tutorials hands_onAirflow tutorials hands_on
Airflow tutorials hands_on
pko89403
 
Web App Prototypes with Google App Engine
Web App Prototypes with Google App EngineWeb App Prototypes with Google App Engine
Web App Prototypes with Google App Engine
Vlad Filippov
 
Introduction to Ruby Native Extensions and Foreign Function Interface
Introduction to Ruby Native Extensions and Foreign Function InterfaceIntroduction to Ruby Native Extensions and Foreign Function Interface
Introduction to Ruby Native Extensions and Foreign Function Interface
Oleksii Sukhovii
 
Introduction to RethinkDB and Horizon.js
Introduction to RethinkDB and Horizon.jsIntroduction to RethinkDB and Horizon.js
Introduction to RethinkDB and Horizon.js
chuck h
 
Sprint 42 review
Sprint 42 reviewSprint 42 review
Sprint 42 review
ManageIQ
 
Experience with C++11 in ArangoDB
Experience with C++11 in ArangoDBExperience with C++11 in ArangoDB
Experience with C++11 in ArangoDB
Max Neunhöffer
 
2016 foss4 g track: developing and implementing spatial etl processes with...
2016 foss4 g track:  developing and implementing  spatial etl processes  with...2016 foss4 g track:  developing and implementing  spatial etl processes  with...
2016 foss4 g track: developing and implementing spatial etl processes with...
GIS in the Rockies
 
Sprint 38 review
Sprint 38 reviewSprint 38 review
Sprint 38 review
ManageIQ
 
GraphQL is actually rest
GraphQL is actually restGraphQL is actually rest
GraphQL is actually rest
Jakub Riedl
 
Docker for mac & local developer environment optimization
Docker for mac & local developer environment optimizationDocker for mac & local developer environment optimization
Docker for mac & local developer environment optimization
Radek Baczynski
 
Orchestrating workflows Apache Airflow on GCP & AWS
Orchestrating workflows Apache Airflow on GCP & AWSOrchestrating workflows Apache Airflow on GCP & AWS
Orchestrating workflows Apache Airflow on GCP & AWS
Derrick Qin
 
RethinkDB - the open-source database for the realtime web
RethinkDB - the open-source database for the realtime webRethinkDB - the open-source database for the realtime web
RethinkDB - the open-source database for the realtime web
Alex Ivanov
 
Docker and Fluentd (revised)
Docker and Fluentd (revised)Docker and Fluentd (revised)
Docker and Fluentd (revised)
SATOSHI TAGOMORI
 
Serverless GraphQL. AppSync 101
Serverless GraphQL. AppSync 101Serverless GraphQL. AppSync 101
Serverless GraphQL. AppSync 101
Marcin Sodkiewicz
 
AIRflow at Scale
AIRflow at ScaleAIRflow at Scale
AIRflow at Scale
Digital Vidya
 
Apache Airflow
Apache AirflowApache Airflow
Apache Airflow
Knoldus Inc.
 
Apache airflow
Apache airflowApache airflow
Apache airflow
Purna Chander
 

What's hot (20)

LowlaDB intro March 2015
LowlaDB intro March 2015LowlaDB intro March 2015
LowlaDB intro March 2015
 
Logging in The World of DevOps
Logging in The World of DevOps Logging in The World of DevOps
Logging in The World of DevOps
 
Airflow introduction
Airflow introductionAirflow introduction
Airflow introduction
 
Airflow tutorials hands_on
Airflow tutorials hands_onAirflow tutorials hands_on
Airflow tutorials hands_on
 
Web App Prototypes with Google App Engine
Web App Prototypes with Google App EngineWeb App Prototypes with Google App Engine
Web App Prototypes with Google App Engine
 
Introduction to Ruby Native Extensions and Foreign Function Interface
Introduction to Ruby Native Extensions and Foreign Function InterfaceIntroduction to Ruby Native Extensions and Foreign Function Interface
Introduction to Ruby Native Extensions and Foreign Function Interface
 
Introduction to RethinkDB and Horizon.js
Introduction to RethinkDB and Horizon.jsIntroduction to RethinkDB and Horizon.js
Introduction to RethinkDB and Horizon.js
 
Sprint 42 review
Sprint 42 reviewSprint 42 review
Sprint 42 review
 
Experience with C++11 in ArangoDB
Experience with C++11 in ArangoDBExperience with C++11 in ArangoDB
Experience with C++11 in ArangoDB
 
2016 foss4 g track: developing and implementing spatial etl processes with...
2016 foss4 g track:  developing and implementing  spatial etl processes  with...2016 foss4 g track:  developing and implementing  spatial etl processes  with...
2016 foss4 g track: developing and implementing spatial etl processes with...
 
Sprint 38 review
Sprint 38 reviewSprint 38 review
Sprint 38 review
 
GraphQL is actually rest
GraphQL is actually restGraphQL is actually rest
GraphQL is actually rest
 
Docker for mac & local developer environment optimization
Docker for mac & local developer environment optimizationDocker for mac & local developer environment optimization
Docker for mac & local developer environment optimization
 
Orchestrating workflows Apache Airflow on GCP & AWS
Orchestrating workflows Apache Airflow on GCP & AWSOrchestrating workflows Apache Airflow on GCP & AWS
Orchestrating workflows Apache Airflow on GCP & AWS
 
RethinkDB - the open-source database for the realtime web
RethinkDB - the open-source database for the realtime webRethinkDB - the open-source database for the realtime web
RethinkDB - the open-source database for the realtime web
 
Docker and Fluentd (revised)
Docker and Fluentd (revised)Docker and Fluentd (revised)
Docker and Fluentd (revised)
 
Serverless GraphQL. AppSync 101
Serverless GraphQL. AppSync 101Serverless GraphQL. AppSync 101
Serverless GraphQL. AppSync 101
 
AIRflow at Scale
AIRflow at ScaleAIRflow at Scale
AIRflow at Scale
 
Apache Airflow
Apache AirflowApache Airflow
Apache Airflow
 
Apache airflow
Apache airflowApache airflow
Apache airflow
 

Viewers also liked

Blind river police department interview questions
Blind river police department interview questionsBlind river police department interview questions
Blind river police department interview questionsselinasimpson989
 
Québec city police department interview questions
Québec city police department interview questionsQuébec city police department interview questions
Québec city police department interview questionsselinasimpson989
 
Albuquerque police department interview questions
Albuquerque police department interview questionsAlbuquerque police department interview questions
Albuquerque police department interview questionsselinasimpson709
 
Kingston police department interview questions
Kingston police department interview questionsKingston police department interview questions
Kingston police department interview questionsselinasimpson989
 
Wrangell police department interview questions
Wrangell police department interview questionsWrangell police department interview questions
Wrangell police department interview questionsselinasimpson409
 
Clarksville police department interview questions
Clarksville police department interview questionsClarksville police department interview questions
Clarksville police department interview questionsselinasimpson119
 
Intro to Agile for Business
Intro to Agile for BusinessIntro to Agile for Business
Intro to Agile for Business
Darlene Pike
 
BVDW / IAB Germany - Leibniz Choco Crunchy
BVDW / IAB Germany - Leibniz Choco CrunchyBVDW / IAB Germany - Leibniz Choco Crunchy
BVDW / IAB Germany - Leibniz Choco Crunchy
IAB Europe
 
Cnh presentation
Cnh presentationCnh presentation
Cnh presentationdariush01
 
Truro police department interview questions
Truro police department interview questionsTruro police department interview questions
Truro police department interview questionsselinasimpson409
 
Unintended Consequences of Risk Reporting_GearyJoop Final_1
Unintended Consequences of Risk Reporting_GearyJoop Final_1Unintended Consequences of Risk Reporting_GearyJoop Final_1
Unintended Consequences of Risk Reporting_GearyJoop Final_1Joop Remmé Ph.D.
 
Betacam sp bvw50
Betacam sp bvw50Betacam sp bvw50
Betacam sp bvw50
Peter Hammill
 
Mirabel police department interview questions
Mirabel police department interview questionsMirabel police department interview questions
Mirabel police department interview questionsselinasimpson989
 
Sorular. büşra yandık.
Sorular. büşra yandık.Sorular. büşra yandık.
Sorular. büşra yandık.BüşRa Yndk
 
Презентация продукции Ренза
Презентация продукции РензаПрезентация продукции Ренза
Презентация продукции Ренза
Yana Kovba
 
Flora & fauna
Flora & faunaFlora & fauna
Flora & fauna
Jonathan Jeremiah
 
Family history project 3
Family history project 3Family history project 3
Family history project 3
CrystalCastillo143
 
Competencias con la tecnolog++¼a
Competencias con la tecnolog++¼aCompetencias con la tecnolog++¼a
Competencias con la tecnolog++¼a
caracol0614
 
Application Form of M3M Golf Estate
Application Form of M3M Golf EstateApplication Form of M3M Golf Estate
Application Form of M3M Golf Estate
Palm Olympia - Sam India
 

Viewers also liked (20)

Blind river police department interview questions
Blind river police department interview questionsBlind river police department interview questions
Blind river police department interview questions
 
Québec city police department interview questions
Québec city police department interview questionsQuébec city police department interview questions
Québec city police department interview questions
 
Albuquerque police department interview questions
Albuquerque police department interview questionsAlbuquerque police department interview questions
Albuquerque police department interview questions
 
Kingston police department interview questions
Kingston police department interview questionsKingston police department interview questions
Kingston police department interview questions
 
Wrangell police department interview questions
Wrangell police department interview questionsWrangell police department interview questions
Wrangell police department interview questions
 
Clarksville police department interview questions
Clarksville police department interview questionsClarksville police department interview questions
Clarksville police department interview questions
 
Intro to Agile for Business
Intro to Agile for BusinessIntro to Agile for Business
Intro to Agile for Business
 
BVDW / IAB Germany - Leibniz Choco Crunchy
BVDW / IAB Germany - Leibniz Choco CrunchyBVDW / IAB Germany - Leibniz Choco Crunchy
BVDW / IAB Germany - Leibniz Choco Crunchy
 
Cnh presentation
Cnh presentationCnh presentation
Cnh presentation
 
Truro police department interview questions
Truro police department interview questionsTruro police department interview questions
Truro police department interview questions
 
Unintended Consequences of Risk Reporting_GearyJoop Final_1
Unintended Consequences of Risk Reporting_GearyJoop Final_1Unintended Consequences of Risk Reporting_GearyJoop Final_1
Unintended Consequences of Risk Reporting_GearyJoop Final_1
 
Betacam sp bvw50
Betacam sp bvw50Betacam sp bvw50
Betacam sp bvw50
 
Mirabel police department interview questions
Mirabel police department interview questionsMirabel police department interview questions
Mirabel police department interview questions
 
Sorular. büşra yandık.
Sorular. büşra yandık.Sorular. büşra yandık.
Sorular. büşra yandık.
 
Презентация продукции Ренза
Презентация продукции РензаПрезентация продукции Ренза
Презентация продукции Ренза
 
Ra lecture - muscles of the face
Ra   lecture - muscles of the faceRa   lecture - muscles of the face
Ra lecture - muscles of the face
 
Flora & fauna
Flora & faunaFlora & fauna
Flora & fauna
 
Family history project 3
Family history project 3Family history project 3
Family history project 3
 
Competencias con la tecnolog++¼a
Competencias con la tecnolog++¼aCompetencias con la tecnolog++¼a
Competencias con la tecnolog++¼a
 
Application Form of M3M Golf Estate
Application Form of M3M Golf EstateApplication Form of M3M Golf Estate
Application Form of M3M Golf Estate
 

Similar to Exploring Relay land

Nick Raienko ''Service-oriented GraphQL''
Nick Raienko ''Service-oriented GraphQL''Nick Raienko ''Service-oriented GraphQL''
Nick Raienko ''Service-oriented GraphQL''
OdessaJS Conf
 
SharePoint REST vs CSOM
SharePoint REST vs CSOMSharePoint REST vs CSOM
SharePoint REST vs CSOM
Mark Rackley
 
GraphQL in an Age of REST
GraphQL in an Age of RESTGraphQL in an Age of REST
GraphQL in an Age of REST
Yos Riady
 
Running Airflow Workflows as ETL Processes on Hadoop
Running Airflow Workflows as ETL Processes on HadoopRunning Airflow Workflows as ETL Processes on Hadoop
Running Airflow Workflows as ETL Processes on Hadoop
clairvoyantllc
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1Mohammad Qureshi
 
Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...
Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...
Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...
confluent
 
Evolution of a cloud start up: From C# to Node.js
Evolution of a cloud start up: From C# to Node.jsEvolution of a cloud start up: From C# to Node.js
Evolution of a cloud start up: From C# to Node.js
Steve Jamieson
 
How to Contribute to Apache Usergrid
How to Contribute to Apache UsergridHow to Contribute to Apache Usergrid
How to Contribute to Apache Usergrid
David M. Johnson
 
Graphql usage
Graphql usageGraphql usage
Graphql usage
Valentin Buryakov
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop Overview
Shubhra Kar
 
API-Entwicklung bei XING
API-Entwicklung bei XINGAPI-Entwicklung bei XING
API-Entwicklung bei XING
Mark Schmidt
 
Building production websites with Node.js on the Microsoft stack
Building production websites with Node.js on the Microsoft stackBuilding production websites with Node.js on the Microsoft stack
Building production websites with Node.js on the Microsoft stack
CellarTracker
 
GraphQL the holy contract between client and server
GraphQL the holy contract between client and serverGraphQL the holy contract between client and server
GraphQL the holy contract between client and server
Pavel Chertorogov
 
Domain Driven Design Tactical Patterns
Domain Driven Design Tactical PatternsDomain Driven Design Tactical Patterns
Domain Driven Design Tactical Patterns
Robert Alexe
 
Introduction to CloudStack API
Introduction to CloudStack APIIntroduction to CloudStack API
Introduction to CloudStack API
Krunal Jain
 
Connecting the Dots: Kong for GraphQL Endpoints
Connecting the Dots: Kong for GraphQL EndpointsConnecting the Dots: Kong for GraphQL Endpoints
Connecting the Dots: Kong for GraphQL Endpoints
Julien Bataillé
 
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
Getting value from IoT, Integration and Data Analytics
 
A real-world Relay application in production - Stefano Masini - Codemotion Am...
A real-world Relay application in production - Stefano Masini - Codemotion Am...A real-world Relay application in production - Stefano Masini - Codemotion Am...
A real-world Relay application in production - Stefano Masini - Codemotion Am...
Codemotion
 
Serverless in-action
Serverless in-actionServerless in-action
Serverless in-action
Assaf Gannon
 

Similar to Exploring Relay land (20)

Nick Raienko ''Service-oriented GraphQL''
Nick Raienko ''Service-oriented GraphQL''Nick Raienko ''Service-oriented GraphQL''
Nick Raienko ''Service-oriented GraphQL''
 
SharePoint REST vs CSOM
SharePoint REST vs CSOMSharePoint REST vs CSOM
SharePoint REST vs CSOM
 
GraphQL in an Age of REST
GraphQL in an Age of RESTGraphQL in an Age of REST
GraphQL in an Age of REST
 
Running Airflow Workflows as ETL Processes on Hadoop
Running Airflow Workflows as ETL Processes on HadoopRunning Airflow Workflows as ETL Processes on Hadoop
Running Airflow Workflows as ETL Processes on Hadoop
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
 
Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...
Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...
Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...
 
Wider than rails
Wider than railsWider than rails
Wider than rails
 
Evolution of a cloud start up: From C# to Node.js
Evolution of a cloud start up: From C# to Node.jsEvolution of a cloud start up: From C# to Node.js
Evolution of a cloud start up: From C# to Node.js
 
How to Contribute to Apache Usergrid
How to Contribute to Apache UsergridHow to Contribute to Apache Usergrid
How to Contribute to Apache Usergrid
 
Graphql usage
Graphql usageGraphql usage
Graphql usage
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop Overview
 
API-Entwicklung bei XING
API-Entwicklung bei XINGAPI-Entwicklung bei XING
API-Entwicklung bei XING
 
Building production websites with Node.js on the Microsoft stack
Building production websites with Node.js on the Microsoft stackBuilding production websites with Node.js on the Microsoft stack
Building production websites with Node.js on the Microsoft stack
 
GraphQL the holy contract between client and server
GraphQL the holy contract between client and serverGraphQL the holy contract between client and server
GraphQL the holy contract between client and server
 
Domain Driven Design Tactical Patterns
Domain Driven Design Tactical PatternsDomain Driven Design Tactical Patterns
Domain Driven Design Tactical Patterns
 
Introduction to CloudStack API
Introduction to CloudStack APIIntroduction to CloudStack API
Introduction to CloudStack API
 
Connecting the Dots: Kong for GraphQL Endpoints
Connecting the Dots: Kong for GraphQL EndpointsConnecting the Dots: Kong for GraphQL Endpoints
Connecting the Dots: Kong for GraphQL Endpoints
 
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
 
A real-world Relay application in production - Stefano Masini - Codemotion Am...
A real-world Relay application in production - Stefano Masini - Codemotion Am...A real-world Relay application in production - Stefano Masini - Codemotion Am...
A real-world Relay application in production - Stefano Masini - Codemotion Am...
 
Serverless in-action
Serverless in-actionServerless in-action
Serverless in-action
 

Recently uploaded

Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
varshanayak241
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
ayushiqss
 
Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024
Sharepoint Designs
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Hivelance Technology
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 

Recently uploaded (20)

Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
 
Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 

Exploring Relay land

  • 2. Relay • Automatic fetching of data, no more Ajax • Colocation of queries and code • Caching • Good for API mashup • Why not?
  • 3. A new beginning • How to fetch data from the server? • How to write data to the server? • How to handle URL routing? • How to manage application (UI) state? • How to propagate server push notifications?
  • 4. Size of libraries LOC - *.js in github project as of Feb 2016 0 K 20 K 40 K 60 K 80 K 100 K React Relay GraphQL React
 Router Redux
  • 5. Popularity of libraries # stars in github project as of Feb 2016 0 K 8 K 16 K 24 K 32 K 40 K React Relay GraphQL React
 Router Redux
  • 6. Stars per Line Of Code AKA what's the smartest idea out there? :-) React Relay GraphQL React
 Router Redux
  • 7. Topics • How to fetch data from the server? • How to write data to the server? • How to handle URL routing? • How to manage application (UI) state? • How to propagate server push notifications?
  • 8. GraphQL • GOALS: • Space efficient (on the wire) • Computationally efficient (server side)
  • 10. GraphQL is a type system User Site Site Project Project Project User Type Site Type Project Type SitesOfUser Type ProjectsOfSite Type
  • 11. Edges Edges Node Node Node Relay enhanced Type System User Site Site Project Project Project User Type Site Type SitesOfUser Type Project Type ProjectsOfSite Type
  • 12. Relay caching (UI) User X Site A Project 1 Project 2 Relay cache React view Server
  • 13. Schema let schema = new GraphQLSchema({ query: new GraphQLObjectType({ name: 'RootQueryType', fields: () => ({ node: nodeField, loggedUser: { type: UserType, description: 'The logged user', resolve: (_, _, {rootValue: {loggedUser}}) => loggedUser, }, }) }), });
  • 14. The User Type let UserType = new GraphQLObjectType({ name: 'User', interfaces: [nodeInterface], fields: () => ({ id: globalIdField('User', user => user.id), node: nodeField, sites: { type: UsersInSiteConnection, description: 'All sites the logged user has access to', resolve: (user, args, {rootValue: {db}}) => connectionFromPromisedArray( db.getSitesForAUser(user), args ), }, }) });
  • 15. Querying with REST User Site Site Project Project Project /user/14/all_my_sites SELECT * FROM users LEFT JOIN sites LEFT JOIN projects WHERE ...
  • 16. GraphQL is like an ORM User Site Site so, beware! query { user(userId: "14") { sites { ... } } }
  • 17. GraphQL is like an ORM User Site Site Project Project Project so, beware! query { user(userId: "14") { sites { projects { ... } } } }
  • 18. GraphQL is like an ORM User Site Site Project Project Project so, beware! resolve(...) resolve(...) SELECT * FROM sites WHERE ... SELECT * FROM projects WHERE ... n x
  • 19. Topics • How to fetch data from the server? • How to write data to the server? • How to handle URL routing? • How to manage application (UI) state? • How to propagate server push notifications?
  • 21. Topics • How to fetch data from the server? • How to write data to the server? • How to handle URL routing? • How to manage application (UI) state? • How to propagate server push notifications?
  • 22. @relayContainer({ fragments: { user: () => Relay.QL` fragment on User { firstName, lastName, } `, }, }) class UserFullName extends React.Component { render() { return <p> {this.props.user.firstName} {this.props.user.lastName} </p>; } } Rendering in Relay
  • 24. Rendering in React-Router /user/14/settings / <Application> user/14 <User> settings <Settings>
  • 25. / Q RC <Application> user/14 Q RC <User> Relay + Router NAIVE /user/14/settings settings Q RC <Settings>
  • 26. Smart Root Container / RC <Application> user/14 RC <User> react-router-relay /user/14/settings settings RC <Settings>
  • 27. Topics • How to fetch data from the server? • How to write data to the server? • How to handle URL routing? • How to manage application (UI) state? • How to propagate server push notifications?
  • 28. Relay + Redux Relay
 data store Redux
 data store • Site Name • Projects in a Site • Dialog (open/close) • New project form Edit existing project form ???
  • 29. Topics • How to fetch data from the server? • How to write data to the server? • How to handle URL routing? • How to manage application (UI) state? • How to propagate server push notifications?
  • 30. Keeping clients in sync Server Client Cache Client Cache Client Cache AKA: Live Queries
  • 31. Subscriptions* • GraphQL "subscription" operator • Modeled after "events" • Client must register/deregister • Server must fire the right events in the right places * yet to come, as of Feb 2016
  • 32. I like Relay and GraphQL • Modeling this way is fun • It Just Makes Sense® • It scales well
  • 34. Limitations* • Poor error handling • ORM-like, hard to optimize DB access • Root queries • Subscriptions * as of Feb 2016
  • 35. Relay is COMPLEX Is you app COMPLEX too? YES Give it a try! NO Wanna learn? Not today, thanks Stay with REST and Redux YES