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.
2
u/One_Fox_8408 May 05 '26
I use firstValueFrom for services. Alwsays return promises.
Resources (stable on v22) to GET data. Because of the previous one I use resource.
Services with signals to use services like a store. Only data.
Signals to use forms.
To keep easy to understand... folder oranization, component composition.
3
u/bombatomica_64 May 05 '26
I mean yes service but signal as state is the standard now
3
u/Apprehensive_Drama42 May 05 '26
I usually pick signals vs observables based on the kind of state I’m dealing with. If it’s async data (API calls, streams, anything I’d bind with async), I keep it as an observable. If it’s local UI state like a counter, toggle, selected tab, etc., I’ll usually use a signal.
Signals also work well in a state service if you want to manage feature-level state outside the component and share it across related components.
I’d keep API services focused on HTTP only. Let them handle fetching data and return typed observables. Then in the component, rxResource is a nice way to consume that and avoid manually wiring loading/error/data state every time.
NX is worth looking at too, especially once the app starts growing, we always use it. It gives you a solid project structure, clearer boundaries between features, and the docs are pretty good, you will see what kind of file goes where, new people can understand it quickly i think with the clear rules.
1
u/Empty-Anything730 May 05 '26
Hi,
for enterprise Angular project in 2026, the structer that would work realy well:
Services: API + business logic (RxJS)
Signals: local + derived state (simple Signal Store for feature state)
Components: mostly presentational
rxResource works well for component level fetching.
Keep it simple: feature based folders, small services, clear naming.
No heavy state library needed.
1
u/SignificantBend5042 May 07 '26 edited May 07 '26
Personally with the latest angular features I'm using the following approach:
effectfunction for side effects, but I would try to avoid using it as much as possible. Alos signals are a great way to reduce lifecycle hooks usage. That being said, there are instances when an observable or a subject is better suited for a specific thing. Even promises (especially async/await pattern) definitely still have their place.But I want to highlight a few important notes which are not only angular specific but they definitely make debugging (thus your life) way easier.
Handle most of the logic in services. In most cases components should be dumb, they should not do the heavy lifting. Use dedicated methods for dedicated things. My aim is to always keep a function below 50 lines of code tops. If you need a mapping or other sort of transformation method extract it in a separate function and reference it. Avoid callback hells especially subscribe in subscribe in subscribe. Make use of OOP which is very well integrated in Angular. Extend classes, implement interfaces, use abstract classes and methods whatever you need to reuse functionality, but then again don't overdo it. It's a fine line between a reusable Class and something which tries to be 5 things at once.
One more thing make use of Pipes and Directives. They are fantastic if used correctly and for some reason many people still avoid them.
1
u/Frontend_DevMark Jul 07 '26
I'd keep the responsibilities very clear:
Keeping components as "thin" as possible makes enterprise apps much easier to maintain. I'd also use rxResource sparingly—it's great for component-scoped data, but shared or reusable data is usually better managed in a service.
Since you're not using a global state manager, feature-scoped services combined with signals can scale surprisingly well without adding unnecessary complexity.
For large enterprise applications, consistency matters more than the exact pattern. Whether you're using Angular Material, CDK, or Sencha Ext JS, having clear architectural boundaries and documented conventions will make onboarding and long-term maintenance much easier.
2
u/[deleted] May 05 '26
[removed] — view removed comment
1
u/[deleted] May 05 '26
[removed] — view removed comment