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 ͸΋ͪΖΜ
 ϑϩϯτΤϯυ͔ΒόοΫΤϯυ·Ͱ
 ޿͍ٕज़ʹ৮ΕΒΕΔػձ͋Γ • ·ͣ͸ΧδϡΞϧ໘ஊ͔Βɺͥͻ͝Ԡื͍ͩ͘͞ 😁