docs: add scalable application structure guidance#284
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new section titled "Scalable Application Structure" to the documentation, providing guidelines on feature-based file organization and dependency directions. The reviewer suggests several improvements to maintain consistency with the rest of the guide, such as including global Redux plumbing files (root-action.ts, root-epic.ts) in the directory examples, renaming types.ts to models.ts, and explicitly defining rules for cross-feature communication and selector dependencies.
| app/ | ||
| store.ts | ||
| root-reducer.ts |
There was a problem hiding this comment.
To maintain consistency with the rest of the guide (which references RootAction and RootEpic in the Store Configuration section), it is recommended to include these files in the app/ folder example. This clarifies where the global Redux plumbing resides.
| app/ | |
| store.ts | |
| root-reducer.ts | |
| app/ | |
| store.ts | |
| root-reducer.ts | |
| root-action.ts | |
| root-epic.ts |
| actions.ts | ||
| constants.ts | ||
| epics.ts | ||
| reducer.ts | ||
| selectors.ts | ||
| types.ts | ||
| components/ | ||
| containers/ | ||
| index.ts |
There was a problem hiding this comment.
The dependency direction rules mention services, but this file is missing from the example layout. Also, for consistency with existing examples in this guide (e.g., lines 1545, 1600), models.ts is preferred over types.ts for feature-specific type definitions.
| actions.ts | |
| constants.ts | |
| epics.ts | |
| reducer.ts | |
| selectors.ts | |
| types.ts | |
| components/ | |
| containers/ | |
| index.ts | |
| actions.ts | |
| constants.ts | |
| epics.ts | |
| reducer.ts | |
| selectors.ts | |
| services.ts | |
| models.ts | |
| components/ | |
| containers/ | |
| index.ts |
| - dumb components -> feature static types | ||
| - smart/connected components -> feature selectors + actions -> feature static types | ||
| - reducer -> feature actions -> feature static types | ||
| - side-effects (epics/thunks/sagas) -> feature actions + selectors + services -> feature static types | ||
| - services -> feature static types |
There was a problem hiding this comment.
Adding a rule for selectors and an explicit rule for cross-feature communication would make this guide more robust. It ensures that developers know how to handle dependencies between different features while maintaining isolation.
| - dumb components -> feature static types | |
| - smart/connected components -> feature selectors + actions -> feature static types | |
| - reducer -> feature actions -> feature static types | |
| - side-effects (epics/thunks/sagas) -> feature actions + selectors + services -> feature static types | |
| - services -> feature static types | |
| - dumb components -> feature models | |
| - smart/connected components -> feature selectors + actions -> feature models | |
| - selectors -> feature models | |
| - reducer -> feature actions -> feature models | |
| - side-effects (epics/thunks/sagas) -> feature actions + selectors + services -> feature models | |
| - services -> feature models | |
| - cross-feature imports -> other feature public API (index.ts) |
| app/ | ||
| store.ts | ||
| root-reducer.ts |
| actions.ts | ||
| constants.ts | ||
| epics.ts | ||
| reducer.ts | ||
| selectors.ts | ||
| types.ts | ||
| components/ | ||
| containers/ | ||
| index.ts |
There was a problem hiding this comment.
Including services.ts and using models.ts (for consistency with other examples) would improve the clarity of the feature module layout.
| actions.ts | |
| constants.ts | |
| epics.ts | |
| reducer.ts | |
| selectors.ts | |
| types.ts | |
| components/ | |
| containers/ | |
| index.ts | |
| actions.ts | |
| constants.ts | |
| epics.ts | |
| reducer.ts | |
| selectors.ts | |
| services.ts | |
| models.ts | |
| components/ | |
| containers/ | |
| index.ts |
| - dumb components -> feature static types | ||
| - smart/connected components -> feature selectors + actions -> feature static types | ||
| - reducer -> feature actions -> feature static types | ||
| - side-effects (epics/thunks/sagas) -> feature actions + selectors + services -> feature static types | ||
| - services -> feature static types |
There was a problem hiding this comment.
Expanding the dependency rules to include selectors and cross-feature boundaries helps in building truly scalable applications.
| - dumb components -> feature static types | |
| - smart/connected components -> feature selectors + actions -> feature static types | |
| - reducer -> feature actions -> feature static types | |
| - side-effects (epics/thunks/sagas) -> feature actions + selectors + services -> feature static types | |
| - services -> feature static types | |
| - dumb components -> feature models | |
| - smart/connected components -> feature selectors + actions -> feature models | |
| - selectors -> feature models | |
| - reducer -> feature actions -> feature models | |
| - side-effects (epics/thunks/sagas) -> feature actions + selectors + services -> feature models | |
| - services -> feature models | |
| - cross-feature imports -> other feature public API (index.ts) |
|
Updated based on review suggestions:\n- feature layout now uses models.ts + includes services.ts\n- dependency direction now explicitly includes selectors and cross-feature public API rules\n- app folder example includes root action/epic files for consistency\n\nPushed in latest commit on issuehunt-42-scalable-application-structure. |
Closes #42
Adds a dedicated "Scalable Application Structure" section with:
IssueHunt Summary
Referenced issues
This pull request has been submitted to: