https://github.com/bitflut/ng-frrri
Readable data flow from your Angular router to your state management
https://github.com/bitflut/ng-frrri
angular crud routing state-management
Last synced: 3 months ago
JSON representation
Readable data flow from your Angular router to your state management
- Host: GitHub
- URL: https://github.com/bitflut/ng-frrri
- Owner: bitflut
- Created: 2020-05-25T14:41:28.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-06-10T00:48:03.000Z (almost 4 years ago)
- Last Synced: 2025-10-08T23:59:07.881Z (6 months ago)
- Topics: angular, crud, routing, state-management
- Language: TypeScript
- Homepage: https://bitflut.gitbook.io/ng-frrri/
- Size: 1.32 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
:racing_car: :racing_car: @ng-frrri :racing_car: :racing_car:
Data flow at 250 km/h
## @ng-frrri/router-middleware
### Synopsis
We have many years of experience building and reviewing enterprise applications using Angular. Most applications communicate with apis and use state management patterns for their UIs, preferably with @ngrx, @ngxs or Akita.
We were able to reduce a lot of boilerplate code with @ngrx/data, but the way data was fetched and displayed was still hard to figure out in most applications. We needed to look through reducers, effects, resolvers and components in order to understand how data is flowing.
Ideally, we figured, you should be able to read an application's data flow simply by looking at its routes. So we came up with a data flow pattern solution that hooks into Angular's router (and a silly name). Here is @ng-frrri/router-middleware.
### What it looks like:
```typescript
import { operate } from '@ng-frrri/router-middleware';
import { getMany, getActive, reset } from '@ng-frrri/router-middleware/operators';
const all = 'entities';
const posts = 'entities.posts';
const routes: Routes = [
{
path: 'posts',
data: operate(
reset(all),
getMany(posts),
),
children: [
{
path: ':id',
data: operate(
getActive(posts),
),
},
],
},
];
```
## Integrations
As of now, we have integrated our router-middleware with @ngxs, our state management solution of choice these days.
Until documentation catches up, see the ng-integration example in the GitHub repository.
## License
[](http://badges.mit-license.org)