TODO Application based on Flux with DDD
This application is simple TODO application by both Flux and DDD based.(It's state sourcing, not event sourcing)
Describing Layered Architecture
The following shows the layer architecture of this application.
The layer is what you need in order to isolate the domain layer from the other layers.
├── application │ ├── TodoAction.ts │ ├── TodoDispatcher.ts │ ├── TodoState.ts │ └── TodoStore.ts ├── domain │ ├── TodoAggregate.ts │ └── TodoRepository.ts ├── infrastructure │ └── Guid.ts └── ui ├── TodoActionCreator.ts ├── TodoActions.ts ├── TodoComponent.tsx ├── TodoViewModel.ts └── TodoViewModelConverter.ts
Direction of this application's dependency is the following. It's necessary for making simply relationships between components.
ui layer -> application layer -> domain layer | | | +---------------+----------------+-----> infrastructure layer
- UI Layer
- React and Action Creator of Flux
- Application Layer
- State and Dispatcher, Store of Flux
- Domain Layer
- TodoAggregate(is also Global Entity) that represent TODO concept.
- TodoRepository is a object to persist TodoAggregate.
- Infrastructure Layer
- Guid, etc
Difference of Flux's Store and DDD's Aggregate with Repository
Store is to support Application Logic and Application State. Even DDD, The roles of
Aggregate are like it,
Aggregate difference is responsibility in the Layer.
Store is in the Application Layer as the application's requirement,
Aggregate are in the Domain Layer which represent the domain's concept. Based on them, My idea is to implement
Store by using
How to integrate for Flux and DDD
According to the above way of thinking:
- Store which represent the Application State with Application Logic of Flux is realize by DDD's Repository and Aggregate.
- To convert from Aggregate to the view model which is used in React.Component.