This repository demonstrates different architectures of the same simple use case.
The application has
-
one external endpoint
-
one use case
-
one aggregate
-
one entity
-
two value objects
-
-
one database table
CREATE TABLE IF NOT EXISTS subscriptions (
id BINARY(36) PRIMARY KEY,
email VARCHAR(512) NOT NULL,
status VARCHAR(256) NOT NULL,
created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
version BIGINT NOT NULL
);
-
Import in your favourite IDE
-
Start each project as a spring boot application individually or run
./mvnw spring-boot:run
-
Four conditions can be tested
-
To verify DB records, go to:
URL
JDBC URL
jdbc:h2:mem:testdb
username
sa
password
password
# | Name | Architecture | Summary | Pros | Cons |
---|---|---|---|---|---|
1 |
Anarchy Architecture |
Everything is completely wrong |
Job Security |
Chaotic Mess |
|
2 |
Layered Architecture |
Traditional 3-layer architecture |
Simple |
Poor package naming by technical functions |
|
2 |
Minimal DDD Architecture |
Small Improvement of Layered Architecture |
Simple |
No "Modeling" |
|
3 |
DDD Architecture |
More Improvement of Layered Architecture |
Clear boundary |
Extra complexity |
|
5 |
Hexagonal Architecture (Ports and Adapters) |
More Improvement of Layered Architecture |
Clear boundary |
Extra complexity |
|
7 |
Functional Domain Driven Design |
Implement DDD using Clojure |
Functional |
Difficult to get start |