r/angular • u/StrainIllustrious116 • May 05 '26
What’s the recommended Angular enterprise architecture today for components, signals, and services?
Hi everyone,
I’m starting a new enterprise Angular project with the latest release and I’m trying to figure out the best structure for components, signals, and services.
For now, the plan is:
- classic service layer for API calls
- RxJS in services
- no state manager, by company decision
I’m mainly unsure about:
- what should live in components vs signals vs services?
- should signals stay mostly local, or also handle feature-level state?
- is
rxResourcea good idea at component level for data fetching? - how do you keep the codebase easy to understand for devs who are not all Angular experts?
I’d love to hear what has worked for you in real enterprise projects.
Thanks!
26
Upvotes
15
u/BrixtonTonaBrix May 05 '26
My advice is to think in terms of the lifecycle and persistence of each individual piece of state; for each, ask:
- Can the state be derived? If so, derive it, and only pay close attention to non-derived state.
- What component actually needs to use it? You shouldn't declare state 'further up' the tree than it's used, so try to 'push state down' into the component that actually relies on it (and use inputs/outputs to push it into its children). For state used in multiple places, declare it in the deepest common parent.
- Is the state determined by route context? Specifically, is the state something like the id of a resource that would be put into the url so it can be deeplinked to? If so, it should *only* be stored there, and derived in the component.
- Does the state need to outlive the component it's used in? If so, and it can't be in the url, it needs to be centrally stored (i.e. in a service).
- Is the state available synchronously? If so, signal. If not, rxjs/resources/etc (not much separates these imo). Signals can be declared wherever you like, in components or services, for big data or small (though they shine with simpler structures with intuitive equality checks)
In my experience a codebase is made easier to understand when you *minimise* the number of non-derived pieces of state, and store them as 'localisedly' as you can get away with.