[èŠæž] Micro Frontends ð
Micro Frontends ãšã¯?ð€
çãããMicro Fronends(以äžãMFE)ããåç¥ã§ããããã説æããã£ããããŸããšãMicroservicesã®èãæ¹ãããã³ããšã³ããŸã§æ¡åŒµããèãæ¹ã§ããMicroservicesã¯ãããã¯ãšã³ãåŽã§é©çšãããäºäŸãããè³ã«ããŸãããããã³ããšã³ãã§ã®é©çšäºäŸã¯ãããŸãèããããšããããŸããã
åŸæ¥ãWebãµãŒãã¹éçºã§ã¯ã¢ããªã¹ãªæ§æããã¹ã¿ãŒãããŸãããããããèŠæš¡ãæ¡å€§ããã«ã€ããŠæ§ã ãªçç±ã«ãããããã³ããšã³ããšããã¯ãšã³ãã®åé¢ãããã¯ãšã³ãã®Microservicesåãè¡ãããŸãã
[翻蚳èšäº]ãã€ã¯ãããã³ããšã³ã
Microservicesåã«ãã£ãŠãScalabilityãAgilityãIndependencyãAvailabilityã®å€§å¹ ãªåäžãæåŸ ã§ããŸããããããäŸç¶ããã³ããšã³ãã¯ã¢ããªã¹ãªãŸãŸã§ããããã§ã次ã®ç»åã®ããã«ãMicroservicesãšåæ§ã«ããã³ããšã³ãã瞊(å°éé å)ã«åå²ããŸãã
[翻蚳èšäº]ãã€ã¯ãããã³ããšã³ã
ãã ããå šãŠã®WebãµãŒãã¹ãMFEã«ããå¿ èŠã¯ãããŸãããå çšã®èª¬æã«ããã£ãéããèŠæš¡ãæ¡å€§ããéã«MFEãæ€èšããå¿ èŠããããããå°ã»äžèŠæš¡ã®WebãµãŒãã¹ã§ã¯ææå°æ©ã§ãããŸãã次ã®ç»åã«ãããéããéçããŒãž(Webãµã€ã,Webããã¥ã¡ã³ã)ãåçããŒãž(Webã¢ããª)ã®äž¡æ¥µç«¯ã«äœçœ®ããWebãµãŒãã¹ã¯MFEã®é©çšããã®ã«ã¯äžåãã§ã(ãšæžããŠããŸã)ãäž¡æ¹ã®èŠçŽ ãæ±ããããWebãµãŒãã¹ã«MFEã圹ç«ã¡ãŸããMFEã®é©çšãããWebãµãŒãã¹äºäŸã§ã¯ãECãµã€ããæããããŸãã
Microfrontends: An approach to building Scalable Web Apps
â» MFEãšããèšèã¯ãMicro frontends | Technology Radar | ThoughtWorks ã®èšäºããçãŸããã¿ããã§ãã
â» Micro Frontends in Actionã«ãèšèŒãããŠããŸããããã®èãæ¹ã¯WebãµãŒãã¹ã察象ãšããŠããããã€ãã£ãã¢ããªã¯å¯Ÿè±¡ãšããŠããŸããã
å°å ¥äŒæ¥ðšâðŒð©âðŒ
å®çžŸäŒæ¥ãšããŠã¯ãIKEAãDAZNãSpotifyãªã©ãæããããŸããä»ã®äŸã¯ãMicro Frontends ã調ã¹ããã¹ãŠ ã«ãªã¹ãã¢ããããŠããŸãã®ã§ãèå³ãããæ¹ã¯ã芧ãã ããã
ã¡ãªããã»ãã¡ãªããð
MFEãå°å ¥ããããšã«ããã¡ãªããã»ãã¡ãªããã«ã€ããŠã(ãããã¯ã·ã§ã³å°å ¥çµéšç¡ãã®ç§ãåèŠã§)ç°¡åã«çŽ¹ä»ããŸããMicroservicesã®ã¡ãªããã»ãã¡ãªãããšäŒŒãŠãããšæããŸãã
ç§ãæãæ倧ã®ã¡ãªããã¯ãAgilityãšæããŸããèŠæš¡ãäžã»å€§èŠæš¡ãªWebãµãŒãã¹ãšãªããšãæ§ã
ãªæ¥åãã¡ã€ã³ãè©°ã蟌ãŸããŸããå
çšã®MFEã®äŸ(ECãµã€ã)ã§ãããšãæšèŠ(inspire)ãæ€çŽ¢(search)ãåå(product)ã泚æ(checkout)ãªã©ã«ããããŸãããããã1ã€ã®ããã³ããšã³ãã§æ§ç¯ãããšããã¡ã€ã³èšèšãé©åã«åé¢ã§ãããšããŠããéçºè
ã®æ¥åãã¡ã€ã³ç¥èãè¿œãã€ãããéçºã¹ããŒããäœäžããŠããŸããŸããçµæãç¹å®ã®éçºè
ã®å±äººåãå éããããã«ããã¯ãšãªããŸãã
ããã§ãããããæ¥åãã¡ã€ã³ãåå²ããããšã§ãéçºè
ã¯ããã ãã«ãã©ãŒã«ã¹ã§ããŸããçµæãéçºã¹ããŒãã¯ç¶æã§ããã¯ãã§ãã
ç§ãæãæ倧ã®ãã¡ãªããã¯ãIndependencyã®é£ããã ãšæããŸããäŸãã°ãUI/UXã®æéãšãªããã¶ã€ã³ã·ã¹ãã ãWebãµãŒãã¹ã«ãã£ããšããŠãããããã¹ãŠã®ããã³ããšã³ããžé©çšããªããã°ãããŸããããã®ãããå
šäœãéããäžè²«æ§ã®ããUI/UXã§ãããã©ããã®å質æ
ä¿ãé£ããã§ãã
ä»ã«ã¯ãããããŒã ã®ãã«ãããŒã«ãæ¹åãããšããŠããä»ã®ããŒã ã§ã¯ãã®æ©æµãåãããªãã£ãããã¢ããªã±ãŒã·ã§ã³èšèšã«ãããå
šäœå
±é(ã¢ã¯ã»ã¹å±¥æŽãã€ãã³ã管çãç¶æ
管çãªã©)éšåããã©ããããèããå¿
èŠããããŸãã
ãã¡ã Micro Frontends ã調ã¹ããã¹ãŠ#ProsCons ã«ãç°¡åã«ã¡ãªããã»ãã¡ãªãããæžããŠããŸãã®ã§ãæ°ã«ãªãæ¹ã¯ã芧ãã ããã
çµ±åãã¿ãŒã³ð®
MFEã§ã¯ãåããã³ããšã³ãã®ãã©ã°ã¡ã³ã(HTML)ããã©ã®ã¿ã€ãã³ã°ã§çµ±åããã®ããéèŠã§ããä»åã¯ãã®çµ±åãã¿ãŒã³ããã£ãã玹ä»ããŸãã
äŸãã°ã次ã®MFEã®äŸã§èšãã°ãTeam-ProductãTeam-CheckoutãTeam-Inspireã®3ã€ã®ããã³ããšã³ããã©ã°ã¡ã³ã(HTML)ããããŸããããããã©ã®ã¿ã€ãã³ã°ã§çµ±åããã®ãããã€ã³ãã§ãã
[翻蚳èšäº]ãã€ã¯ãããã³ããšã³ã
詳ããã¯ãMicro Frontends ã調ã¹ããã¹ãŠ#çµ±åãã¿ãŒã³ ãã芧ãã ããã
ãã«ãæçµ±åãã¿ãŒã³
ãã«ãæçµ±åãšã¯ãWebãµãŒãã¹ãPublishããåã®Buildã®æ®µéã§çµ±åãããã¿ãŒã³ã§ãããã®ãã¿ãŒã³ã¯ãbit.devããã䜿ãããŸãã
ãã©ã°ã¡ã³ããPackagingããPackagingããã©ã€ãã©ãªãimportãããŠbuild(çµ±å)ããŸããããšã¯ãbuildããéçã³ã³ãã³ããPublishãããã ãã«ãªããŸãã
ãµãŒããŒãµã€ãçµ±åãã¿ãŒã³
ãµãŒããŒãµã€ãçµ±åãšã¯ãWebãµãŒããŒåŽã®HTMLæ§ç¯æ®µéã§çµ±åãããã¿ãŒã³ã§ãããã®ãã¿ãŒã³ã¯ãSSIãESIãPodiumãTailorãAra-Frameworkãªã©ã䜿ãããŸãã
ãã©ã°ã¡ã³ããæäŸãããµãŒããŒãæºåããããããããã©ã°ã¡ã³ãæ å ±ãåéããå šäœã®ããŒãžHTMLãæ§ç¯ããŸãããããSSRãšããŠãŠãŒã¶ãŒãžæäŸããŸãã
github.com/Silver-birder/micro-frontends-sample-code-5
ãµãŒããŒãµã€ãã®ãµã³ãã«ã³ãŒãã¯ã次ã«ãŸãšããŠããŸãã
- Micro Frontends ãåŠãã ãã¹ãŠ
- Ara-Framework 㧠Micro Frontends with SSR
- Zalando tailor 㧠Micro Frontends with ( LitElement & etcetera)
ãŸãããµãŒããŒãµã€ããšããããEdgeã§ã®çµ±åãã¿ãŒã³ãäžèšãªã³ã¯ã§çŽ¹ä»ããŠããŸãã
â» ãªãããªã€ã³ã¿ã©ã¯ã·ã§ã³UIãè¡šçŸããããªãããµãŒããŒãµã€ããšã¯ã©ã€ã¢ã³ãã®Hydrationãããå¿ èŠããããŸãã
ã¯ã©ã€ã¢ã³ããµã€ãçµ±åãã¿ãŒã³
ã¯ã©ã€ã¢ã³ããµã€ãçµ±åãšã¯ããã©ãŠã¶åŽã¬ã³ããªã³ã°ã®æ®µéã§çµ±åãããã¿ãŒã³ã§ãããã®ãã¿ãŒã³ã¯ãiframeãWebComponentsãªã©ã䜿ãããŸãã
iframeã䜿ã£ãããŒãž(ãã©ã°ã¡ã³ã)åã蟌ã¿ãå šäœã®ããŒãžHTMLãçµ±åãããããWebComponentsã®ããã«ã«ã¹ã¿ã ãšã¬ã¡ã³ããå®çŸ©ããHTMLã¿ã°ã§ããŒãžãæ§æãããããŸãã
Micro Frontends â The Missing Piece Of The Puzzle In Feature Teams | BlueSoft
çµããã«ðšâð»ð©âð»
MFEã®ã¢ãããŒããå®éã«å°å ¥ããäŒæ¥ã¯ãåœå ã ãšãŸã æ¯èŒçå°ãªããã©ããã£ãå Žé¢ã§åœ¹ç«ã€ã®ãããŸãæ確ã§ã¯ãããŸããããŸããæžç±ãç¥èŠãå€ãã¯ãªããããæªç¥ãªé åãšæããŸãã
ãã ãäŸç¶ããã³ããšã³ããã¢ããªã¹ãªãäžã»å€§èŠæš¡ãªWebãµãŒãã¹ãéçšãããªãã°ãç¹ã«é²åãæ¿ããããã³ããšã³ãçéã®äžã§ããµãŒãã¹æäŸã®é床ãå質ãç¶æããã®ã¯é£ãããšæããŸããããã³ããšã³ããMicroservicesåããå Žé¢ã蚪ãããããããŸããããããªãšãã«ããã®èšäºãæãåºããŠé ããã°å¹žãã§ãã
â» ç¬ãèšã§ãããMFEã®æ§ç¯ã¢ãããŒããšããŠãEdge Worker + Web Components ã®çµã¿åãããæè¿å¥œã¿ã§ãã
é¢é£ãªã³ã¯ð
ç§ãæžããMFEé¢é£ã®èšäºã§ãããããããã°ã芧ãã ããã
- Micro Frontends ãåŠãã ãã¹ãŠ
- Micro Frontends ã調ã¹ããã¹ãŠ
- MFEé¢é£è³æãªã³ã¯é
- Ara-Framework 㧠Micro Frontends with SSR
- Zalando tailor 㧠Micro Frontends with ( LitElement & etcetera)
- Cloudflare Workers (Edge Workers) 㧠Micro Frontends
- github.com/Silver-birder/micro-frontends-on-kubernetes
- speakerdeck.com/silverbirder/micro-frontends-on-kubernetes-trial
- github.com/Silver-birder/think-micro-frontends
- github.com/Silver-birder/micro-frontends-sample-code
- github.com/Silver-birder/micro-frontends-sample-code-2
- github.com/Silver-birder/micro-frontends-sample-code-3
- github.com/Silver-birder/micro-frontends-sample-code-4
- github.com/Silver-birder/micro-frontends-sample-code-5
Discussion