Slide 1

Slide 1 text

Kotlin੡ͷGraphQLαʔόʔΛNode.jsͰϞδϡϥϞϊϦεԽ͍ͯ͠Δ࿩ JSConf JP 2023 @hokaccha

Slide 2

Slide 2 text

2 About Me Kazuhito Hokamura software engineer @hokaccha @hokaccha

Slide 3

Slide 3 text

@Ubie,Inc. 3 1. ϢϏʔͷϓϩμΫτʹ͍ͭͯ 2. ϢϏʔͷγεςϜͷݱঢ়ͱ՝୊ 3. ՝୊ʹରͯ͠औΓ૊ΜͰ͍Δ͜ͱ Table of Contents

Slide 4

Slide 4 text

@Ubie,Inc. 4 ࣗ෼ͷ঱ঢ়Λ౴͑Δ͚ͩͰɺ ࢀߟප໊΍ۙ͘ͷҩྍػؔ౳ ʮड਍ͷख͕͔Γʯ͕ௐ΂ΒΕΔ ҩྍݱ৔Ͱ࣮ࡍʹ࢖ΘΕ஁͑ΒΕͨAIΛɺੜ׆ऀ͕ద੾ͳ ҩྍʹ͔͔Δ໨҆ͱͯ͠։์͍ͯ͠·͢ (2020೥य़ʙ) ແྉͰ ୭Ͱ΋ ͍ͭͰ΋ ΄΅શͯͷ঱ঢ়Ͱˎ ˎ99% (1.3ສ௒)ͷ঱ঢ়ʹରԠ

Slide 5

Slide 5 text

@Ubie,Inc. 5 ໰਍ۀ຿ޮ཰Խ΍ೝ஌޲্ͳͲɺ ױऀ͞ΜͱͷίϛϡχέʔγϣϯઃܭΛ௨͡ɺ ਍࡯ͷ࣭޲্Λࢧԉ͢Δҩྍػؔ޲͚αʔϏε පӃɾΫϦχοΫͦΕͧΕͷχʔζʹ߹ΘͤͨҎԼͷΑ͏ͳ ػೳΛఏڙɾ։ൃ͍ͯ͠·͢ ϢϏʔAI໰਍ ϢϏʔϦϯΫ ϗʔϜϖʔδAI૬ஊ૭ޱ etc…

Slide 6

Slide 6 text

@Ubie,Inc. 6 2. ϢϏʔͷγεςϜͷݱঢ়ͱ՝୊ 3. ՝୊ʹରͯ͠औΓ૊ΜͰ͍Δ͜ͱ Table of Contents 1. ϢϏʔͷϓϩμΫτʹ͍ͭͯ

Slide 7

Slide 7 text

7 γεςϜΞʔΩςΫνϟ

Slide 8

Slide 8 text

8 ● ෳ਺ͷݴޠɾϑϨʔϜϫʔΫ͕ཚཱ͍ͯ͠Δ ○ Kotlin/Spring Boot, Rails, Node.js/NestJS, Go, Python ○ API ΋ GraphQL, gRPC, REST ͕ࠞࡏ ● ίʔυϕʔε͕େ͖͘ͳ͖ͬͯͯػೳͷڥք͕ᐆດʹͳΓɺΦʔφʔγοϓ͕ෆ໌ྎʹͳ͍ͬͯΔ ○ ಛʹϓϩμΫτଆͷαʔϏε͕ංେԽ͍ͯ͠Δ ● ݹ͔͘Β͋ΔϨΨγʔͳγεςϜ΍σʔλ͕ΞʔΩςΫνϟతͳ࿪Λ࢈ΜͰ͍Δ ○ ೝ஌ෛՙͷ্ঢɺอकίετͷ૿ՃͳͲʹΑΓੜ࢈ੑ͕௿Լ͍ͯ͠Δ γεςϜ্ͷ՝୊

Slide 9

Slide 9 text

9 ҰݴͰ͍͏ͱ ٕज़తෛ࠴͕ ੵΈ্͕͖ͬͯͨʂʂ

Slide 10

Slide 10 text

@Ubie,Inc. 10 3. ՝୊ʹରͯ͠औΓ૊ΜͰ͍Δ͜ͱ 2. ϢϏʔͷγεςϜͷݱঢ়ͱ՝୊ Table of Contents 1. ϢϏʔͷϓϩμΫτʹ͍ͭͯ

