[{"data":1,"prerenderedAt":275},["ShallowReactive",2],{"blog-frontend-architecture-1-en":3},{"number":4,"title":5,"summary":6,"parts":7,"toc":11,"minutes":274},1,"Why front-ends need an architecture","A front-end grows the same way every time. The first year there is one application and a src\u002Fapp folder with components, services and store. By the third…",[8],{"kind":9,"html":10},"html","\u003Cp>A front-end grows the same way every time. The first year there is one application and a \u003Ccode>src\u002Fapp\u003C\u002Fcode> folder with \u003Ccode>components\u003C\u002Fcode>, \u003Ccode>services\u003C\u002Fcode> and \u003Ccode>store\u003C\u002Fcode>. By the third year the same project usually looks like this:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Ccode>shared\u002F\u003C\u002Fcode> holds three hundred files, and half of them are used by exactly one feature;\u003C\u002Fli>\n\u003Cli>a component in billing imports a selector from maintenance because it was there;\u003C\u002Fli>\n\u003Cli>the root store has forty feature keys, and nobody knows which ones a page needs;\u003C\u002Fli>\n\u003Cli>a second application is created by copying the first one, because extracting code is too hard;\u003C\u002Fli>\n\u003Cli>one change to a date helper rebuilds and retests the whole repository;\u003C\u002Fli>\n\u003Cli>a new developer, or a coding agent, needs days to learn where a feature lives and what it may use.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>None of this comes from bad engineers. It comes from the absence of a shared answer to two questions: \u003Cstrong>where does this file go\u003C\u002Fstrong>, and \u003Cstrong>who may import whom\u003C\u002Fstrong>. Without an answer the nearest folder wins, and the nearest folder is always \u003Ccode>shared\u002F\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Cp>The architecture in this guide answers both questions once, for every kind of front-end code, and makes the answer \u003Cstrong>mechanical\u003C\u002Fstrong>: a lint rule rejects an import that crosses a line, in the editor and in CI.\u003C\u002Fp>\n\u003Ch3 id=\"s1-1\">1.1. Goals\u003C\u002Fh3>\n\u003Col>\n\u003Cli>\u003Cstrong>Findability.\u003C\u002Fstrong> Knowing the name of a feature tells you its folder, in every application.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Local changes.\u003C\u002Fstrong> A change inside one domain cannot break another domain, because the other domain cannot see its internals.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Fast feedback at scale.\u003C\u002Fstrong> CI builds and tests only the libraries a change affects.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Parallel teams.\u003C\u002Fstrong> A team owns domains, not files scattered across \u003Ccode>shared\u002F\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Replaceable state.\u003C\u002Fstrong> A feature does not know whether its data comes from NgRx, a Signal Store, a cache or the server.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>One rulebook for three frameworks.\u003C\u002Fstrong> Angular, React and Vue applications in the same company follow the same structure, and framework-free code is shared between them.\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Ch3 id=\"s1-2\">1.2. Non-goals\u003C\u002Fh3>\n\u003Cul>\n\u003Cli>It does not choose your back-end, your design system or your CSS.\u003C\u002Fli>\n\u003Cli>It does not require micro front-ends. Everything here works in one deployable application; micro front-ends are a later, separate decision.\u003C\u002Fli>\n\u003Cli>It does not replace your product rules. It says where code lives and what it may use; your project says what the code must do.\u003C\u002Fli>\n\u003C\u002Ful>\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,1795449737135]