
Explore state management in Angular with NgRx and NgRx Data, from store and effects to dev tools and entities, with optimistic updates and a new API that reduces boilerplate.
Set up the NgRx development environment by selecting the right Node version, cloning the course repo, checking out one-dash-start, and running npm install, npm run server, and npm start.
Learn what NgRx is and why state management matters in angular, including its redux-inspired approach, reducing redundant http requests, and enabling a client-side in-memory database for instant UI updates.
Learn to implement authentication state with NgRx in Angular 20, enabling login, logout, and persisted user sessions using a central in-memory store and NgRx devtools.
Learn to configure an NgRx feature module with schematics, set up authentication state with actions and reducers, and distinguish eager versus lazy loading to manage login data in the store.
Explore the store service api to interact with the in-memory store, implement the login screen, authenticate via backend, and dispatch actions to save the user profile into the global store.
Define and dispatch a login action using a type-safe action creator with props, sending a payload of user data to the store and observing how actions drive store updates.
Define a logout action in the authentication module and group related actions with a TypeScript action types file to simplify reducers and access all authentication actions.
Define a reducer to handle login actions, updating the authentication state with the user profile, using createReducer and on for the authentication feature.
Learn how dispatching a login action updates the in-memory store through the authentication reducer to save the user profile, illustrating actions, reducers, and shared state in NgRx.
Discover how to query the NgRx store to manage the authentication state, using the store observable and async pipe to show or hide login and logout buttons.
Master anchor selectors and memoized mapping with create selector to derive is logged in and is logged out from the store, using select to optimize data changes.
Learn how to use feature selectors to type-safely access authentication state from the store, using create feature selector to improve autocompletion, and prepare for logout and authentication guard concepts.
Dispatch a logout action to remove the user profile from the store, returning a new authentication state and guarding the courses screen with authentication.
Implement a canActivate authentication guard to protect the courses route, redirecting unauthenticated users to the login page using the store's isLoggedIn selector and rxjs tap.
Explore NgRx effects and side effects in the store architecture. Learn how to synchronize in-memory store data with a backend and persist authentication state to local storage.
Implement a first side effect in an NgRx app by saving the user profile to local storage on login, using an authentication effects service and actions stream.
Implement a login effect with the createEffect utility, using RxJS operators like ofType and tap, ensuring type-safe, error-handling side effects that persist user profiles to local storage without manual subscriptions.
Implement the logout effect in NgRx to clear user profile from local storage and redirect to login page, while reading the profile on startup to preserve login after refresh.
Learn to set up the NgRx router store and time-traveling debugger to replay actions, reflect router navigation, and debug login and logout flows.
Learn how NgRx runtime checks enforce strict state immutability, action immutability, and serializability to protect reducers and actions, support time traveling debugger, and introduce meta reducers.
Discover how meta reducers run before normal reducers and learn to implement a logging meta reducer step by step, covering their order, development environment, and preparation for entity data handling.
Learn to manage entity data for courses and lessons with NgRx entity library. Design actions to load data once at startup and serve from the store to reduce backend requests.
Define actions in NgRx by creating a course actions file, loading all courses via a router resolver, then using an effect to fetch from the backend and store the results.
Implement a courses resolver to prefetch backend data via the router, dispatch the load all courses action, and manage loading state with store and finalize in an observable.
Create a courses effects class that handles the load all courses action by fetching data from the backend (using concatMap) and dispatching the all courses loaded action to the store.
Understand how NgRx entity format stores courses as an entities dictionary with a separate IDs array to preserve order, and how the entity module simplifies reducers.
Learn how to manage courses with the NgRx entity adapter, using an entity format, an adapter with addAll, and initial state to implement reducers and selectors for a lazy-loaded feature.
Refactor the home component to consume the course list from the store with NgRx entity selectors, including select all, beginner and advanced filters, and promo total.
Configure an entity adapter in NgRx data to sort courses by their sequential number with a sort comparator, and learn when to use selectId versus the default ID field.
Implement a data fetching solution that loads courses only when needed by adding an all courses loaded flag, guarding the resolver with a selector, and preventing repeated backend calls.
Dispatch a course updated action from the edit dialog to update the store immediately, reflecting changes in the interface, while the entity update type handles the payload.
Perform optimistic data editing by saving course updates in the background with an NgRx effect, using concatMap and a backend put request while the user interface updates immediately.
Explore how NgRx data enables entity data management for courses and lessons, replacing manual actions, reducers, and effects with a streamlined in-memory store and optimistic updates.
Configure NgRx data for a lazy loaded courses module by defining course entity metadata and registering it with the entity definition service, then build a course entity service.
Learn how NgRx Data loads course data from the backend via a resolver, stores it in the store, and serves it during routing transitions using get all and observables.
Learn to optimize data loading in NgRx Data by using the loaded flag in the course entity cache and fetch data once with getAll before routing.
Employs the course entity service to query store data instead of backend calls, deriving beginner, advanced, and promotion data from entities$ and simplifying loading indicators with NgRx data.
Demonstrates implementing course CRUD with NgRx Data, including optimistic updates. Replaces manual http calls with the course entity service for instant UI updates and automatic backend synchronization.
Explore how NgRx data performs a pessimistic add to create a new course via a backend post, using a creation-mode dialog and updating the store after a successful save.
Implement optimistic delete for the course entity with the NgRx Data entity service, triggering an HTTP delete and updating the store immediately, following the default optimistic strategy.
Set up the lesson entity in an NgRx data-enabled angular app, defining its one-to-many relationship to course, adding a lesson entity service, and using the store for CRUD operations.
Refactor the course component to fetch data from the store using NgRx Data, via the course and lesson entity services, derive the course observable, and implement pagination for lessons.
Learn to implement paginated loading of course lessons with NgRx Data, combining lessons and course observables, filtering by course id, and adding a load more mechanism with a loading indicator.
Learn how to switch an Angular app to OnPush change detection, using input properties, immutable store data, observables, and the async pipe to update the user interface efficiently.
Understand why a centralized store supports complex user interfaces with multiple views and editable data across components. See how in-memory storage reduces server calls and improves performance.
This course is a complete guide to the new NgRx Ecosystem, including NgRx Data, Store, Effects, Router Store, NgRx Entity, and DevTools, and comes with a running Github repo
This Course in a Nutshell
State management is the number one topic to know when it comes to frontend architecture design choices. Why choose to do state management in a single page application, when to do it and why, what are the benefits, and what are tradeoffs?
These are all critical questions that we will address in this course, as we give you an extended guided tour of the NgRx Ecosystem.
The most popular state management library in the Angular space is NgRx, and for good reasons. The latest release of NgRx is probably one of the most important releases in the whole Angular ecosystem recently. Although backward compatible, it contains so much new functionality that it's almost a brand new state management library.
Under the hood, the core concepts of Actions, Reducers, Effects, Entities, and Selectors remain the same, but we have now a brand new API for managing these concepts in a much less verbose way. Also, we have the inclusion of NgRx Data, which is a new and very powerful way of managing Entity Data.
Actually, NgRx Data is a powerful abstraction layer on top of NgRx, that allows us to add state management to large parts of our application without having to write much code at all!
Course Overview
In this course, we are going to take a small existing application that is built without any state management. We are going to understand what are the consequences of not doing state management by identifying some problems that the application has in its initial form.
Then we are going to start refactoring the application, and we are going to add state management to the application multiple screens step-by-step. We are going to start with the Authentication features of the application, and then we are going to move on to the entity data management part.
We are going to explain at length all the key concepts of NgRx: Actions, Reducers, Effects, and Selectors, and we are going to explain in detail the Store architecture itself and understand its benefits.
Throughout the course we are going to introduce step-by-step and explain in detail the NgRx Store module, NgRx Effects, we are going to cover in detail NgRx Entity and the Entity format, we are going to install and do a guided tour of the NgRx Dev Tools, the NgRx Router Store, and the time-travelling debugger.
We are also going to learn how to make the most out of NgRx Data, and learn how to customize it in order to manage entity data with minimal application code. We will cover NgRx while keeping in mind best practices like good Action hygiene.
Table of Contents
This course covers the following topics:
Introduction to State Management
The Store Architecture In Detail
NgRx Key Concepts
Actions and Action Creators
Reducers
NgRx Effects
Selectors
Adding Authentication to an NgRx Application
NgRx Entity and the Entity Format
NgRx DevTools
NgRx Time Travelling Debugger
NgRx Runtime checks and Store Immutability
NgRx Router Store
NgRx Data and Entity State Management
NgRx Best Practices
What Will You Learn In this Course?
At the end of this course, you will feel comfortable with the notions of state management and the centralized store solution in general
You will feel comfortable designing new Applications using NgRx, using a simple methodology and you will know in-depth the complete Ngrx library ecosystem: including the Ngrx Store, Effects, Entity, and NgRx Data libraries
You will know how to quickly scaffold parts of the solution using Ngrx Schematics, and how to set up the Ngrx DevTools from scratch, including the router integration