[{"data":1,"prerenderedAt":274},["ShallowReactive",2],{"blog-frontend-architecture-2-en":3},{"number":4,"title":5,"summary":6,"parts":7,"toc":11,"minutes":273},2,"Where the idea comes from","The architecture combines three sources. We name them because each one is worth reading in the original.",[8],{"kind":9,"html":10},"html","\u003Cp>The architecture combines three sources. We name them because each one is worth reading in the original.\u003C\u002Fp>\n\u003Cdiv class=\"table-wrap\">\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Source\u003C\u002Fth>\n\u003Cth>What it contributes\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\n\u003Ctd>\u003Cstrong>Nx\u003C\u002Fstrong> (the Nrwl team, \u003Cem>Enterprise Angular Monorepo Patterns\u003C\u002Fem>)\u003C\u002Ftd>\n\u003Ctd>The monorepo itself, libraries with a public \u003Ccode>index.ts\u003C\u002Fcode>, and the classic library types: \u003Ccode>feature\u003C\u002Fcode>, \u003Ccode>ui\u003C\u002Fcode>, \u003Ccode>data-access\u003C\u002Fcode>, \u003Ccode>util\u003C\u002Fcode>. Tags on projects and the \u003Ccode>@nx\u002Fenforce-module-boundaries\u003C\u002Fcode> lint rule.\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Cstrong>Manfred Steyer\u003C\u002Fstrong> (ANGULARarchitects, the e-book \u003Cem>Enterprise Angular\u003C\u002Fem>, his articles on strategic design with Nx)\u003C\u002Ftd>\n\u003Ctd>Applying Domain-Driven Design to front-ends: \u003Cstrong>domains as vertical slices\u003C\u002Fstrong>, \u003Cstrong>library types as horizontal layers\u003C\u002Fstrong>, two tag dimensions (\u003Ccode>domain:*\u003C\u002Fcode> and \u003Ccode>type:*\u003C\u002Fcode>) checked by a linter, an \u003Cstrong>API library\u003C\u002Fstrong> as the only door between domains, and a \u003Cstrong>facade\u003C\u002Fstrong> between the UI and the state management. Later also \u003Cstrong>Sheriff\u003C\u002Fstrong>, a boundary checker for projects without Nx.\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Cstrong>NgRx\u003C\u002Fstrong> (and Redux before it)\u003C\u002Ftd>\n\u003Ctd>One store for shared state, changes through actions and pure reducers, side effects in effects, reads through memoized selectors.\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\u003C\u002Fdiv>\n\u003Cp>What we decided on top, in this guide:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>a separate \u003Ccode>model\u003C\u002Fcode> type for framework-free types and pure domain functions, so that \u003Ccode>ui\u003C\u002Fcode> libraries never depend on state management;\u003C\u002Fli>\n\u003Cli>a \u003Ccode>shell\u003C\u002Fcode> type of its own (Nx's \u003Ccode>feature-shell\u003C\u002Fcode>) that owns a domain's routes and providers;\u003C\u002Fli>\n\u003Cli>a third tag dimension, \u003Ccode>framework:*\u003C\u002Fcode>, so Angular, React and Vue applications can live in one workspace and share \u003Ccode>model\u003C\u002Fcode> and \u003Ccode>util\u003C\u002Fcode> code;\u003C\u002Fli>\n\u003Cli>a fourth dimension for Next.js, \u003Ccode>platform:server\u003C\u002Fcode> and \u003Ccode>platform:client\u003C\u002Fcode>;\u003C\u002Fli>\n\u003Cli>the rule of section 10 for when a facade pays off and when to skip it;\u003C\u002Fli>\n\u003Cli>the React\u002FNext and Vue\u002FNuxt translations in sections 12 and 13.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>When something on this page disagrees with the original articles, the original is the reference for the idea; this page is the reference for how we apply it.\u003C\u002Fp>\n",[12,25,29,33,37,57,73,89,113,141,153,173,213,241,245,249,269],{"id":13,"text":14,"depth":4,"children":15},"s1","1. Why front-ends need an architecture",[16,21],{"id":17,"text":18,"depth":19,"children":20},"s1-1","1.1. Goals",3,[],{"id":22,"text":23,"depth":19,"children":24},"s1-2","1.2. Non-goals",[],{"id":26,"text":27,"depth":4,"children":28},"s2","2. Where the idea comes from",[],{"id":30,"text":31,"depth":4,"children":32},"s3","3. The architecture on one page",[],{"id":34,"text":35,"depth":4,"children":36},"s4","4. Vocabulary",[],{"id":38,"text":39,"depth":4,"children":40},"s5","5. The example: Fleetline",[41,45,49,53],{"id":42,"text":43,"depth":19,"children":44},"s5-1","5.1. Applications",[],{"id":46,"text":47,"depth":19,"children":48},"s5-2","5.2. Domains and teams",[],{"id":50,"text":51,"depth":19,"children":52},"s5-3","5.3. The workspace",[],{"id":54,"text":55,"depth":19,"children":56},"s5-4","5.4. One use case through the layers",[],{"id":58,"text":59,"depth":4,"children":60},"s6","6. Library types",[61,65,69],{"id":62,"text":63,"depth":19,"children":64},"s6-1","6.1. Who may import whom",[],{"id":66,"text":67,"depth":19,"children":68},"s6-2","6.2. How big is a library",[],{"id":70,"text":71,"depth":19,"children":72},"s6-3","6.3. Styles",[],{"id":74,"text":75,"depth":4,"children":76},"s7","7. Domains and boundaries",[77,81,85],{"id":78,"text":79,"depth":19,"children":80},"s7-1","7.1. The API library",[],{"id":82,"text":83,"depth":19,"children":84},"s7-2","7.2. Shared is a domain too",[],{"id":86,"text":87,"depth":19,"children":88},"s7-3","7.3. When two domains need the same thing",[],{"id":90,"text":91,"depth":4,"children":92},"s8","8. Enforcing the rules",[93,97,101,105,109],{"id":94,"text":95,"depth":19,"children":96},"s8-1","8.1. Tags",[],{"id":98,"text":99,"depth":19,"children":100},"s8-2","8.2. The lint rule",[],{"id":102,"text":103,"depth":19,"children":104},"s8-3","8.3. The framework dimension",[],{"id":106,"text":107,"depth":19,"children":108},"s8-4","8.4. Without Nx: Sheriff",[],{"id":110,"text":111,"depth":19,"children":112},"s8-5","8.5. In CI",[],{"id":114,"text":115,"depth":4,"children":116},"s9","9. State with NgRx",[117,121,125,129,133,137],{"id":118,"text":119,"depth":19,"children":120},"s9-1","9.1. The model",[],{"id":122,"text":123,"depth":19,"children":124},"s9-2","9.2. Events",[],{"id":126,"text":127,"depth":19,"children":128},"s9-3","9.3. The feature: state, reducer, selectors",[],{"id":130,"text":131,"depth":19,"children":132},"s9-4","9.4. HTTP and effects",[],{"id":134,"text":135,"depth":19,"children":136},"s9-5","9.5. Providers",[],{"id":138,"text":139,"depth":19,"children":140},"s9-6","9.6. The public API of data-access",[],{"id":142,"text":143,"depth":4,"children":144},"s10","10. The facade, and when to skip it",[145,149],{"id":146,"text":147,"depth":19,"children":148},"s10-1","10.1. Why a facade",[],{"id":150,"text":151,"depth":19,"children":152},"s10-2","10.2. Why the facade is optional",[],{"id":154,"text":155,"depth":4,"children":156},"s11","11. Angular end to end",[157,161,165,169],{"id":158,"text":159,"depth":19,"children":160},"s11-1","11.1. The ui library",[],{"id":162,"text":163,"depth":19,"children":164},"s11-2","11.2. The feature library",[],{"id":166,"text":167,"depth":19,"children":168},"s11-3","11.3. The shell",[],{"id":170,"text":171,"depth":19,"children":172},"s11-4","11.4. The application",[],{"id":174,"text":175,"depth":4,"children":176},"s12","12. React and Next.js",[177,181,185,189,193,197,201,205,209],{"id":178,"text":179,"depth":19,"children":180},"s12-1","12.1. What maps to what",[],{"id":182,"text":183,"depth":19,"children":184},"s12-2","12.2. Tags for server and client",[],{"id":186,"text":187,"depth":19,"children":188},"s12-3","12.3. HTTP and the query client",[],{"id":190,"text":191,"depth":19,"children":192},"s12-4","12.4. Queries and mutations",[],{"id":194,"text":195,"depth":19,"children":196},"s12-5","12.5. Client state in Zustand",[],{"id":198,"text":199,"depth":19,"children":200},"s12-6","12.6. The facade hook",[],{"id":202,"text":203,"depth":19,"children":204},"s12-7","12.7. Feature, ui and route",[],{"id":206,"text":207,"depth":19,"children":208},"s12-8","12.8. The shell and another domain's API",[],{"id":210,"text":211,"depth":19,"children":212},"s12-9","12.9. Pitfalls specific to Next.js",[],{"id":214,"text":215,"depth":4,"children":216},"s13","13. Vue and Nuxt",[217,221,225,229,233,237],{"id":218,"text":219,"depth":19,"children":220},"s13-1","13.1. What maps to what",[],{"id":222,"text":223,"depth":19,"children":224},"s13-2","13.2. Turn off auto-imports for libraries",[],{"id":226,"text":227,"depth":19,"children":228},"s13-3","13.3. The store",[],{"id":230,"text":231,"depth":19,"children":232},"s13-4","13.4. The facade composable and store scope",[],{"id":234,"text":235,"depth":19,"children":236},"s13-5","13.5. Feature, ui, shell and page",[],{"id":238,"text":239,"depth":19,"children":240},"s13-6","13.6. Pitfalls specific to Nuxt",[],{"id":242,"text":243,"depth":4,"children":244},"s14","14. Side by side",[],{"id":246,"text":247,"depth":4,"children":248},"s15","15. Testing per library type",[],{"id":250,"text":251,"depth":4,"children":252},"s16","16. Growing into it and migrating",[253,257,261,265],{"id":254,"text":255,"depth":19,"children":256},"s16-1","16.1. Migration in eight steps",[],{"id":258,"text":259,"depth":19,"children":260},"s16-2","16.2. What usually goes wrong",[],{"id":262,"text":263,"depth":19,"children":264},"s16-3","16.3. When to split a library",[],{"id":266,"text":267,"depth":19,"children":268},"s16-4","16.4. When this is too much",[],{"id":270,"text":271,"depth":4,"children":272},"s17","17. Questions",[],36,1795449737149]