GraphQL を活用したスキーマ駆動開発の実践 / schema-driven development with GraphQL
by
qsona
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
GraphQL Λ׆༻ͨ͠ εΩʔϚۦಈ։ൃͷ࣮ફ @qsona 2021-09-08 MIDAS TECH STUDY #2
Slide 2
Slide 2 text
whoami • @qsona • Web Engineer at Quipper Ltd • Microservices / Rails / Node.js / GraphQL
Slide 3
Slide 3 text
ࠓճͷςʔϚ: ϑϩϯτΤϯυ։ൃޮԽ
Slide 4
Slide 4 text
։ൃʹ͓͚ΔʮޮԽʯͱ?
Slide 5
Slide 5 text
Ϧιʔεޮͱϑϩʔޮ • ΞδϟΠϧ։ൃͷจ຺ͰΑ͘ొ͢Δ֓೦ • ʮޮʯ(Efficiency) Λೋͭͷଆ໘͔Βఆ͍ٛͯ͠Δ
Slide 6
Slide 6 text
Ϧιʔεޮ γεςϜ։ൃͷจ຺ʹ͓͍ͯɺେࡶʹ͍͏ͱ: • ਓతϦιʔεͷྔ (ਓɾ) ʹରͯ͠ɺੜΈग़ͤΔػೳͷྔ • Ϧιʔεޮ͕ѱ͍ྫ • ϑϩϯτΤϯυͷ։ൃ͕։࢝Ͱ͖Δͷɺ όοΫΤϯυͷ։ൃ͕ऴΘ͔ͬͯΒ => όοΫΤϯυͷ։ൃྃ·ͰɺϑϩϯτΤϯδχΞ͕Ջ͍ͯ͠Δ
Slide 7
Slide 7 text
ϑϩʔޮ γεςϜ։ൃͷจ຺ʹ͓͍ͯɺେࡶʹ͍͏ͱ: • Ϣʔβʔʹػೳ͕ϦϦʔε͞ΕΔ·Ͱͷɺ࣌ؒͷ͞ • ϦϦʔε͞Εͳ͍ͱՁʹͳΒͳ͍ɻ ՁʹͳΔ·Ͱͷ͕͍ͪ࣌ؒͱޮ͕ѱ͍ɺͱ͍͏ߟ͑ํ • ϑϩʔޮ͕ѱ͍ྫ • ػೳͷ͏ͪόοΫΤϯυͷ։ൃ͕ͨ͠ɺϑϩϯτΤϯυͷ։ൃ͕·ͩɻ όοΫΤϯυࢹͰϦϦʔεͪͷঢ়ଶ͕͘ଓ͍͍ͯΔ
Slide 8
Slide 8 text
εΩʔϚۦಈ։ൃͱ ։ൃޮ
Slide 9
Slide 9 text
લఏɾԾఆ • ࠷ۙͷΞϓϦέʔγϣϯ։ൃ͍͠ શһ͕ͯ͢ͷྖҬΛ͜ͳ͢ͷࠔ • େ͖͘ϑϩϯτΤϯυɾόοΫΤϯυͰ εΩϧηοτ͕͔ΕΔʹ͋Δ • ࠓճ όοΫΤϯυνʔϜ ͱ ϑϩϯτΤϯυνʔϜ ͕ଘࡏ͢Δঢ়گΛԾఆ͢Δ
Slide 10
Slide 10 text
ґଘ͕ؔ͋Δ • ґଘؔ ϑϩϯτΤϯυ => όοΫΤϯυ • όοΫΤϯυ͕ఏڙ͢Δ API Λ ϑϩϯτΤϯυ͕ར༻͢Δ • ૉʹߟ͑ΔͱɺόοΫΤϯυ => ϑϩϯτΤϯυͷॱͰ։ൃ ͢Δ͜ͱʹͳΔ => ޮ͕ѱ͍ (࣍ϖʔδ͔Βઆ໌)
Slide 11
Slide 11 text
(1) ϑϩʔޮ͕ѱ͍ • όοΫΤϯυͰ࣮͞Εͨػೳ͕ɺ σϓϩΠ͞ΕΔ·Ͱʹ ͕ͪ࣌ؒͰ͖Δ
Slide 12
Slide 12 text
(2) Ϧιʔεޮ͕ѱ͍ • ϑϩϯτΤϯδχΞ͕࣮ͪͷؒɺՋʹͳͬͯ͠·͏
Slide 13
Slide 13 text
(2) Ϧιʔεޮ͕ѱ͍ • ෳͷػೳΛॱʹճ͢͜ͱͰվળՄೳ • ͕ɺݱ࣮ʹ͜Μͳʹ៉ྷʹ͍͔ͳ͍ • όοΫΤϯυͷ࣮͕গ͠ͰΕΔͱɺϑϩϯτΤϯυͷՋ͕ൃੜͯ͠͠·͏
Slide 14
Slide 14 text
ͦ͜Ͱ εΩʔϚۦಈ։ൃ
Slide 15
Slide 15 text
εΩʔϚۦಈ։ൃ • ͡Ίʹ API ͷεΩʔϚΛఆΊɺ ϑϩϯτΤϯυ - όοΫΤϯυ ؒͰ߹ҙ͢Δ • ϑϩϯτΤϯυɺόοΫΤϯυͷ API ͷ࣮Λͨͣʹ API εΩʔϚΛར༻࣮ͯ͠։࢝͢Δ • ΫϥΠΞϯτ্Ͱͷ੩తܕɺϞοΫαʔόʔͳͲ͕ಘΒΕɺ ͋Δఔෆ߹ͳ͘։ൃͰ͖Δ
Slide 16
Slide 16 text
εΩʔϚۦಈ։ൃͱ։ൃޮ • (1) ϑϩʔޮͷد༩ • (2) Ϧιʔεޮͷد༩
Slide 17
Slide 17 text
(1) ϑϩʔޮͷد༩ • όοΫΤϯυͱϑϩϯτΤϯυ͕ฒྻͰ։ൃͰ͖ΔͷͰɺ ϑϩϯτΤϯυͷͪ࣌ؒΛͳͤ͘Δ
Slide 18
Slide 18 text
(2) Ϧιʔεޮͷد༩ • όοΫΤϯυͱϑϩϯτΤϯυͷ։ൃͷґଘؔΛͳͤ͘ΔͷͰɺ ͦΕͧΕͷ։ൃͷॱং͕ࣗ༝ʹͳΔ • ݁Ռͱͯ͠ɺϦιʔεޮΛ͍ٻΊΔ͜ͱ͕ՄೳʹͳΔ
Slide 19
Slide 19 text
ελσΟαϓϦʹ͓͚Δ GraphQLɾεΩʔϚۦಈ։ൃͷ ࣮ફࣄྫ
Slide 20
Slide 20 text
No content
Slide 21
Slide 21 text
৽ن։ൃϓϩδΣΫτʹ͍ͭͯ • ։ൃ͢Δͷ • iOS / Android / PC Web Apps • Backend APIs • ίϯςϯπΛཧ͢ΔγεςϜ • ։ൃظؒ: > 1 • ։ൃऀͷਓ: > 10ਓ
Slide 22
Slide 22 text
৽ن։ൃʹ GraphQL Λશ໘࠾༻ • client => gateway => backends શମͰ GraphQL Λ࠾༻ • gateway schema stitching Λར༻͍ͯ͠Δ • ͦͷଞར༻ٕज़ • Ruby on Rails • Node.js + TypeScript + Apollo Server + Prisma 2 • React, Apollo Client
Slide 23
Slide 23 text
εΩʔϚۦಈ։ൃͷԸܙ • ίϛϡχέʔγϣϯͷϩε͕গͳ͘ɺ ҆ఆͯ͠։ൃΛਐΊΒΕͨ • ϦιʔεޮΛٻΊɺ backend / frontend ͦΕͧΕ ~9ϲ݄ؒ ಠཱͯ͠։ൃͨ͠ • ܨ͗͜ΈεϜʔζ • 1िؒͰશ෦ܨ͗͜Έྃͨ͠
Slide 24
Slide 24 text
εΩʔϚۦಈ։ൃʹ GraphQL Λར༻͢ΔϝϦοτ • εΩʔϚͱ࣮͕ဃ͍͢͠ͱɺܨ͗͜Έ࣌ʹൃ֮͢Δ͕૿͑ɺ࣌ؒ ͕͔͔Δ (=ޮ͕Լ͕Δ) • GraphQL Λར༻͢ΔͱɺαʔόʔɾΫϥΠΞϯτํͰ εΩʔϚͱ࣮ͷဃ͕ى͖ʹ͍͘ • αʔόʔ: εΩʔϚΛຬͨ͞ͳ͍ϨεϙϯεΛฦͦ͏ͱ͢ΔͱΤϥʔʹͳΔ • ΫϥΠΞϯτ: ੩తܕΛࣗಈੜ͠ɺར༻Ͱ͖Δ
Slide 25
Slide 25 text
ฐνʔϜʹ͓͚Δ GraphQL εΩʔϚۦಈ։ൃͷϑϩʔ • εΩʔϚ࠷ऴతʹ GraphQL Gateway ʹఆٛ͞ΕΔɻ ͜Ε֤ Backend Service ʹఆٛ͞Εͨͷ͕ू͞Ε͍ͯΔ • ϑϩϯτΤϯυओಋͰεΩʔϚΛॻ͘ͱ͖ Ұ୴ GraphQL Gateway αʔϏεʹॻ͘ • ϞοΫαʔόʔͱͯ͠ఏڙͰ͖Δ • ࣮࣌ʹɺεΩʔϚఆٛΛ֤όοΫΤϯυαʔϏεʹҠಈ͢Δ • ※ ͜ͷ෦Ͱͪΐͬͱͨ͠Έ͋Γ (ӈͷπΠʔτ)
Slide 26
Slide 26 text
Q. ୭͕εΩʔϚΛॻ͖͔͘? • A. ͦͷػೳͷಛੑʹΑΔ • ࠷ऴతʹ߹ҙͰ͖ΕΑ͍ɻ୭͕ॻ͍ͯΑ͍ • ϑϩϯτΤϯυΤϯδχΞϓϩμΫτϚωʔδϟʔ͕εΩʔϚΛॻ͚Δͱɺ ϑϩʔޮԽʹͭͳ͕Δ • ։ൃͷग़ൃͰ͋Δʮཁٻʯʹ͍ۙ • όοΫΤϯυ࣮͕͍͠ػೳɺόοΫΤϯυΤϯδχΞ͕ఆٛͨ͠΄͏͕ྑ͍ • ࣮Ͱ͖ͳ͍εΩʔϚʹҙຯ͕ͳ͍ͨΊ
Slide 27
Slide 27 text
Q. ୭͕εΩʔϚΛॻ͖͔͘? • εΩʔϚઃܭʹίπ͕͋Γɺ୭͕ॻ͘ʹͯ͠ମಘ͢Δඞཁ͕͋Δ • ը໘༷ͱDBઃܭͷؒʹ͋ΔʮϦιʔεʯΛ͏·͘ଊ͑Δ • GraphQL ͷ߹ͦΕΛ GraphQL Type ͱͯ͠දݱ͢Δ • ͭ·ΓɺϑϩϯτΤϯυΤϯδχΞͰ͋ΕDBઃܭΛΠϝʔδ͠ɺ όοΫΤϯυΤϯδχΞͰ͋Εը໘࣮ΛΠϝʔδͰ͖Δͱ͏·͘ ͍͖͍͢
Slide 28
Slide 28 text
·ͱΊ • εΩʔϚۦಈ։ൃΛ࣮ફ͢Δ͜ͱͰɺ Ϧιʔεޮ·ͨϑϩʔޮΛߴΊΔ͜ͱ͕Ͱ͖Δ • GraphQL Λར༻͢Δͱɺͭͳ͗͜Έͷਫ਼ඇৗʹߴ͍ • εΩʔϚ୭͕ॻ͍ͯΑ͍ɻ ରػೳͷಛੑɺνʔϜͷঢ়گͳͲʹΑͬͯม͑ΔͱΑ͍
Slide 29
Slide 29 text
We're hiring! • GraphQL, Microservices ͪΖΜ ϑϩϯτΤϯυ͔ΒόοΫΤϯυ·Ͱ ͍ٕज़ʹ৮ΕΒΕΔػձ͋Γ • ·ͣΧδϡΞϧ໘ஊ͔Βɺͥͻ͝Ԡื͍ͩ͘͞ 😁