This is a sample app to demonstrate the power of using EventSourced models and the ease with which these can be modelled using Kotlin.

Overview

Lego 4 Rent

This is a sample app to demonstrate the power of using EventSourced models and the ease with which these can be modelled using Kotlin.

To get an idea how this works in real-live, look at sites like: www.bricksverhuur.nl

detectivekantoor millennium-falcon liebherr-r-9800

How to use

This code is intended to be used as part of a workshop, where you start with a basic part of the application and use the stories defined below to add bits and pieces of functionality by making use of EventSourcing and CQRS.

Context Map

The Context Map below gives an impression of the domains at play for renting out lego sets and the concepts that play a role in that.

The greyed out blocks are parts that are have been left out of this sample, but could be interesting to explore if you want to add additional functionality for it.

Context Map

EventStorming

TODO

Architecture

Below is a C4 Container diagram that gives an impression of the high-level architecture of the complete application.

At this moment, only the code for the Lego4Hire API server is included in this codebase. The UIs might be added later.

C4 Container Diagram

Data flow

TODO

Stories

Story 1

Look at the code that saves events to the event store and publishes events.

See KeyValueBasedEventStore

What could go wrong here?

Once you've figured that out, what could you do to prevent that?

Write down your suggested approach to resolve that and ping the trainer.

What do you think? Do you need a framework or library to solve this?

Story 2

As a store, I want to see which sets are most popular, So I can plan which ones to keep on stock.

Build the following.

  • Projection for report of popular sets
    • Result table:
      • set nr (random from catalog)
      • set name (idem)
      • times booked last 2 weeks (desc)
      • times booked (last 2 months)
      • times booked (all time)

Sample test data and a test case are already in place.

Remove the @Ignore on PopularSetsProjectionTest and make it pass.

Story 3

You find out that some events coming from the integration event bus are being received twice.

How could you ensure that events are only handled once? (i.e. idempotent event processing)

When done, review your implementation. What do you think? Do you need a framework or library for this?

Backlog

  • Story: As a store, I want to see how many builders return their sets late and by how many days, So that I can decide how to deal with late returns

    • Projection: Report of late returns
      • Result table:
        • Days late
        • Nr of bookings
  • Story: As a lego builder, I want to book multiple sets of the same type, So I can throw a lego party and me and my friends can see who can build it the fastest.

    • Adjust command to indicate book for that set
    • Easy: should be trivial to add amount to command and adjust event, projections etc should just work
  • Story: As a store, I want to be notified of late returns over 2 days, So that we can send invoices for late fees.

    • [Inventory] Projection: capture booking and return events, store booking events with date.
      • On return, calculate amount overdue and publish integration event
    • [Payment]: capture overdue events and if > 2 days, send notification email
  • Story: As a store, I want automated notifications to be sent out to builders that need to return their sets in 3 days and have not already done so, So that they hopefully return their sets before we have to invoice late fees. Late fee handling is costing us a lot of time, and the fees are not good for the satisfaction ratings of builders, so we'd rather prevent them.

    • [Inventory] Projection: track events about bookings and returns, keep track of open bookings.
    • On schedule: look at open bookings, if booking date results in almost needing to return, send reminder.
  • Story: As a store, I want to register when a booking is shipped to a builder, So that we can track which builders have which of our sets.

    • View booked sets that need to be shipped
    • Address of builder
    • Add command: Set shipped
  • Story: As a lego builder, I want to book multiple sets at once, So I only have to pay shipping once.

    • Add command or adjust existing command
    • Problem: booking is now per set... just handle in service? Or change aggregate to 'multiple sets'?
  • Story: As a lego builder, I want to share photos of my build, So I can show off my sick building skills.

You might also like...
A complete Kotlin application built to demonstrate the use of Modern development tools with best practices implementation using multi-module architecture developed using SOLID principles
A complete Kotlin application built to demonstrate the use of Modern development tools with best practices implementation using multi-module architecture developed using SOLID principles

This repository serves as template and demo for building android applications for scale. It is suited for large teams where individuals can work independently on feature wise and layer wise reducing the dependency on each other.

