All Projects → Creditas → Kotlin Ddd Sample

Creditas / Kotlin Ddd Sample

A sample DDD/CQRS project using KOTLIN 🍺

Programming Languages

kotlin
9241 projects

Labels

Projects that are alternatives of or similar to Kotlin Ddd Sample

Eshoponcontainersddd
Fork of dotnet-architecture/eShopOnContainers in full DDD/CQRS design using my own patterns
Stars: ✭ 126 (-13.1%)
Mutual labels:  ddd, cqrs
Todomvc Ddd Cqrs Eventsourcing
Implementation of basic Todo app via tastejs/todomvc in C#/Typescript with eventsourcing, cqrs, and domain driven design
Stars: ✭ 134 (-7.59%)
Mutual labels:  ddd, cqrs
Pdo Event Store
PDO implementation of ProophEventStore http://getprooph.org
Stars: ✭ 96 (-33.79%)
Mutual labels:  ddd, cqrs
Dotnetcore Microservices Poc
Very simplified insurance sales system made in a microservices architecture using .NET Core
Stars: ✭ 1,304 (+799.31%)
Mutual labels:  ddd, cqrs
Java Ddd Example
☕🎯 Hexagonal Architecture + DDD + CQRS in a Java project using SpringBoot
Stars: ✭ 119 (-17.93%)
Mutual labels:  ddd, cqrs
Event Store Symfony Bundle
Event Store Symfony Bundle
Stars: ✭ 93 (-35.86%)
Mutual labels:  ddd, cqrs
Cronus
Cronus is a lightweight framework for building event driven systems with DDD/CQRS in mind
Stars: ✭ 139 (-4.14%)
Mutual labels:  ddd, cqrs
Bankflix
Aplicação que simula um banco digital, contendo a área do cliente e administrativa, permitindo depósitos e transferências entre contas do mesmo banco. | Application that simulates a digital bank, containing the customer and administrative areas, allowing deposits and transfers between accounts of the same bank.
Stars: ✭ 82 (-43.45%)
Mutual labels:  ddd, cqrs
Bifrost
This is the stable release of Dolittle till its out of alpha->beta stages
Stars: ✭ 111 (-23.45%)
Mutual labels:  ddd, cqrs
Dev Stuff
😎 Programming stuff for everyone. Collection of articles, videos about architecture, Domain Driven Design, microservices, testing etc.
Stars: ✭ 105 (-27.59%)
Mutual labels:  ddd, cqrs
Productcontext Eventsourcing
A practical/experimental Event Sourcing application on Product Bounded Context in an e-commerce
Stars: ✭ 88 (-39.31%)
Mutual labels:  ddd, cqrs
Interviews
A list of fancy questions I've been asked during the interviews I had. Some of them I ask when interviewing people.
Stars: ✭ 140 (-3.45%)
Mutual labels:  ddd, cqrs
Aspnetcore Ddd
Full ASP.NET Core 3.1 LTS application with DDD, CQRS and Event Sourcing
Stars: ✭ 88 (-39.31%)
Mutual labels:  ddd, cqrs
Java Ddd Skeleton
♨️ DDD in Java skeleton & examples. Course:
Stars: ✭ 140 (-3.45%)
Mutual labels:  ddd, cqrs
Sample Dotnet Core Cqrs Api
Sample .NET Core REST API CQRS implementation with raw SQL and DDD using Clean Architecture.
Stars: ✭ 1,273 (+777.93%)
Mutual labels:  ddd, cqrs
Php Ddd Example
🐘🎯 Hexagonal Architecture + DDD + CQRS in PHP using Symfony 5
Stars: ✭ 1,960 (+1251.72%)
Mutual labels:  ddd, cqrs
Event Sourcing Castanha
An Event Sourcing service template with DDD, TDD and SOLID. It has High Cohesion and Loose Coupling, it's a good start for your next Microservice application.
Stars: ✭ 68 (-53.1%)
Mutual labels:  ddd, cqrs
Nestjs Cqrs Starter
NestJS CQRS Microservices Starter Project
Stars: ✭ 80 (-44.83%)
Mutual labels:  ddd, cqrs
Quiz
Example real time quiz application with .NET Core, React, DDD, Event Sourcing, Docker and built-in infrastructure for CI/CD with k8s, jenkins and helm
Stars: ✭ 100 (-31.03%)
Mutual labels:  ddd, cqrs
Goes
Go Event Sourcing made easy
Stars: ✭ 144 (-0.69%)
Mutual labels:  ddd, cqrs

