If you listen to the "Enterprise" gurus, they’ll tell you that any Angular app larger than a 'Hello World' needs a full-blown Redux-style store. They want you to write Actions, Reducers, Effects, and Selectors for a simple toggle button.
After 10 years of building frontends, I call that Sda3.
The Boilerplate Tax
The problem with heavy state management libraries isn't that they are bad; it's that they are slow. They kill developer velocity. You spend 40% of your time writing glue code instead of building features.
For 90% of the projects I’ve led—from SaaS platforms to internal tools at ZINIR LAB—you don't need a library. You need a Tkhwira.
The "Service-Store" Pattern
This is my favorite "Strategic Tkhwira." It uses a simple Angular Service and a private BehaviorSubject.
The Implementation
Instead of a complex store, you create a stateful service:
@Injectable({ providedIn: 'root' })
export class UserStore {
// The "Private" State
private readonly _user = new BehaviorSubject<User | null>(null);
// The "Public" Observable (Read-only)
readonly user$ = this._user.asObservable();
// The "Action" (The only way to change state)
updateUser(user: User) {
this._user.next(user);
}
get current() {
return this._user.getValue();
}
}
Why this is a "Good" Tkhwira
Unidirectional Data Flow: You still have it. Only the service can change the data.
-
Performance: No extra library overhead. You're using the RxJS that’s already in Angular.
-
Debuggability: It’s just a service. You can put a console.log or a breakpoint in one place and see exactly who is changing the state.
The Verdict
Don't install NGRX because a tutorial told you to. If your state is complex enough that you’re losing track of data, fine—go for it. But if you want to ship fast and keep your bundle size small, the Service-Store is the pragmatic choice.
Remember: Architecture is about choosing the right tool for the job, not the one with the most stars on GitHub.