DDD & co., part 10: Hello, wolkenkit

tl;dr: wolkenkit is a CQRS and event sourcing framework for JavaScript and Node.js. It provides the technical foundation to run applications that were modeled using domain-driven design.

In the episode From model to code, code was created to map the domain of TodoMVC to aggregates. Next, in the episode Coding the read model, code was created to interpret the domain events for the read side of the application.

As a result of focusing only on the domain, the code of the application is easy to understand so far. However, there are many aspects missing that are relevant for running the application. These include providing a REST and a WebSocket API as well as persistence.

As explained in the previous episodes, it makes sense to adopt an approach based on event-sourcing and CQRS. However, its implementation is time-consuming and has no relation to the actual application domain. It would therefore be wise to develop this structure once in a generic way, and then use it for various applications.

The result could be called a framework for event sourcing and CQRS, which works particularly well when the modeling of the application has been done with domain-driven design. This is exactly what the open source project wolkenkit aims to do.

Installing wolkenkit

The installation of wolkenkit differs slightly depending on the operating system. In addition to macOS, Linux and Windows, it also supports the installation on a server that is set up using docker-machine. As a result you always get the wolkenkit CLI, which can be run on the console:

$ wolkenkit --version

To start the TodoMVC application, it is sufficient to copy the code into a directory. You can find the complete source code in the GitHub repository thenativeweb/wolkenkit-todomvc. So, change to the directory that contains the code, and run the command

$ wolkenkit start

to start the application. The first call will take a few minutes, because wolkenkit has to download various Docker images from the web. However, this is a one-time step that is not necessary for all subsequent starts, which then happen significantly faster.

Apart from that, there's nothing more to do. wolkenkit starts a web server that offers the modelled domain via a REST and a WebSocket API, takes care of setting up the event store and the read database, and that wires the individual servers. This gives you a running backend without having to write a single line of technical code.

Starting the frontend

What is still missing is a frontend for the application. The code for this is also included in the aforementioned repository, which is a simple static web page with client-side JavaScript.

A simple web server is required to start the frontend. You can use npx (which is included as part of npm) to start it. Run

$ npx http-server. /client -o

on the terminal to start the web server and open the system's default web browser to access the TodoMVC application.

Develop better software faster

The example shows a different procedure than is often the case for software. Instead of starting right away, the first step is to use domain-driven design (DDD) to model the domain. The focus is purely on the subject of the domain, not on technology. At its core is the development of a ubiquitous language with which an interdisciplinary team can communicate.

The aggregates, commands and domain events modeled along the way can be seamlessly translated into code. Although the proximity to event sourcing and CQRS is not an inherent part of DDD, it is a practical necessity. This results in the handling of eventual consistency, which ultimately requires a synchronization of the write and read side.

wolkenkit helps teams to focus on the relevant aspects, i.e. modelling the domain with DDD. Without further ado, it delivers the necessary technical foundation, which speeds up application development. This leads to more time that can be used to discuss the desired product, instead of talking about implementation details of the technical structure, which should ultimately lead to better software.

wolkenkit is available in two versions. The community edition is available as a free download under an open source license. The enterprise edition offers additional functions and allows use in closed-source environments.

Further information about wolkenkit can be found in the detailed documentation, and a Slack team is available for the exchange with other interested parties and the developers of wolkenkit. For more details on the basic concepts DDD, event sourcing and CQRS, a free brochure is available for download.

Twitter Facebook LinkedIn

Golo Roden

Founder, CTO, and managing partner

Since we want to deliver elegant yet simple solutions of high quality for complex problems, we care about details with love: things are done when they are done, and we give them the time they need to mature.