Slide 1

Slide 1 text

GraphQL and Relay Lightning Talk at JSConf 2015

Slide 2

Slide 2 text

About me • Dafeng Guo, CTO of strikingly.com • Strikingly • simplest website builder • probably the largest React.js user in China

Slide 3

Slide 3 text

GraphQL What the hell is it?

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

“REST is perfect!” - A random backend engineer

Slide 7

Slide 7 text

REST-ful API Sometimes Sucks • Round trip for complicated objects • Variable fields • Custom endpoint - not REST-ful design • Backend engineer dependency - slow down iterations

Slide 8

Slide 8 text

GraphQL • Server-side engineers published a type system • Client-side engineers use GraphQL as a unified query interface • No more adhoc endpoints • Product changes are faster

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Are we writing SQL in the client?! NO!

Slide 11

Slide 11 text

GraphQL Query JSON Response

Slide 12

Slide 12 text

GraphQL • REST-ful sometimes sucks • GraphQL is declarative • GraphQL allows product engineers to iterate faster • Draft spec was released

Slide 13

Slide 13 text

Relay GraphQL on React

Slide 14

Slide 14 text

Component • Component is at the core of React • Reusing any component, we are reusing • HTML - React • Javascript - React • CSS - Maybe React? • Data fetching - Relay

Slide 15

Slide 15 text

Relay • Allows you to define the data format the component needs using GraphQL • Relay automatically fetch the data • Supports nested/composite components

Slide 16

Slide 16 text

Relay • Solving the data fetching problem • Supports composite components • Makes component reuse possible • Will be open sourced in August

Slide 17

Slide 17 text

Thanks!