Kotlin DDD Sample

Kotlin DDD Sample is a open-source project meant to be used as a start point, or an inspiration, for those who want to build Domain Driven Design applications in Kotlin. The domain model was inspired by this repo where we built a sample project using Rails.

NOTE: This is NOT intended to be a definitive solution or a production ready project

Technologies/frameworks/tools involved

  • Spring
  • Axon Framework
    • CommandGateway (Command Handlers)
    • EventBus (Event Handlers)
  • Gradle

Architecture overview

Layers

  • Web: Spring controllers and actions
  • Application: Orchestrates the jobs in the domain needed to be done to accomplish a certain "use case"
  • Domain: Where the business rules resides
  • Infrastructure: Technologies concerns resides here (database access, sending emails, calling external APIs)

CQRS

CQRS splits your application (and even the database in some cases) into two different paths: Commands and Queries.

Command side

Every operation that can trigger an side effect on the server must pass through the CQRS "command side". I like to put the Handlers (commands handlers and events handlers) inside the application layer because their goals are almost the same: orchestrate domain operations (also usually using infrastructure services).

command side

Query side

Pretty straight forward, the controller receives the request, calls the related query repo and returns a DTO (defined on infrastructure layer itself).

query side

The domain (problem space)

This project is based on a didactic domain that basically consists in maintaining an Order (adding and removing items in it). The operations supported by the application are:

  • Create an order
  • Add products ta a given order
  • Change product quantity
  • Remove product
  • Pay the order (this operation fires an Event for the shipping bounded context)
  • Shipping (side effect of the above event): ships product and notify user

Pretty simple, right?

Setup

Linux/MacOS:

./gradlew build

Windows:

gradlew.bat build

RabbitMQ setup

There is a file named AMQPRabbitConfiguration in this repo (located here) where the configuration needed by axon to integrate with RabbitMQ (to send end receive persistent messages) is stored. To use that, just remove the comments.

You need a running rabbit, you can start one in a docker container using the following commands:

docker pull rabbitmq
docker run -d --hostname my-rabbit --name some-rabbit rabbitmq:3-management

You can access the rabbit UI by this url: http://172.17.0.2:15672.

  • User: guest
  • Password: guest

That's it. You don't need to do anything else, the setup in the AMQPRabbitConfiguration class will create the necessary queue and exchange in Rabbit and also configure axon accordingly. Note that if you customize something in your rabbit server you need to adjust the application.properties file (here we are using the default ports, ips, etc).

This both dependencies are used just for Rabbit:

  • org.springframework.boot:spring-boot-starter-amqp: enables AMQP in Spring Boot
  • org.axonframework:axon-amqp: configures some beans for axon to integrate with SpringAMQPMessageSource class from the above dependency

If you don't want o use an AMQP you can remove this dependencies from the web project gradle's file.

Tests

./gradlew test

Postman requests

You can trigger all the operations of this project using the requests inside this json (just import it on your local postman).

Backlog

  • [x] Implement Unit Tests examples (Domain layer)
  • [ ] Implement Integrated Tests examples (Web layer)
  • [ ] Include docker container with JDK and gradle configured
  • [ ] Configure Swagger and Swagger UI
  • [ ] Include a Event Sourced bounded context or Aggregate
  • [ ] Domain Notifications instead of raising exceptions
  • [ ] Implement concrete repositories with JPA (the current implementations just returns fake instances)
  • [ ] Configure JPMS (java 9 modules)

Contributions are welcome! 💓

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].