A module which represents part of a Reaat app could export an array of routes and a reducer.
export {default as routes} from './routes'
export {default as reducer} from './store/reducer'
The top level application can take these exports and collect them together into the root routes def and the root reducer.
source
├── app
│ ├── components
│ │ ├── SimpleDonut
│ │ │ ├── __tests__
│ │ │ │ └── SimpleDonut-test.js
│ │ │ └── index.js
│ │ └── View
│ │ └── index.js
│ ├── lib
│ │ ├── getEnv
│ │ │ └── index.js
│ │ └── resolveAsset
│ │ └── index.js
│ ├── modules
│ │ ├── beneficiaries
│ │ │ ├── store
│ │ │ │ ├── __tests__
│ │ │ │ │ └── factories.js
│ │ │ │ ├── helpers
│ │ │ │ │ └── index.js
│ │ │ │ └── reducer
│ │ │ │ └── index.js
│ │ │ └── index.js
│ │ ├── campaigns
│ │ │ ├── store
│ │ │ │ ├── __tests__
│ │ │ │ │ └── factories.js
│ │ │ │ ├── helpers
│ │ │ │ │ └── index.js
│ │ │ │ └── reducer
│ │ │ │ └── index.js
│ │ │ └── index.js
│ │ ├── donations
│ │ │ ├── store
│ │ │ │ ├── __tests__
│ │ │ │ │ └── factories.js
│ │ │ │ ├── helpers
│ │ │ │ │ └── index.js
│ │ │ │ └── reducer
│ │ │ │ └── index.js
│ │ │ └── index.js
│ │ ├── errors
│ │ │ └── index.js
│ │ ├── fundraiserCampaigns
│ │ │ ├── components
│ │ │ │ ├── FundraiserSummary
│ │ │ │ │ ├── __tests__
│ │ │ │ │ │ └── FundraiserSummary-test.js
│ │ │ │ │ └── index.js
│ │ │ │ ├── FundraisingProgress
│ │ │ │ │ ├── __tests__
│ │ │ │ │ │ └── FundraisingProgress-test.js
│ │ │ │ │ └── index.js
│ │ │ │ ├── Summary
│ │ │ │ │ └── index.js
│ │ │ │ └── __tests__
│ │ │ │ └── helpers.js
│ │ │ ├── routes
│ │ │ │ ├── Show
│ │ │ │ │ ├── __tests__
│ │ │ │ │ │ └── Show-test.js
│ │ │ │ │ └── index.js
│ │ │ │ ├── __tests__
│ │ │ │ │ └── helpers.js
│ │ │ │ └── index.js
│ │ │ ├── store
│ │ │ │ ├── __tests__
│ │ │ │ │ └── factories.js
│ │ │ │ ├── actions
│ │ │ │ │ ├── __tests__
│ │ │ │ │ │ └── fetchFundraiserCampaign-test.js
│ │ │ │ │ └── index.js
│ │ │ │ ├── helpers
│ │ │ │ │ └── index.js
│ │ │ │ ├── reducer
│ │ │ │ │ ├── list
│ │ │ │ │ │ └── index.js
│ │ │ │ │ ├── show
│ │ │ │ │ │ └── index.js
│ │ │ │ │ └── index.js
│ │ │ │ ├── constants.js
│ │ │ │ └── index.js
│ │ │ └── index.js
│ │ └── fundraisers
│ │ ├── store
│ │ │ ├── __tests__
│ │ │ │ └── factories.js
│ │ │ ├── helpers
│ │ │ │ └── index.js
│ │ │ ├── reducer
│ │ │ │ └── index.js
│ │ │ └── index.js
│ │ └── index.js
│ ├── routes
│ │ └── index.js
│ ├── store
│ │ ├── reducer
│ │ │ └── index.js
│ │ ├── constants.js
│ │ └── index.js
│ ├── index.js
│ └── stats.js
├── client
│ ├── index.js
│ └── stats.js
├── config
│ ├── clientEnvRequirements.js
│ └── index.js
└── server
├── components
│ └── Document.js
├── lib
│ └── renderDocument.js
├── index.js
└── stats.js
As per our discussion Brad, I think the structure has a strong advantage in mapping to the url, so that maintenance/new features become easier to quickly find and work on. I think the name "routes" is a bit off, and the
handlers
folder is a bit confusing. I'd be most happy with this structure if routes predominantly contained components which delegate and manage data/entities/resources, while actual dom-rendering UI components were made more generic, in the top-levelcomponents
folder (though under some sort of shallow logical grouping hierarchy).