DDD Firework is a framework that supports the implementation of DDD (Domain-Driven Design). It provides a complete lifecycle wrapper for domain entities, including creation, modification, persistence, event sending, event listening, and integration with components such as locks, databases, and eventbuses.
Features
Providing a unified application-level interface ICommand to encapsulate the entire lifecycle (build, behavior, persistence, event sending, etc.) management of domain layer entities.
Automatic detection of changes to domain entities and persistence, without the need for users to handle complex storage logic.
Support for rapid rebuild of complex aggregations (multiple levels of entity combinations), without the need to write specific query statements.
Support for domain events, including domain event sending, registration of listener functions, and event callbacks.
Hexagonal architecture with abstract definitions of each underlying component (locks, persistence, event buses, etc.) allows for flexible pluggable components.
Architecture
Usage
Define domain entities
import ddd "github.com/bytedance/dddfirework"
type Order struct {
ddd.BaseEntity
UserID string
TotalAmount int64
Remark string
}
English | 中文README
Overview
DDD Firework is a framework that supports the implementation of DDD (Domain-Driven Design). It provides a complete lifecycle wrapper for domain entities, including creation, modification, persistence, event sending, event listening, and integration with components such as locks, databases, and eventbuses.
Features
Architecture
Usage
Define domain entities
Register persistence models
Execute command
More Example
ref: example/main.go