$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
はじめてのB2B SaaSデータモデリング in 吉祥寺.pm#18
Search
sasaki nobuya
May 17, 2019
Programming
6
10k
はじめてのB2B SaaSデータモデリング in 吉祥寺.pm#18
sasaki nobuya
May 17, 2019
Tweet
Share
More Decks by sasaki nobuya
See All by sasaki nobuya
エンジニアがプロダクトに向き合える組織づくり / Improve Product Development
mnc
6
4.2k
エンジニアがプロダクトに向き合うための意思決定カイゼン
mnc
4
2.2k
はじめてのB2B SaaSデータモデリング in Builderscon 2019
mnc
9
4.2k
AWSインフラ設計とDB設計からわかるB2B SaaSのおもしろさ
mnc
2
1.3k
B2B SaaS開発 Configurabilityとマルチテナントをがんばる α版編
mnc
2
630
本番データを安全に利用する
mnc
0
2.7k
Other Decks in Programming
See All in Programming
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
3
820
PaaSとSaaSの境目で信頼性と開発速度を両立する 〜TROCCO®︎のこれまでとこれから〜
gtnao
5
5.6k
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
140
競技プログラミングで 基礎体力を身につけよう / You can get basic skills through competitive programming
mdstoy
0
130
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
6
2.3k
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
3.7k
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
260
Vapor Revolution
kazupon
2
2.4k
[FlutterKaigi2024] Effective Form 〜Flutterによる複雑なフォーム開発の実践〜
chocoyama
0
3.9k
Java 23の概要とJava Web Frameworkの現状 / Java 23 and Java web framework
kishida
2
360
.NET 9アプリをCGIとして レンタルサーバーで動かす
mayuki
0
710
@nifty天気予報のフロントエンドを 実装するまで - NIFTY Tech Talk #22
niftycorp
PRO
0
120
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
24k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
27
2.1k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
400
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Gamification - CAS2011
davidbonilla
80
5k
Optimizing for Happiness
mojombo
376
70k
Fireside Chat
paigeccino
34
3k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Facilitating Awesome Meetings
lara
50
6.1k
Rails Girls Zürich Keynote
gr2m
94
13k
Making Projects Easy
brettharned
115
5.9k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Transcript
͡Ίͯͷ B2B SaaS σʔλϞσϦϯά A1Aגࣜձࣾ ࠤʑ Ԇ @__mnc90
Name ࠤʑ Ԇ Company A1Aגࣜձࣾ (ΤʔϫϯΤʔ) Career ৯ϩά → Speee
→ A1AΛڞಉۀ URL twitter.com/__mnc90 manchose.hatenablog.jp About ٕज़ͷऀͱͯ͠RFQΫϥυͷσʔλ ϕʔεઃܭͱΠϯϑϥߏஙɺ৫ͮ͘Γͳ ͲΛ୲
B2BͷऔҾΛϫϯϥϯΫ্ʹ Vision
B2BͷऔҾΛϫϯϥϯΫ্ʹ Vision A1A
ͬͨ΄͏͕Α͍͜ͱͳΜͯ ΄ͱΜͲͰ͖ͳ͍ͱ֮ޛ͢Δ ͬͨ΄͏͕Α͍͜ͱͷ5% ͘Β͍͔͠Ͱ͖ͳ͍ͱߟ͑Δ ελʔτΞοϓͷγεςϜ։ൃ
ͦΕͰఘΊͨΒμϝͳ෦ʹͷΈूத͢Δ ελʔτΞοϓͷγεςϜ։ൃ
Horizontal SaaSΑΓɺ͞Βʹਂ͍υϝΠϯ͕ࣝඞཁ Vertical SaaS
Vertical SaaS ۀքಛԽܕͷSaaSɻoctͳͲʢݐઃϓϩδΣΫτཧSaaSʣ Horizontal SaaS ৬छɾػೳʹಛԽͨ͠SaaSɻSalesforceSmartHRͳͲ Vertical SaaSͱHorizontal SaaS
“DBͷण໋ΞϓϦέʔγϣϯΑΓ͍” @soudai1025 ͞Μ DBͷॏཁੑ
ͬͨ΄͏͕ྑͦ͞͏ͳ͜ͱ TDD IaC GraphQL React TypeScript Serverless Kubernetes GitOps Apex
Atomic Design DDD σʔλ ϞσϦϯά
TDD IaC GraphQL React TypeScript Serverless Kubernetes GitOps Apex Atomic
Design DDD σʔλ ϞσϦϯά ͬͨ΄͏͕ྑͦ͞͏ͳ͜ͱ
͡ΊͯͷB2B SaaSͷσʔλϞσϦϯά
ۀߪങ෦͚ݟੵࠪఆͷSaaS RFQΫϥυ Product
None
1 Multi Tenancyͳςʔϒϧઃܭ 2 جຊNullΛڐՄ͠ͳ͍ 3 Πϕϯτͷநग़ൣғΛυϝΠϯͷத৺ʹߜΔ 4 ֎෦Ωʔͷ࣋ͪํ͔ΒσʔλͷϥΠϑαΠΫϧΛߟ͑Δ
1. Multi Tenancyͳςʔϒϧઃܭ
“ಉ͡γεςϜαʔϏεΛෳͷޓ͍ʹແؔͳར༻ ऀ͕ؒڞಉͰར༻͢ΔํࣜͰɺͦΕͧΕͷར༻ऀΞ Χϯτ໊ͳͲͷࢿ֨ใΛݩʹ۠ผ͞ΕɺͦΕͧΕ γεςϜ্ʹઐ༻ͷྖҬઃఆͳͲ͕༩͑ΒΕΔɻ” Multi Tenancy ग़ల e-words.jp/w/Ϛϧνςφϯτ.html
Ϣʔβʔاۀ͔Β͢Δͱ͕ࣗγεςϜΛಠར༻͍ͯ͠ΔΑ͏ʹݟ͑Δ ࣮ମSingle Source ෳͷςφϯτ͕1ͭͷγεςϜʹ૬Γ
Multi Tenancyͷํ๏ 1 ςφϯτຖʹDatabase or SchemaΛ 2 શςʔϒϧʹtenant_idΧϥϜΛ༻ҙ
Multi Tenancyͷํ๏ 1 ςφϯτຖʹDatabase or SchemaΛ 2 શςʔϒϧʹtenant_idΧϥϜΛ༻ҙ migration࣌ؒͷര૿ͳͲεέʔϥϏϦςΟʹ͋Γ
اۀؒऔҾܕSaaSͷMulti Tenancy ςφϯτΛͲͷ୯ҐͰ࡞͢Δ͔
αϓϥΠϠʔόΠϠʔͷςφϯτʹॴଐ͢Δ όΠϠʔA όΠϠʔB όΠϠʔC αϓϥΠϠD αϓϥΠϠE αϓϥΠϠD αϓϥΠϠG αϓϥΠϠF αϓϥΠϠF
αϓϥΠϠH tenant_id: 1 tenant_id: 2 tenant_id: 3
αϓϥΠϠʔόΠϠʔผςφϯτʹ͢Δ όΠϠʔA όΠϠʔB όΠϠʔC αϓϥΠϠF tenant_id: 1 tenant_id: 2 tenant_id:
3 tenant_id: 4 tenant_id: 5 tenant_id: 6 αϓϥΠϠD αϓϥΠϠE
σʔλͷॴ༗ऀ͔Βςφϯτͷ୯ҐΛߟ͑Δ
Α͋͘Δཁ ୀձޙͷσʔλͷཧআ
αϓϥΠϠʔ͕ड৴ͨ͠ݟੵใόΠϠʔͷୀձޙʹআ͞ΕΔ͖ʁ ϝʔϧΛϝλϑΝʔͱͯ͠ߟ͑Δ
ୀձޙαϓϥΠϠʔ͕ड৴ͨ͠σʔλΔ͖
ςφϯτͷ୯Ґ 1 αϓϥΠϠʔόΠϠʔͷςφϯτʹॴଐ͢Δ 2 αϓϥΠϠʔόΠϠʔผςφϯτʹ͢Δ
ςφϯτͷ୯Ґ 1 αϓϥΠϠʔόΠϠʔͷςφϯτʹॴଐ͢Δ 2 αϓϥΠϠʔόΠϠʔผςφϯτʹ͢Δ
1 όΠϠʔͷୀձޙͷσʔλআ͕όΠϠʔςφϯτ୯ҐͰ আ͢Δ͚ͩͰରԠ͕ྃ͢Δ 2 اۀຖʹݸผͷΞΧϯτཧϙϦγʔΛద༻Ͱ͖Δ ※اۀຖʹϙϦγʔ͕ҟͳΔ͜ͱ͕ଟ͍ 3 αϓϥΠϠʔςφϯτ͕ॏෳ͠ͳ͍ͨΊαϓϥΠϠʔʹͱ ͬͯσʔλͷҰݩཧ͕Ͱ͖Δͱ͍͏ϝϦοτΛఏڙͰ ͖Δ
ϝϦοτ
Example ݟੵґཔ(request_for_quotations)ʹରͯ͠ ݟੵճ(quotations)Λߦ͏߹
request_for_quotations ID produce_number 1 300 2 60 3 1200 ID
unit_price request_for_quotation_id 1 100 1 2 90 2 quotations ૉͳઃܭ
request_for_quotations ID produce_number 1 300 2 60 3 1200 ID
unit_price received_request_for_quotation_id 1 100 1 2 90 2 quotations σʔλͷॴ༗ऀΛߟ͑ͨઃܭ ID produce_number 1 300 2 60 3 1200 received_request_for_quotations ID unit_price request_for_quotation_id 1 100 1 2 90 2 received_quotations
2. جຊNULLΛڐՄ͠ͳ͍
NullableͳΧϥϜ͕͋Δ߹ ϥΠϑαΠΫϧͷҟͳΔσʔλ͕ ಉ͡ςʔϒϧʹೖ͍ͬͯΔ͜ͱ͕ଟ͍ NULLΛڐՄ͠ͳ͍ཧ༝
Example
materials ID name code 1 ϒϥέοτ 391001 2 εϥΠυϘοΫε ϒϥέοτ
NULL 3 ݻఆۚ۩ 369221
materials ID name 1 ϒϥέοτ 2 εϥΠυϘοΫε ϒϥέοτ 3 ݻఆۚ۩
ID material_id code 1 1 391001 2 3 369221 material_codes ͱΓ͋͑ͣNULLແ͘ͳͬͨʂ Ͱɺ͜ΕͰ͍͍ͷ͔ʁ
ͳͥNULLؚ͕·ΕΔͷͩΖ͏
1 material_codeΛͦͦཧ͍ͯ͠ͳ͍اۀ͕͋Δ 2 ࢼ࡞ͷஈ֊Ͱmaterial_codeΛൃ൪ͤͣʹݟੵґཔ Λߦ͍ɺίετͷ֓ࢉΛ֬ೝ͔ͯ͠ΒcodeΛൃ൪͢Δͱ ͍͏ۀϑϩʔ͕͋Δ
1 material_codeΛͦͦཧ͍ͯ͠ͳ͍اۀ͕͋Δ 2 ࢼ࡞ͷஈ֊Ͱmaterial_codeΛൃ൪ͤͣʹݟੵґཔ Λߦ͍ɺίετͷ֓ࢉΛ֬ೝ͔ͯ͠ΒcodeΛൃ൪͢Δͱ ͍͏ۀϑϩʔ͕͋Δ ࢼ࡞ͷݟੵґཔۀͱ͍͏Ϣʔεέʔε͕ͬͦ͝Γൈ͚͍ͯΔ
materials ID name 1 ϒϥέοτ 2 εϥΠυϘοΫε ϒϥέοτ 3 ݻఆۚ۩
ID material_id code 1 1 391001 2 3 369221 production_materials prototype_materials ID material_id 1 2
ϦιʔεͱΠϕϯτΛ۠ผ͢Δɻ ΠϕϯτۀͷهͰ͋Γɺ B2B SaaSͷத৺తଘࡏɻ 3. Πϕϯτͷநग़ൣғΛυϝΠϯͷத৺ʹߜΔ
͔͠͠ɺ͋ΒΏΔϦιʔεʹର͢Δߋ৽ΛΠϕ ϯτͱͯ͠ϞσϦϯάͯ͠͠·͏ͱ࣮ίετ ͕ߴ͘ͳͬͯ͠·͏ɻ ͦͷͨΊɺղܾ͍ͨ͠υϝΠϯͷத৺ʹҐஔ͢ ΔۀͷΈΠϕϯτͱͯ͠ϞσϦϯά͢Δɻ 3. Πϕϯτͷநग़ൣғΛυϝΠϯͷத৺ʹߜΔ ※ @kawasima͞ΜͷൃදͰֶͼ·ͨ͠
Example (materials)ͷߋ৽ʹ͍ͭͯߟ͑Δ
materials ID name updated_at 1 ϒϥέοτA 2019-05-16 09:10:11 2 ۩
2019-05-17 12:51:02 materialsςʔϒϧΛ ߋ৽͢Δ߹
ID name created_at material_id 1 ϒϥέοτA 2019-05-16 09:10:11 1 2
ϒϥέοτB 2019-05-26 11:42:11 1 materials ID name 1 ϒϥέοτ 2 ۩ material_updates ߋ৽Πϕϯτͷςʔϒϧ material_updatesΛ༻ҙ
ID name created_at material_id 1 ϒϥέοτA 2019-05-16 09:10:11 1 2
ϒϥέοτB 2019-05-26 11:42:11 1 materials ID name 1 ϒϥέοτ 2 ۩ material_updates Ռͨͯ͠ɺmaterialsͷߋ৽ۀ RFQΫϥυͷղܾ͢ΔυϝΠ ϯͷத৺ͳͷ͔ʁ
ID name created_at material_id 1 ϒϥέοτA 2019-05-16 09:10:11 1 2
ϒϥέοτB 2019-05-26 11:42:11 1 materials ID name 1 ϒϥέοτ 2 ۩ material_updates ҧ͏ͣɻ ͋͘·Ͱmaterialsͷߋ৽ཤྺͷཧجװγε ςϜ(ERP)Ͱߦ͍ͬͯΔɻ ͳΒɺmaterialsΛߋ৽ͯ͠͠·ͬͯྑ͍ɻ ͠CS༻ʹཤྺ͕΄͔ͬͨ͠߹ผͷσʔλ ετΞʹೖΕΔͳΓ͢ΕΑ͍ɻ
֎෦ΩʔΛ࣋ͭͱ͍͏͜ͱࢀরઌ ͷσʔλ͕ొ͞Εͳ͍ݶΓɺࢀরݩ ͷσʔλΛొͰ͖ͳ͍ͱ͍͏͜ͱɻ 4. ֎෦Ωʔͷ࣋ͪํ͔ΒσʔλͷϥΠϑαΠΫϧΛߟ͑Δ
֎෦Ωʔͷ࣋ͪํΛؒҧ͑ΔͱΞϓϦέʔγϣ ϯ͔Βͷσʔλొॲཧ͕ෳࡶʹͳͬͨΓɺ Ϣʔβʔͷۀʹଇ͞ͳ͍ػೳʹͳΔ͜ͱͰ ϢʔβϏϦςΟͷԼΛট͘͜ͱʹͳΔɻ ֎෦Ωʔͷ࣋ͪํͷॏཁੑ
Example ݟੵґཔ(request_for_quotations)ʹਤ໘ (diagram_images)Λఴͯ͠ૹ৴͢Δɻ
diagram_images ID name path request_for_quotation_id 1 ਤ໘_ver1 /images/xxxx/sample.jpeg 1 2
ਤ໘_ver2 /images/xxxx/sample2.jpeg 1 3 ਤ໘_ver3 /images/xxxx/sample3.jpeg 2 request_for_quotations ID produce_number 1 300 2 60
diagram_images ID name path request_for_quotation_id 1 ਤ໘_ver1 /images/xxxx/sample.jpeg 1 2
ਤ໘_ver2 /images/xxxx/sample2.jpeg 1 3 ਤ໘_ver3 /images/xxxx/sample3.jpeg 2 request_for_quotations ID produce_number 1 300 2 60 diagram_iamgesඞͣ request_for_quotationsͷ࡞ ޙʹొ͢Δʁ
ۀΛߟ͑Δ 1 ݟੵґཔ࡞લʹઃܭ෦͔Βਤ໘ϑΝΠϧ͚ͩڞ༗͞Ε Δͱ͍͏Ϣʔεέʔε 2 ਤ໘ϑΝΠϧΛΞοϓϩʔυͤͣʹϚελʔͱͯ͠ొ ͓͖ͯ͠ɺݟੵґཔ࣌ʹͦΕΛࢀরར༻͢Δͱ͍͏Ϣ ʔεέʔε
ۀΛߟ͑Δ 1 ݟੵґཔ࡞લʹઃܭ෦͔Βਤ໘ϑΝΠϧ͚ͩڞ༗͞Ε Δͱ͍͏Ϣʔεέʔε 2 ਤ໘ϑΝΠϧΛΞοϓϩʔυͤͣʹϚελʔͱͯ͠ొ ͓͖ͯ͠ɺݟੵґཔ࣌ʹͦΕΛࢀরར༻͢Δͱ͍͏Ϣ ʔεέʔε ඞͣ͠ݟੵґཔ࡞ޙʹਤ໘Λొ͢Δͱ͍͏Θ͚Ͱͳ͍
diagram_images ID name path 1 ਤ໘_ver1 /images/xxxx/sample.jpeg 2 ਤ໘_ver2 /images/xxxx/sample2.jpeg
3 ਤ໘_ver3 /images/xxxx/sample3.jpeg request_for_quotations ID produce_number 1 300 2 60 ID diagram_image_id request_for_quotation_id 1 1 1 2 2 1 3 3 2 attached_diagram_images diagram_imagesͱ request_for_quotationsͷ σʔλొॱෆಉʹͳͬͨ
υϝΠϯΤΩεύʔτ͔ΒͷใͷҾ͖ग़͠ํ ൪֎ฤ
1 ୟ͖ͱͳΔERDΛ࡞Δ 2 ERDͷؔ࿈͝ͱʹυϝΠϯʹదͨ͠ྫΛ༻͍ͳ͕Β࣮ମΛ өͰ͖͍ͯΔ͔υϝΠϯΤΩεύʔτʹ֬ೝ͢Δ
Example ֎෦Ωʔͷ࣋ͪํɺNULLͷՄೳੑɺςʔϒϧ ͷؔ࿈(1:n/1:1/n:n)ʹ͍ͭͯ1ͭͣͭྫΛग़ ͠ͳ͕Βʮ◦◦͕ෳʹͳΔ͜ͱͬͯ͋Γ·͢ ͔ʁʯͱ࣭͍ͯ͘͠ɻ
Example diagram_images ID path request_for_quotation_id 1 /images/xxxx/sample.jpeg 1 2 /images/xxxx/sample2.jpeg
1 3 /images/xxxx/sample3.jpeg 2 request_for_quotations ID produce_number 1 300 2 60
Example diagram_images ID path request_for_quotation_id 1 /images/xxxx/sample.jpeg 1 2 /images/xxxx/sample2.jpeg
1 3 /images/xxxx/sample3.jpeg 2 request_for_quotations ID produce_number 1 300 2 60 ਤ໘ϑΝΠϧͬͯݟੵґཔʹରͯ͠ෳ ఴ͢Δ͜ͱ͋Γ·͔͢ʁ me
Example diagram_images ID path request_for_quotation_id 1 /images/xxxx/sample.jpeg 1 2 /images/xxxx/sample2.jpeg
1 3 /images/xxxx/sample3.jpeg 2 request_for_quotations ID produce_number 1 300 2 60 ݟੵґཔΛ࡞͢Δલʹਤ໘ϑΝΠϧ͚ͩ ଞ෦͔Βڞ༗͞ΕΔ͜ͱ͋Γ·͔͢ʁ me
υϝΠϯΤΩεύʔτͷґཔͷํ υϝΠϯΤΩεύʔτ͔Β͢ΔͱɺʮͳΜͰͦ ΜͳʹΤοδέʔε·Ͱؾʹ͢ΔΜʁʯͱ͍͏ ؾ࣋ͪʹͳΓ͍͢ɻ ͔ͩΒɺʮؾ͍ͯͳ͍Τοδέʔε·Ͱؾͮ ͚Δ͜ͱ͕ࠓޙͷγεςϜ։ൃͷεϐʔυΛ ͘͢Δʯͱ͍͏͜ͱΛ͑ͯɺ͍ΖΜͳέʔε ͷ૾ΛΒ·ͤͯΒ͏Α͏ʹ͢Δɻ
We are hiring!