This is a simple application that mimic a board management tool such as
Trello but with a very limited scope. The motivation behind this is to drill down into a CQRS
"Command Query Responsibility Segregation" architecture by covering a wide range of concepts such
as Aggregate
, Command handler
, Even Store
, Projection
and View
) with a simple domain but
complex enough to highlights the challenges involved with this architecture.
CQRS states that an application architecture is divided in two parts:
-
Command side: Also referred as the write side, where commands are validated and turned into events that are persisted and published. An important attribute of a command is that it conveys the intent of the user. In contrast with the CRUD-based approach, where four basic operations are available for users CRUD (
Create
,Edit
,Save
andDelete
). As a consequence CQRS, goes hand in hand with the Task-Based User Interface pattern. -
Query side: Also referred as the read side, where events are combined to create view models that are optimized to serve client requests. Unlike commands, queries do not need to involve the Domain Model because queries do not execute any operations and should not contain any business logic. In addition, queries have no side effects and are completely idempotent, unless the system state changed in the meantime.
Note, in this application we implement CQRS architecture in combination with Event Sourcing , but CQRS without Event Sourcing is still a viable architectural approach offering quite some benefits.
The application exposes the following features through a REST API that can be accessed through
swagger at http://localhost:8080/swagger-ui.html#/
.
-
Create a board.
-
Update a board name.
-
Archive a board.
-
Create a list of card.
-
Create a card.
-
Read a board.
The is a self contained application based on Spring Boot that runs an embedded servlet container running by default on port 8080 that expose a REST API. The following list the main frameworks and libraries used to implement this application:
- spring boot: Simple and rapid framework to create simple and web based applications.
- lombok : Framework auto generating code for java (getter, setter, ...).
- vavr: Functional library for java.
- embedded mongodb : Lightweight in -memory mongodb database.
- swagger: Specification for machine-readable interface files for describing, producing, consuming, and visualizing RESTful web services
- Junit 5: The next generation of testing framework for java.
- AssertionsJ: Fluent assertions for java.
- Java 11 or higher
- Maven 3.5 or higher
mvn clean package
Run the main class BoardManagementApplication
.
Open your terminal, navigate to the BoardManagementApplication
source directory then run the
following command:
mvn spring-boot:run
Open your terminal, navigate to the BoardManagementApplication
source directory then run the
following command:
java -jar target/board-management-api-0.0.1-SNAPSHOT.jar