[{"data":1,"prerenderedAt":275},["ShallowReactive",2],{"blog-frontend-architecture-17-en":3},{"number":4,"title":5,"summary":6,"parts":7,"toc":11,"minutes":274},17,"Questions","Do we need NgRx for all state? No. Shared, long-lived state that several features read goes into a store. Form state, open\u002Fclosed panels and other state that…",[8],{"kind":9,"html":10},"html","\u003Cp>\u003Cstrong>Do we need NgRx for all state?\u003C\u002Fstrong>\nNo. Shared, long-lived state that several features read goes into a store. Form state, open\u002Fclosed panels and other state that one component owns stay in the component, with signals or a component-level Signal Store.\u003C\u002Fp>\n\u003Cp>\u003Cstrong>NgRx Store or NgRx Signal Store?\u003C\u002Fstrong>\nBoth fit the architecture, both live in \u003Ccode>data-access\u003C\u002Fcode>, and the facade hides the choice. Fleetline uses the Store where an event log and devtools pay off (maintenance, planning) and the Signal Store for simpler domains (fleet summaries, notifications). The Signal Store events plugin (\u003Ccode>@ngrx\u002Fsignals\u002Fevents\u003C\u002Fcode>) brings Flux-style events to it, so the event log is no longer the only argument for the classic Store.\u003C\u002Fp>\n\u003Cp>\u003Cstrong>What about server state in Angular?\u003C\u002Fstrong>\nIn Angular 22 \u003Ccode>resource\u003C\u002Fcode>, \u003Ccode>rxResource\u003C\u002Fcode> and \u003Ccode>httpResource\u003C\u002Fcode> are stable, and when two requests overlap only the latest one counts, as with \u003Ccode>switchMap\u003C\u002Fcode>. For mostly read data, they are Angular's counterpart of TanStack Query and Pinia Colada: \u003Ccode>data-access\u003C\u002Fcode> holds an \u003Ccode>httpResource\u003C\u002Fcode>, and the facade exposes its \u003Ccode>value()\u003C\u002Fcode> and \u003Ccode>isLoading()\u003C\u002Fcode>. The feature does not change.\u003C\u002Fp>\n\u003Cp>\u003Cstrong>Why Zustand and TanStack Query in React, not Redux Toolkit?\u003C\u002Fstrong>\nBoth options pass the same boundary rules and both hide behind the same facade. Redux Toolkit gives what NgRx Store gives: slices, \u003Ccode>createEntityAdapter\u003C\u002Fcode>, listener middleware and a full event log. In Next.js, though, most state is server state and what remains on the client is small, so Fleetline keeps the data in the query cache and the rest in small Zustand stores with named actions in devtools. A team that needs an event log in a large client-side domain can use Redux Toolkit there.\u003C\u002Fp>\n\u003Cp>\u003Cstrong>Is a facade not just an extra layer?\u003C\u002Fstrong>\nIt is, and section 10 says when it is worth it. In React and Vue, the hook or composable is the idiomatic way to share state access anyway, so there the facade costs almost nothing.\u003C\u002Fp>\n\u003Cp>\u003Cstrong>Should every domain have an \u003Ccode>api\u003C\u002Fcode> library from day one?\u003C\u002Fstrong>\nNo. Create it the first time another domain needs something. Before that, the domain is fully private, which is the best boundary there is.\u003C\u002Fp>\n\u003Cp>\u003Cstrong>Is this micro front-ends?\u003C\u002Fstrong>\nNo. Everything here builds into one application per app folder. The same domain cut is the natural seam for micro front-ends later, if the organisation ever needs independent deployments.\u003C\u002Fp>\n\u003Cp>\u003Cstrong>Can React, Vue and Angular really share libraries?\u003C\u002Fstrong>\nThey share \u003Ccode>model\u003C\u002Fcode> and \u003Ccode>util\u003C\u002Fcode> libraries, tagged \u003Ccode>framework:agnostic\u003C\u002Fcode>, and test data builders. Components and stores are per framework. In Fleetline, about a fifth of the front-end code is framework-agnostic.\u003C\u002Fp>\n\u003Cp>\u003Cstrong>Where should we read more?\u003C\u002Fstrong>\nManfred Steyer's articles and the free e-book \u003Cem>Enterprise Angular\u003C\u002Fem> on \u003Ca href=\"https:\u002F\u002Fwww.angulararchitects.io\u002F\">angulararchitects.io\u003C\u002Fa>, the \u003Ca href=\"https:\u002F\u002Fnx.dev\u002F\">Nx documentation\u003C\u002Fa> on module boundaries, \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fsoftarc-consulting\u002Fsheriff\">Sheriff\u003C\u002Fa>, the \u003Ca href=\"https:\u002F\u002Fngrx.io\u002F\">NgRx documentation\u003C\u002Fa>, \u003Ca href=\"https:\u002F\u002Ftanstack.com\u002Fquery\">TanStack Query\u003C\u002Fa>, \u003Ca href=\"https:\u002F\u002Fzustand.docs.pmnd.rs\u002F\">Zustand\u003C\u002Fa> and \u003Ca href=\"https:\u002F\u002Fpinia.vuejs.org\u002F\">Pinia\u003C\u002Fa>.\u003C\u002Fp>\n",[12,26,30,34,38,58,74,90,114,142,154,174,214,242,246,250,270],{"id":13,"text":14,"depth":15,"children":16},"s1","1. Why front-ends need an architecture",2,[17,22],{"id":18,"text":19,"depth":20,"children":21},"s1-1","1.1. Goals",3,[],{"id":23,"text":24,"depth":20,"children":25},"s1-2","1.2. Non-goals",[],{"id":27,"text":28,"depth":15,"children":29},"s2","2. Where the idea comes from",[],{"id":31,"text":32,"depth":15,"children":33},"s3","3. The architecture on one page",[],{"id":35,"text":36,"depth":15,"children":37},"s4","4. Vocabulary",[],{"id":39,"text":40,"depth":15,"children":41},"s5","5. The example: Fleetline",[42,46,50,54],{"id":43,"text":44,"depth":20,"children":45},"s5-1","5.1. Applications",[],{"id":47,"text":48,"depth":20,"children":49},"s5-2","5.2. Domains and teams",[],{"id":51,"text":52,"depth":20,"children":53},"s5-3","5.3. The workspace",[],{"id":55,"text":56,"depth":20,"children":57},"s5-4","5.4. One use case through the layers",[],{"id":59,"text":60,"depth":15,"children":61},"s6","6. Library types",[62,66,70],{"id":63,"text":64,"depth":20,"children":65},"s6-1","6.1. Who may import whom",[],{"id":67,"text":68,"depth":20,"children":69},"s6-2","6.2. How big is a library",[],{"id":71,"text":72,"depth":20,"children":73},"s6-3","6.3. Styles",[],{"id":75,"text":76,"depth":15,"children":77},"s7","7. Domains and boundaries",[78,82,86],{"id":79,"text":80,"depth":20,"children":81},"s7-1","7.1. The API library",[],{"id":83,"text":84,"depth":20,"children":85},"s7-2","7.2. Shared is a domain too",[],{"id":87,"text":88,"depth":20,"children":89},"s7-3","7.3. When two domains need the same thing",[],{"id":91,"text":92,"depth":15,"children":93},"s8","8. Enforcing the rules",[94,98,102,106,110],{"id":95,"text":96,"depth":20,"children":97},"s8-1","8.1. Tags",[],{"id":99,"text":100,"depth":20,"children":101},"s8-2","8.2. The lint rule",[],{"id":103,"text":104,"depth":20,"children":105},"s8-3","8.3. The framework dimension",[],{"id":107,"text":108,"depth":20,"children":109},"s8-4","8.4. Without Nx: Sheriff",[],{"id":111,"text":112,"depth":20,"children":113},"s8-5","8.5. In CI",[],{"id":115,"text":116,"depth":15,"children":117},"s9","9. State with NgRx",[118,122,126,130,134,138],{"id":119,"text":120,"depth":20,"children":121},"s9-1","9.1. The model",[],{"id":123,"text":124,"depth":20,"children":125},"s9-2","9.2. Events",[],{"id":127,"text":128,"depth":20,"children":129},"s9-3","9.3. The feature: state, reducer, selectors",[],{"id":131,"text":132,"depth":20,"children":133},"s9-4","9.4. HTTP and effects",[],{"id":135,"text":136,"depth":20,"children":137},"s9-5","9.5. Providers",[],{"id":139,"text":140,"depth":20,"children":141},"s9-6","9.6. The public API of data-access",[],{"id":143,"text":144,"depth":15,"children":145},"s10","10. The facade, and when to skip it",[146,150],{"id":147,"text":148,"depth":20,"children":149},"s10-1","10.1. Why a facade",[],{"id":151,"text":152,"depth":20,"children":153},"s10-2","10.2. Why the facade is optional",[],{"id":155,"text":156,"depth":15,"children":157},"s11","11. Angular end to end",[158,162,166,170],{"id":159,"text":160,"depth":20,"children":161},"s11-1","11.1. The ui library",[],{"id":163,"text":164,"depth":20,"children":165},"s11-2","11.2. The feature library",[],{"id":167,"text":168,"depth":20,"children":169},"s11-3","11.3. The shell",[],{"id":171,"text":172,"depth":20,"children":173},"s11-4","11.4. The application",[],{"id":175,"text":176,"depth":15,"children":177},"s12","12. React and Next.js",[178,182,186,190,194,198,202,206,210],{"id":179,"text":180,"depth":20,"children":181},"s12-1","12.1. What maps to what",[],{"id":183,"text":184,"depth":20,"children":185},"s12-2","12.2. Tags for server and client",[],{"id":187,"text":188,"depth":20,"children":189},"s12-3","12.3. HTTP and the query client",[],{"id":191,"text":192,"depth":20,"children":193},"s12-4","12.4. Queries and mutations",[],{"id":195,"text":196,"depth":20,"children":197},"s12-5","12.5. Client state in Zustand",[],{"id":199,"text":200,"depth":20,"children":201},"s12-6","12.6. The facade hook",[],{"id":203,"text":204,"depth":20,"children":205},"s12-7","12.7. Feature, ui and route",[],{"id":207,"text":208,"depth":20,"children":209},"s12-8","12.8. The shell and another domain's API",[],{"id":211,"text":212,"depth":20,"children":213},"s12-9","12.9. Pitfalls specific to Next.js",[],{"id":215,"text":216,"depth":15,"children":217},"s13","13. Vue and Nuxt",[218,222,226,230,234,238],{"id":219,"text":220,"depth":20,"children":221},"s13-1","13.1. What maps to what",[],{"id":223,"text":224,"depth":20,"children":225},"s13-2","13.2. Turn off auto-imports for libraries",[],{"id":227,"text":228,"depth":20,"children":229},"s13-3","13.3. The store",[],{"id":231,"text":232,"depth":20,"children":233},"s13-4","13.4. The facade composable and store scope",[],{"id":235,"text":236,"depth":20,"children":237},"s13-5","13.5. Feature, ui, shell and page",[],{"id":239,"text":240,"depth":20,"children":241},"s13-6","13.6. Pitfalls specific to Nuxt",[],{"id":243,"text":244,"depth":15,"children":245},"s14","14. Side by side",[],{"id":247,"text":248,"depth":15,"children":249},"s15","15. Testing per library type",[],{"id":251,"text":252,"depth":15,"children":253},"s16","16. Growing into it and migrating",[254,258,262,266],{"id":255,"text":256,"depth":20,"children":257},"s16-1","16.1. Migration in eight steps",[],{"id":259,"text":260,"depth":20,"children":261},"s16-2","16.2. What usually goes wrong",[],{"id":263,"text":264,"depth":20,"children":265},"s16-3","16.3. When to split a library",[],{"id":267,"text":268,"depth":20,"children":269},"s16-4","16.4. When this is too much",[],{"id":271,"text":272,"depth":15,"children":273},"s17","17. Questions",[],36,1795449737386]