📒 NotyKT is a complete 💎Kotlin-stack (Backend + Android) 📱 application built to demonstrate the use of Modern development tools with best practices implementation🦸.
📒 NotyKT is a complete 💎Kotlin-stack (Backend + Android) 📱 application built to demonstrate the use of Modern development tools with best practices implementation🦸.

NotyKT 🖊️ NotyKT is the complete Kotlin-stack note taking 🖊️ application 📱 built to demonstrate a use of Kotlin programming language in server-side

Shoppe - Kotlin and Ktor app, which can easily be deployed to Heroku

[ 🚧 Work in progress 👷‍♀️ ⛏ 👷 🔧️ 👷 🔧 🚧 ] Shoppe Kotlin Multiplatform App

Hands-on experiments to demonstrate the exploitability of insecure TLS configurations in Android apps

Containerized Demo for Insecure TLS Certificate Checking in Android Overview Thi

Sample demonstrates use of Flow, StateFlow & how we can test Flow

FlowSample This sample demonstrates use of Flow, StateFlow & how we can test Flow. In Kotlin, Coroutine is just the scheduler part of RxJava but now w

sample project that shows you how you can use Ktor to creat a server for real Project.

Ktor-Sample This is a sample project that shows you how you can use Ktor to creat a server for real Project. What is done Save data to database (Get a

An open source app which can be used to do basic surveys
An open source app which can be used to do basic surveys

SurveyApp This is an open source app which can be used to do basic surveys. It supports multiple question types. For demo please check the releases pa

A tip app which the user can use a screen bar to choose a tip based on the service, the total is then displayed.

Tip Calculator Spencer Damon Tippy Total computes the tip and total amount for a bill. The app uses the base amount and tip percentage to calculate th

Owner
Nico Krijnen
Nico Krijnen
Sample app to demonstrate the integration code and working of Dyte SDK for android, using Kotlin.

Dyte Kotlin Sample App An example app in kotlin using the Dyte Mobile SDK Explore the docs » View Demo · Report Bug · Request Feature Table of Content

Dyte 8 Dec 3, 2021
Clean MVVM with eliminating the usage of context from view models by introducing hilt for DI and sealed classes for displaying Errors in views using shared flows (one time event), and Stateflow for data

Clean ViewModel with Sealed Classes Following are the purposes of this repo Showing how you can remove the need of context in ViewModels. I. By using

Kashif Mehmood 22 Oct 26, 2022
Shreyas Patil 2.2k Jan 4, 2023
An AutoValue extension that generates binary and source compatible equivalent Kotlin data classes of AutoValue models.

AutoValue Kotlin auto-value-kotlin (AVK) is an AutoValue extension that generates binary-and-source-compatible, equivalent Kotlin data classes. This i

Slack 19 Aug 5, 2022
Bukkit library written in Kotlin to make with compatibility and ease non-playable-character (NPC)

mc-npk Easy to use, fast and efficient library to make non-playable-characters (

Luiz Otávio 3 Aug 4, 2022
LocalisationDemo - A sample project to demonstrate localization in android

LocalisationDemo This is a sample project to demonstrate localization in android

shubham423 0 Jan 8, 2022
A sample to demonstrate how to use Compose with Ktor Websockets

This is a sample to demonstrate how to use Compose with Ktor Websockets

Ahmed Nabil 8 Dec 23, 2022
Tiny library to ease the use of environment variables with support for .env files

asimov/environment Tiny library to ease the use of environment variables with support for .env files. Installation Gradle (Kotlin) repositories {

Nicolas Bottarini 1 Jan 8, 2022
A sample skeleton backend app built using Spring Boot kotlin, Expedia Kotlin Graphql, Reactive Web that can be deployed to Google App Engine Flexible environmennt

spring-kotlin-gql-gae This is a sample skeleton of a backend app that was built using: Spring Boot(Kotlin) Reactive Web Sprinng Data R2DBC with MYSQL

Dario Mungoi 7 Sep 17, 2022
A very simple Android app which shows you random memes with the help of meme-api which you can share with your friends!

Meme Share A very simple Android app which shows you random memes with the help of meme-api which you can share with your friends! Tech stack 100% wri

Stɑrry Shivɑm 8 Aug 10, 2022