[{"data":1,"prerenderedAt":278},["ShallowReactive",2],{"blog-frontend-architecture-14-en":3},{"number":4,"title":5,"summary":6,"parts":7,"toc":14,"minutes":277},14,"Side by side","What stays identical in all three: the folder of every file, the tags, the lint rule, the model library, the members of the facade (in React without open()…",[8,11],{"kind":9,"name":10},"diagram","fe-frameworks",{"kind":12,"html":13},"html","\u003Cp>The same use case in three frameworks, file by file:\u003C\u002Fp>\n\u003Cdiv class=\"table-wrap\">\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Library\u003C\u002Fth>\n\u003Cth>Angular\u003C\u002Fth>\n\u003Cth>React \u002F Next.js\u003C\u002Fth>\n\u003Cth>Vue \u002F Nuxt\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\n\u003Ctd>\u003Ccode>model\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>work-order.ts\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>the same file\u003C\u002Ftd>\n\u003Ctd>the same file\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>data-access\u003C\u002Fcode> state\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>createFeature\u003C\u002Fcode> + \u003Ccode>createEntityAdapter\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>TanStack Query (server) + Zustand (client)\u003C\u002Ftd>\n\u003Ctd>Pinia setup store\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>data-access\u003C\u002Fcode> effects\u003C\u002Ftd>\n\u003Ctd>functional \u003Ccode>createEffect\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>queryFn\u003C\u002Fcode> and \u003Ccode>useMutation\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>async store actions + \u003Ccode>useAsyncData\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>concurrency\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>switchMap\u003C\u002Fcode> \u002F \u003Ccode>mergeMap\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>query key + \u003Ccode>signal\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>AbortController\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>HTTP service\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>@Service()\u003C\u002Fcode> + \u003Ccode>HttpClient\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>module over \u003Ccode>createApiClient\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>composable with \u003Ccode>$fetch.create\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>data-access\u003C\u002Fcode> facade\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>WorkOrdersFacade\u003C\u002Fcode> (signals)\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>useWorkOrders()\u003C\u002Fcode> (values)\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>useWorkOrders()\u003C\u002Fcode> (refs)\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>state scope\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>provideWorkOrders()\u003C\u002Fcode> on the route\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>&lt;WorkOrdersProvider&gt;\u003C\u002Fcode> in the shell layout\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>provideWorkOrders()\u003C\u002Fcode> in the shell layout\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>ui\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>input()\u003C\u002Fcode> \u002F \u003Ccode>output()\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>props \u002F callbacks\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>defineProps\u003C\u002Fcode> \u002F \u003Ccode>defineEmits\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>ui\u003C\u002Fcode> styles\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>styleUrl\u003C\u002Fcode>, emulated encapsulation\u003C\u002Ftd>\n\u003Ctd>CSS Modules\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>&lt;style scoped&gt;\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>feature\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>standalone component, \u003Ccode>OnPush\u003C\u002Fcode> by default\u003C\u002Ftd>\n\u003Ctd>server container + client component\u003C\u002Ftd>\n\u003Ctd>single-file component\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>shell\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>Routes\u003C\u002Fcode> with \u003Ccode>providers\u003C\u002Fcode> and \u003Ccode>canActivate\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>server layout with providers\u003C\u002Ftd>\n\u003Ctd>layout + route middleware\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>app route\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>loadChildren\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>page.tsx\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>pages\u002F*.vue\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>facade fake in tests\u003C\u002Ftd>\n\u003Ctd>provider in \u003Ccode>TestBed\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>vi.mock\u003C\u002Fcode> of the module\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>vi.mock\u003C\u002Fcode> of the module\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>boundaries\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>@nx\u002Fenforce-module-boundaries\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>the same rule\u003C\u002Ftd>\n\u003Ctd>the same rule, with \u003Ccode>vue-eslint-parser\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\u003C\u002Fdiv>\n\u003Cp>What stays identical in all three: the folder of every file, the tags, the lint rule, the \u003Ccode>model\u003C\u002Fcode> library, the members of the facade (in React without \u003Ccode>open()\u003C\u002Fcode>, because the query opens itself), the component styles and the tests of the \u003Ccode>model\u003C\u002Fcode> library. What a developer switching between Fleetline's apps has to relearn is only the framework itself.\u003C\u002Fp>\n",[15,29,33,37,41,61,77,93,117,145,157,177,217,245,249,253,273],{"id":16,"text":17,"depth":18,"children":19},"s1","1. Why front-ends need an architecture",2,[20,25],{"id":21,"text":22,"depth":23,"children":24},"s1-1","1.1. Goals",3,[],{"id":26,"text":27,"depth":23,"children":28},"s1-2","1.2. Non-goals",[],{"id":30,"text":31,"depth":18,"children":32},"s2","2. Where the idea comes from",[],{"id":34,"text":35,"depth":18,"children":36},"s3","3. The architecture on one page",[],{"id":38,"text":39,"depth":18,"children":40},"s4","4. Vocabulary",[],{"id":42,"text":43,"depth":18,"children":44},"s5","5. The example: Fleetline",[45,49,53,57],{"id":46,"text":47,"depth":23,"children":48},"s5-1","5.1. Applications",[],{"id":50,"text":51,"depth":23,"children":52},"s5-2","5.2. Domains and teams",[],{"id":54,"text":55,"depth":23,"children":56},"s5-3","5.3. The workspace",[],{"id":58,"text":59,"depth":23,"children":60},"s5-4","5.4. One use case through the layers",[],{"id":62,"text":63,"depth":18,"children":64},"s6","6. Library types",[65,69,73],{"id":66,"text":67,"depth":23,"children":68},"s6-1","6.1. Who may import whom",[],{"id":70,"text":71,"depth":23,"children":72},"s6-2","6.2. How big is a library",[],{"id":74,"text":75,"depth":23,"children":76},"s6-3","6.3. Styles",[],{"id":78,"text":79,"depth":18,"children":80},"s7","7. Domains and boundaries",[81,85,89],{"id":82,"text":83,"depth":23,"children":84},"s7-1","7.1. The API library",[],{"id":86,"text":87,"depth":23,"children":88},"s7-2","7.2. Shared is a domain too",[],{"id":90,"text":91,"depth":23,"children":92},"s7-3","7.3. When two domains need the same thing",[],{"id":94,"text":95,"depth":18,"children":96},"s8","8. Enforcing the rules",[97,101,105,109,113],{"id":98,"text":99,"depth":23,"children":100},"s8-1","8.1. Tags",[],{"id":102,"text":103,"depth":23,"children":104},"s8-2","8.2. The lint rule",[],{"id":106,"text":107,"depth":23,"children":108},"s8-3","8.3. The framework dimension",[],{"id":110,"text":111,"depth":23,"children":112},"s8-4","8.4. Without Nx: Sheriff",[],{"id":114,"text":115,"depth":23,"children":116},"s8-5","8.5. In CI",[],{"id":118,"text":119,"depth":18,"children":120},"s9","9. State with NgRx",[121,125,129,133,137,141],{"id":122,"text":123,"depth":23,"children":124},"s9-1","9.1. The model",[],{"id":126,"text":127,"depth":23,"children":128},"s9-2","9.2. Events",[],{"id":130,"text":131,"depth":23,"children":132},"s9-3","9.3. The feature: state, reducer, selectors",[],{"id":134,"text":135,"depth":23,"children":136},"s9-4","9.4. HTTP and effects",[],{"id":138,"text":139,"depth":23,"children":140},"s9-5","9.5. Providers",[],{"id":142,"text":143,"depth":23,"children":144},"s9-6","9.6. The public API of data-access",[],{"id":146,"text":147,"depth":18,"children":148},"s10","10. The facade, and when to skip it",[149,153],{"id":150,"text":151,"depth":23,"children":152},"s10-1","10.1. Why a facade",[],{"id":154,"text":155,"depth":23,"children":156},"s10-2","10.2. Why the facade is optional",[],{"id":158,"text":159,"depth":18,"children":160},"s11","11. Angular end to end",[161,165,169,173],{"id":162,"text":163,"depth":23,"children":164},"s11-1","11.1. The ui library",[],{"id":166,"text":167,"depth":23,"children":168},"s11-2","11.2. The feature library",[],{"id":170,"text":171,"depth":23,"children":172},"s11-3","11.3. The shell",[],{"id":174,"text":175,"depth":23,"children":176},"s11-4","11.4. The application",[],{"id":178,"text":179,"depth":18,"children":180},"s12","12. React and Next.js",[181,185,189,193,197,201,205,209,213],{"id":182,"text":183,"depth":23,"children":184},"s12-1","12.1. What maps to what",[],{"id":186,"text":187,"depth":23,"children":188},"s12-2","12.2. Tags for server and client",[],{"id":190,"text":191,"depth":23,"children":192},"s12-3","12.3. HTTP and the query client",[],{"id":194,"text":195,"depth":23,"children":196},"s12-4","12.4. Queries and mutations",[],{"id":198,"text":199,"depth":23,"children":200},"s12-5","12.5. Client state in Zustand",[],{"id":202,"text":203,"depth":23,"children":204},"s12-6","12.6. The facade hook",[],{"id":206,"text":207,"depth":23,"children":208},"s12-7","12.7. Feature, ui and route",[],{"id":210,"text":211,"depth":23,"children":212},"s12-8","12.8. The shell and another domain's API",[],{"id":214,"text":215,"depth":23,"children":216},"s12-9","12.9. Pitfalls specific to Next.js",[],{"id":218,"text":219,"depth":18,"children":220},"s13","13. Vue and Nuxt",[221,225,229,233,237,241],{"id":222,"text":223,"depth":23,"children":224},"s13-1","13.1. What maps to what",[],{"id":226,"text":227,"depth":23,"children":228},"s13-2","13.2. Turn off auto-imports for libraries",[],{"id":230,"text":231,"depth":23,"children":232},"s13-3","13.3. The store",[],{"id":234,"text":235,"depth":23,"children":236},"s13-4","13.4. The facade composable and store scope",[],{"id":238,"text":239,"depth":23,"children":240},"s13-5","13.5. Feature, ui, shell and page",[],{"id":242,"text":243,"depth":23,"children":244},"s13-6","13.6. Pitfalls specific to Nuxt",[],{"id":246,"text":247,"depth":18,"children":248},"s14","14. Side by side",[],{"id":250,"text":251,"depth":18,"children":252},"s15","15. Testing per library type",[],{"id":254,"text":255,"depth":18,"children":256},"s16","16. Growing into it and migrating",[257,261,265,269],{"id":258,"text":259,"depth":23,"children":260},"s16-1","16.1. Migration in eight steps",[],{"id":262,"text":263,"depth":23,"children":264},"s16-2","16.2. What usually goes wrong",[],{"id":266,"text":267,"depth":23,"children":268},"s16-3","16.3. When to split a library",[],{"id":270,"text":271,"depth":23,"children":272},"s16-4","16.4. When this is too much",[],{"id":274,"text":275,"depth":18,"children":276},"s17","17. Questions",[],36,1795449737327]