Slide 11

Slide 11 text

11 औΓ૊ΜͰ͍Δ͜ͱ ● ϦΞʔΩςΫςΟϯάʹΑΔٕज़తෛ࠴ͷղফ ○ ٕज़ελοΫͷ౷Ұ ○ ϞδϡϥϞϊϦεԽ ● ٕज़తෛ࠴Λίϯτϩʔϧ͢ΔͨΊͷऔΓ૊Έ ○ ٕज़ઓུɾํ਑ͷݴޠԽɾυΩϡϝϯςʔγϣϯ ○ Design DocʹΑΔઃܭϨϏϡʔͷϓϩηε੔උ ● ੜ࢈ੑࢦඪͷՄࢹԽͱ໨ඪͷઃఆ ○ Four KeysʹΑΔՄࢹԽ ○ ੜ࢈ੑվળͷͨΊͷઓུࡦఆ ← ࠓ೔͸͜͜ͷ࿩͠

Slide 12

Slide 12 text

12 ٕज़ελοΫͷ౷Ұ

Slide 13

Slide 13 text

13 γεςϜΞʔΩςΫνϟ To-Be

Slide 14

Slide 14 text

14 ٕज़ελοΫͷ౷Ұ ● όοΫΤϯυ͸ݴޠΛNode.js/Goʹ౷Ұ ○ ϓϩμΫτଆͷαʔϏε͸Node.jsɺϓϥοτϑΥʔϜଆ͸Goʹ͢Δ ○ Node.jsͷਪ঑ߏ੒͸ NestJS, Prisma ͋ͨΓ͕༗ྗ ● ϑϩϯτΤϯυ͸Next.jsʹ౷Ұ ○ ݱঢ়ͱ͋·Γဃ཭͸ͳ͍ͷͰٕज़ελοΫ͸େ෯ͳมߋ༧ఆ͸ͳ͠ ● API͸GraphQLʹ౷Ұ ○ gRPCͷซ༻Λߟ͍͕͑ͯͨGraphQLʹ౷Ұ͢Δํ޲Ͱݕ౼த

Slide 15

Slide 15 text

15 ϞδϡϥϞϊϦε ʢAI͕ߟ͑ΔϞδϡϥϞϊϦεͷਤʣ

Slide 16

Slide 16 text

16 ϞδϡϥϞϊϦε #ͱ͸ ϞϊϦεͳΞϓϦέʔγϣϯͷ಺෦Λػೳ୯ҐͰϞδϡʔϧʹ෼ׂͨ͠ΞʔΩςΫνϟ

Slide 17

Slide 17 text

17 Φʔφʔγοϓ͕େࣄ ʢAI͕ߟ͑ΔΦʔφʔγοϓʣ

Slide 18

Slide 18 text

18 Why ϞδϡϥϞϊϦε

Slide 19

Slide 19 text

19 v.s. ϚΠΫϩαʔϏε

Slide 20

Slide 20 text

20 v.s. ϚΠΫϩαʔϏε ● ωοτϫʔΫ௨৴͕ൃੜ͠ͳ͍ͨΊɺ৴པੑ΍ύϑΥʔϚϯεͳͲͷ఺Ͱ༗ར ● ಉҰίʔυϕʔεͳͷͰ։ൃ؀ڥͷߏங΍ΠϯςάϨʔγϣϯςετ͕༰қ ● ΤϥʔτϥοΩϯά΍؂ࢹɺτϥϒϧγϡʔςΟϯά͕γϯϓϧʹͳΔ ● ϞδϡʔϧͷڥքͷมߋʹରԠ͠΍͍͢ ϞδϡϥϞϊϦεͷϝϦοτ

Slide 21

Slide 21 text

21 v.s. ϚΠΫϩαʔϏε ● ػೳ୯ҐͰσϓϩΠ΍εέʔϦϯά͕Ͱ͖ͳ͍ ● ϓϩμΫτͷεέʔϧʹ൐ͬͯσϓϩΠύΠϓϥΠϯ΍CI͕ංେԽɺෳࡶԽ͢Δ ● ϞδϡʔϧͷڥքΛҡ࣋͢ΔͨΊͷίετ͕͔͔Δ ϞδϡϥϞϊϦεͷσϝϦοτ

Slide 22

Slide 22 text

