I found that the first structure is suitable for a rather small application when using reducers, actions, or others in several SMART components in the application.
Although this helps to delimit problems, I found it rather tedious to jump between different directories.
Usually work with, i.e. user.reducer.ts , associated with working with other files: effect, actions, etc. So the second approach seems a bit neater.
I would like to suggest a 3rd structure that can fit, and one that follows the βbarrelβ approach in angular2:
- store - user - index.ts - user.actions.ts - user.effects.ts - user.reducer.ts - user.reducer.spec.ts
In this structure, the user directory is a barrel that provides various logic components that can be imported separately only by importing the user, that is:
import { reducer as UserReducer } from '../store/user'; // or import { UserReducer } from '../store/user'
I am experimenting with these approaches in my open source media player application - Echoes Player - http://github.com/orizens/echoes-player
As mentioned in another comment, these strategies and architecture applied to echo players are compiled into ngrx styleguide
source share