Repositories
DugongJS defines three repository ports that must be implemented to support persistence and event sourcing:
DugongJS defines three repository ports that must be implemented to support persistence and event sourcing:
DugongJS reconstructs aggregates state by loading its domain events from the domain event repository and applying them in order. As the number of events grows, this rehydration process becomes slower. To mitigate this, DugongJS supports snapshotting. This is an optional optimization that allows you to cache and restore aggregate state more efficiently. It is opt-in per aggregate and you may enable it from the start or at a later time if performance should become an issue.