22 ϢϏʔʹ͓͚ΔϞδϡϥϞϊϦε

Slide 23

Slide 23 text

23 ٕज़બఆ ● NestJS Ͱ GraphQL αʔόʔΛߏங͢Δ ● ORM ͸ Prisma ● ϑϨʔϜϫʔΫ΍ϥΠϒϥϦ͸͍ͨͬͯී௨ͷߏ੒

Slide 24

Slide 24 text

24 ύοέʔδ؅ཧ ● package.json ͕ϧʔτʹ͋Δ͚ͩͷී௨ͷ Node.js ϓϩδΣΫτ ● npm workspace ͱ Turborepo Λ࢖ͬͨ multi packages ߏ੒΋ݕ౼ ○ શͯͷϞδϡʔϧͰಉ͡ϥΠϒϥϦ΍ઃఆΛ࢖͏ͷͰ
 ϝϦοτ͕গͳ͍ ○ ෳࡶੑͷ૿ՃͳͲͷσϝϦοτ্͕ճΔͱ൑அͯ͠΍Ίͨ

Slide 25

Slide 25 text

25 Database, ORM ● DB͸ϞδϡʔϧؒͰڞ༗͢Δ ○ Ϟδϡʔϧ͝ͱʹDBͷεΩʔϚΛ෼͚Δʢ༧ఆʣ ● ςʔϒϧɾܕͷఆٛ͸Ϟδϡʔϧ͝ͱʹఆٛ͢Δ ● prisma-import Λ࢖ͬͯ݁߹͢Δ ○ github.com/ajmnz/prisma-import ● ϞδϡʔϧΛލ͍ͩjoin͸ڐՄ͠ͳ͍ ● ϞδϡʔϧΛލ͍ͩτϥϯβΫγϣϯ͸ݕ౼த

Slide 26

Slide 26 text

26 GraphQL ● GraphQLͷεΩʔϚ΋ؚΊ֤ͯϞδϡʔϧ͕؅ཧ͢Δ ● ΤϯτϦϙΠϯτͰεΩʔϚͱresolverΛ݁߹͢Δ

Slide 27

Slide 27 text

27 Ϟδϡʔϧؒ௨৴ ● exportͨؔ͠਺Λݺͼग़͚ͩ͢ ○ TypeScriptͷܕ͕͋ΔͷͰഁյతͳมߋʹΑͬͯյΕΔͱ͍͏͜ͱ͸ൃੜ͠ʹ͍͘͸ͣ ● ֎෦ͷϞδϡʔϧʹެ։͍ͯ͠Δػೳ͔Ͳ͏͔Λ໌ࣔͰ͖ΔΑ͏ʹ͢Δ ○ modules/module-name ௚Լͷ index.ts Ͱ export ͨ͠΋ͷҎ֎͸֎෦͔Β͸ར༻͠ͳ͍ ○ eslint ͷ import/no-internal-modules Λ࢖੍ͬͯݶ͢Δ

Slide 28

Slide 28 text

28 ςετ ● NestJSͷDIΛ࢖ͬͯࣗ਎ͷϞδϡʔϧҎ֎Λmock͢Δ ● ଞͷϞδϡʔϧͷมߋʹΑͬͯςετ͕յΕͳ͍

Slide 29

Slide 29 text

29 ·ͱΊ ● ϢϏʔ͸ϓϩμΫτ΍૊৫͕εέʔϧ͖ٕͯͯ͠ज़తෛ࠴Λฦ͍ͯ͠ΔϑΣʔζ ● औΓ૊Έͱٕͯ͠ज़ελοΫͷ౷Ұ΍ϞδϡϥϞϊϦεԽΛਐΊ͍ͯΔ ● ָ͍࣌͠ظͳͷͰڵຯΛ࣋ͬͯ͘Εͨํ͸੠͔͚͍ͯͩ͘͞ʂ

Slide 30

Slide 30 text

30 Ұॹʹ΍ͬͯ͘ΕΔํ ੵۃืूதʂ

Slide 31

Slide 31 text

31 UbieͰ͸ੵۃతʹ࠾༻Λߦ͍ͬͯ·͢ɻ͋ͳͨͷԠืΛ͓଴ ͍ͪͯ͠·͢ɻ ΧδϡΞϧ໘ஊԠืϑΥʔϜ We Are Hiring!