Slide 1

Slide 1 text

© 2023 Reiwa Travel, Inc.
 NEWT + GraphQL GraphQL Schema Design Principles adopted by NEWT

Slide 2

Slide 2 text

© 2023 Reiwa Travel, Inc.
 Profile ● Nationality: Argentinian ● Language: Spanish, English, Japanese ● Full Stack Developer (+10y) Career ● 󰎆 2006~: Freelance ● 󰎆 2008~: PowerSite ( CEO/CTO ) ○ Email Marketing SaaS ● 󰏦 2015~: Travelience ( CTO ) ○ Tour Guide Marketplace ● 󰏦 2021~: ReiwaTravel ( Senior Engineer ) ○ Backend → Frontend → Backend Senior Engineer / Product-Dev Rodrigo Ramirez

Slide 3

Slide 3 text

© 2023 Reiwa Travel, Inc.
 NEWT + GraphQL GraphQL Schema Design Principles adopted by NEWT

Slide 4

Slide 4 text

AGENDA
 © 2023 Reiwa Travel, Inc.
 1. NEWT Stack 2. One Graph 3. Demand Oriented Schema Design

Slide 5

Slide 5 text

© 2023 Reiwa Travel, Inc.
 NEWT Stack

Slide 6

Slide 6 text

© 2023 Reiwa Travel, Inc.
 NEWT Stack

Slide 7

Slide 7 text

© 2023 Reiwa Travel, Inc.
 NEWT Stack

Slide 8

Slide 8 text

© 2023 Reiwa Travel, Inc.
 NEWT Stack

Slide 9

Slide 9 text

© 2023 Reiwa Travel, Inc.
 NEWT Stack

Slide 10

Slide 10 text

© 2023 Reiwa Travel, Inc.
 NEWT Stack

Slide 11

Slide 11 text

© 2023 Reiwa Travel, Inc.
 NEWT Stack

Slide 12

Slide 12 text

© 2023 Reiwa Travel, Inc.
 NEWT Stack

Slide 13

Slide 13 text

© 2023 Reiwa Travel, Inc.
 NEWT Stack NEWT + GraphQL

Slide 14

Slide 14 text

© 2023 Reiwa Travel, Inc.
 NEWT + GraphQL NEWT Stack

Slide 15

Slide 15 text

© 2023 Reiwa Travel, Inc.
 NEWT + GraphQL NEWT Stack

Slide 16

Slide 16 text

© 2023 Reiwa Travel, Inc.
 NEWT + GraphQL NEWT Stack

Slide 17

Slide 17 text

© 2023 Reiwa Travel, Inc.
 NEWT + GraphQL NEWT Stack

Slide 18

Slide 18 text

© 2023 Reiwa Travel, Inc.
 One Graph

Slide 19

Slide 19 text

© 2023 Reiwa Travel, Inc.
 One Graph ● Single Endpoint ● Central Data Catalog ● Portability Across Teams ● Unified Access Control

Slide 20

Slide 20 text

© 2023 Reiwa Travel, Inc.
 One Graph Extending the Graph Apollo Federation, Schema Stitching, Schema Merging, …

Slide 21

Slide 21 text

© 2023 Reiwa Travel, Inc.
 One Graph Extending the Graph Apollo Federation, Schema Stitching, Schema Merging, …

Slide 22

Slide 22 text

© 2023 Reiwa Travel, Inc.
 One Graph Apollo Federation, Schema Stitching, Schema Merging, … Extending the Graph

Slide 23

Slide 23 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design

Slide 24

Slide 24 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Key Points: ① Design Schema around client-specific use cases ② Move business logic to the Backend ③ Close collaboration with Client side engineers Benefits: ● Simplified Schema ● Reduce Over-fetching ● Improved Developer Experience ● Easier to Understand and Maintain ● Reduce QA cost

Slide 25

Slide 25 text

© 2023 Reiwa Travel, Inc.
 ① Design Schema around client-specific use cases Demand Oriented Schema Design

Slide 26

Slide 26 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design

Slide 27

Slide 27 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design

Slide 28

Slide 28 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design

Slide 29

Slide 29 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design

Slide 30

Slide 30 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design

Slide 31

Slide 31 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design

Slide 32

Slide 32 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design

Slide 33

Slide 33 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design

Slide 34

Slide 34 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design

Slide 35

Slide 35 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design

Slide 36

Slide 36 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design

Slide 37

Slide 37 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design

Slide 38

Slide 38 text

© 2023 Reiwa Travel, Inc.
 ② Move Business Logic to the Backend Demand Oriented Schema Design

Slide 39

Slide 39 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card

Slide 40

Slide 40 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card / Spoken Languages

Slide 41

Slide 41 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card / Spoken Languages

Slide 42

Slide 42 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design ● Logic needs to be handled on each client (Web, iOS, Android) ● More data than needed is requested from the API ● QA cost increase to confirm implementation on each client Hotel Card / Spoken Languages

Slide 43

Slide 43 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card / Spoken Languages

Slide 44

Slide 44 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card / Spoken Languages

Slide 45

Slide 45 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design ● Logic is hidden on the backend ● Client implementation is simplified ● API tests can be written to confirm use cases ● QA cost decrease Hotel Card / Spoken Languages

Slide 46

Slide 46 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card / Spoken Languages

Slide 47

Slide 47 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card

Slide 48

Slide 48 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card / Price

Slide 49

Slide 49 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card / Price

Slide 50

Slide 50 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design ● The client depend on 2 fields to display the price ● The format needed to be coordinated between clients and places ● QA cost increase Hotel Card / Price

Slide 51

Slide 51 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card / Price

Slide 52

Slide 52 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card / Price

Slide 53

Slide 53 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design ● Only one field is needed to display the price ● The format is controlled by the Backend, and consistency between apps is simple ● QA cost decrease Hotel Card / Price

Slide 54

Slide 54 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card / Price

Slide 55

Slide 55 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card

Slide 56

Slide 56 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card / Wishlist

Slide 57

Slide 57 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card / Wishlist

Slide 58

Slide 58 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design ● To know if a Hotel is included inside the authenticated user Wishlist, a different query is needed ● The client needs to control the logic ● QA cost increase ● … Hotel Card / Wishlist

Slide 59

Slide 59 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card / Wishlist

Slide 60

Slide 60 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card / Wishlist

Slide 61

Slide 61 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design ● Things that always need to be displayed together are together ● Client logic is simplified, and business logic is hidden on the backend ● QA cost decreases ● … Hotel Card / Wishlist

Slide 62

Slide 62 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Hotel Card / Wishlist

Slide 63

Slide 63 text

© 2023 Reiwa Travel, Inc.
 ③ Close collaboration with Client side engineers Demand Oriented Schema Design

Slide 64

Slide 64 text

© 2023 Reiwa Travel, Inc.
 Demand Oriented Schema Design Close collaboration with Client side engineers ● Prioritize client needs, but not just one client's needs ● Client teams should be consulted early on in the API design process. ● Schema should be approved by client teams before implementation Spec Check Schema Proposal Mock Implementation Final Implementation Backend + Client engineers involved in all process

Slide 65

Slide 65 text

© 2023 Reiwa Travel, Inc.
 1) One Graph: ● 1 schema / 1 endpoint 2) Demand Oriented Schema Design: ● Schema Design based on Client use cases ● Reduce client-side complexity by moving Business Logic to the backend ● Close collaboration with Client side engineers Summary

Slide 66

Slide 66 text

Thank you!
 © 2023 Reiwa Travel, Inc.
 @xpromx engineering.reiwatravel.co.jp