A sandbox where I will experiment with new techniques, concepts, and technologies.

Overview

Kotlin Clean Architecture

Give a Star! ⭐

If you liked my work and want to support me, please give it a star. Thanks!

How to Run

The solution is not already containerized so there are some dependencies you must configure to run the application:

  • JDK 17
  • SQL Server Database
    1. Set credentials on Connection.kt in infra project
    2. Use the create.sql script on sql directory.

Introduction

A sandbox where I will experiment with new techniques, concepts, and technologies. Here you will find some DDD, CQRS, Clean Architecture, Event-Driven Architecture, Serverless, Microservices, RabbitMQ, gRPC, SOLID, Design Patterns, and more.

1. Architecture

For the app architecture I'm using a Clean Architecture model, splitting the solution into: Core, Infra, Services and Package layers. To control layers communication I've used Gradle to develop a Multi-Project architecture.

alt text

Core

The Core layer is responsible for the Domain Entities, Value Objects, Domain Services, Domain Events and Use Cases.

The organization is based upon Screaming Architecture concept by Uncle Bob that purposes that your application architecture should scream what the system does. So I've preferred an organization by context rather than by component type.

Other principle that I've followed was CQRS/CQS, so the Use Cases are divided into Write or Read operations. Also, any Use Cases has his owns Command, Query, Result and Handler, this last only for orchestration concerns.

The main focus is to keep the Domain isolated from external details.

alt text

Infra

The Infra Project is responsible for Repository Concerns (Schemas, Repository Implementations, and Database Connection), Dependency Injection and External Providers for integration or services consumption.

Services

These are projects that consumes the Core Use Cases. Can be APIs, gRPC Services, Serverless Functions, Console Applications or MVCs. As the domain does not depend upon, the consumption can be anything.

Shared Kernel

These are common resources that needs to be used between application layers, like Common Packages. This project is used to avoid circular dependencies between the other projects.

2. Dependencies Structure

alt text

3. Packages and Frameworks

The idea was treat Frameworks, Database, and Services(api) as details. So, I've avoided to use big frameworks and dependent services. For example, to build the API I've chosen Ktor and only used routing and request parsing, so it's easier to replace with other framework or technology.

  • Gradle - Build Management
  • Ktor - Web Framework
  • Koin - Dependency Injection
  • Ktorm - Object Relational Mapper (ORM)
  • Konform - Input Validation

4. Used Patterns and Principles

5. Next Steps

  1. Add new endpoints
  2. Add tests
  3. Containerization with Docker, Docker Compose and Kubernetes
  4. Integrate with Message Broker
  5. Serverless example
  6. CI/CD pipeline with GitHub Actions
  7. Authentication/Authorization
You might also like...
CodeLab for the workshop: A Composable New World
CodeLab for the workshop: A Composable New World

A Composable New World! Compose is here! πŸ™Œ I've created a codelab where you can follow step by step the development of android application using Comp

Kotlin Tutorials for new learners.

Kotlin Programming Tutorial for Beginners Learn Kotlin Programming, its basics and Fundamentals from scratch. Topics to be covered Overview Course int

Aagent-new-service-parent - A Springboot Rest Webservice Project that can be deployed to a Docker container

Webservice in a Docker Container A Springboot Rest Webservice Project that can b

Template to accelerate the creation of new apps using Spring Boot 3, MongoDB & GraphQL.

Template to accelerate the creation of new apps using Spring Boot 3, MongoDB & GraphQL.

HelloKMM - Hello World in Kotlin Multiplatform Mobile (new empty project)
HelloKMM - Hello World in Kotlin Multiplatform Mobile (new empty project)

Hello KMM! Hello World in Kotlin Multiplatform Mobile (new empty project) Gettin

An e-commerce app which provide a new platform to order food items from various restaurants
An e-commerce app which provide a new platform to order food items from various restaurants

Food_App_Internshala An e-commerce app which provide a new platform to order food items from various restaurants. Splash and Login Page Opening of the

New Relic Kotlin Instrumentation for Kotlin Coroutine. It successfully handles thread changes in suspend states.

new-relic-kotlin-coroutine New Relic Kotlin Instrumentation for Kotlin Coroutine. It successfully handles thread changes in suspend states. Usage 1- U

πŸƒ Multimodular Android MVVM Template I use whenever I start a new Android Project.

Android architecture starter template This template is compatible with the latest stable version of Android Studio. Features Room Database Hilt ViewMo

Exploring google's new android APIs

Exploring New android APIs 1. New Splash Screen API in Android 12 Starting in Android 12, the launch animation for all apps when running on a device w

Owner
Jefferson Didi Silva
Senior Development Engineer. Working with DDD, SOLID, Design Patterns, Clean and Hexagonal Architectures, CQRS, Event-Driven Architecture, Serverless, and TDD.
Jefferson Didi Silva
Build with Jetpack Compose & all modern techniques and architecture of android app development

IMDB Movie App Build with Jetpack Compose & all modern techniques and architecture of android app development ScreenShots ?? Built With ?? Kotlin - Fi

Jayant Kumar 7 Dec 17, 2022
Android-kotlin-lifecycles-management - LifeCycles Management Techniques

Activity Lifecycle - DessertPusher This is the toy app for lesson 4 of the Andro

Jeliel Augusto Mota 0 Jan 8, 2022
Project build to understand the concepts of Git and GitHub

Project build to understand the concepts of Git and GitHub. Summarizing the concepts learnt. Created a project in Android Studio Before installing And

Rifah A Khan 0 Oct 6, 2021
A basic, incomplete, buggy, far from efficient UI toolkit for Kotlin/Android. An experiment for fun and to learn.

Apex Apex is just a simple proof of concept to demonstrate how easily you can build your own UI Toolkit from scratch. This code base is most likely fu

Romain Guy 79 Sep 7, 2022
A basic, incomplete, buggy, far from efficient UI toolkit for Kotlin/Android. An experiment for fun and to learn.

Apex Apex is just a simple proof of concept to demonstrate how easily you can build your own UI Toolkit from scratch. This code base is most likely fu

Romain Guy 79 Sep 7, 2022
AGStateMachineBuilder - a library for easy creation of state machines using advanced concepts of kotlin

This is a library for easy creation of state machines using advanced concepts of kotlin. As of 2/15/2022, this library only works in kotlin, but will be expanded to work in Java later (whenever I get bored enough to rewrite an entire code structure in java :/ )

Sanjay Mohan 1 Feb 19, 2022
Exploring Kotlin Symbol Processing - KSP. This is just an experiment.

KSP example Exploring Kotlin Symbol Processing - KSP. This is just an experiment. Project contains 2 modules Processing Example Processing module is t

Merab Tato Kutalia 12 Aug 23, 2022
Checks for app updates and automatically updates the current app if the new one in local storage have a different version

Silent Android App Update Sample This sample shows how to update Android app silently without user confirmation with a device owner app. It works on A

Hamdi Guerbej 1 May 14, 2022
New style for app design Online Sunglasses Shop App UI made in Jetpack Compose.πŸ˜‰πŸ˜Ž

JetSunglassUI-Android New style for app design Online Sunglasses Shop App UI made in Jetpack Compose. ?? ?? (Navigation Components, Dagger-Hilt, Mater

Arvind Meshram 18 Dec 12, 2022
This is our new version of chatkit

ChatKitV4 (This read me is under develop) This is our new version of chatkit. Here we seprate Core Logic and UI sections. You can use it as seprate mo

Hamidreza amz 0 Jan 4, 2022