Skip to content
CAI
Software that uses CAICheck a score

htnk128/kotlin-ddd-sample

64.6

Adequate · 21 September 2026

3.2k

lines of production code

Kotlin

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a Domain-Driven Design reference implementation built with Kotlin and Spring WebFlux, structured around distinct bounded contexts for account and address management. It provides RESTful APIs to create, read, update, and delete accounts and associated addresses, while enforcing domain integrity through value objects, repositories, and domain events. The architecture separates core domain logic from infrastructure concerns, utilizing a modular design with shared abstractions for event publishing and error handling.

How it got here

2018–2019 — DDD domain model implementation

10 changes.

The project was refocused on Domain-Driven Design, evidenced by the renaming to 'kotlin-ddd-sample' and the introduction of core domain models for Account and Address. This period involved establishing the foundational domain logic, including entities, value objects, and domain events, alongside corresponding database migrations and comprehensive unit tests.

2020–2022 — DDD architecture and API implementation

5 changes.

This period focused on establishing a Domain-Driven Design architecture, introducing core domain abstractions, repositories, and domain models for account and address management. The work also involved implementing Spring WebFlux/Boot infrastructure, including REST controllers, error handling, and database utilities to support these domains.

Features

Account domain model and event tracking introduced

The Account domain model now supports creating, updating, and deleting accounts, with each operation generating corresponding domain events (AccountCreated, AccountUpdated, AccountDeleted). The model includes value objects for email, name, name pronunciation, and password, along with specific exception types for invalid states, invalid requests, not found, and update failures.

account/src/main/kotlin/htnk128/kotlin/ddd/sample/account/domain/model/account · high confidence

Add Spring Boot application entry points and REST controllers for Account and Address services

Introduced Spring Boot application classes and REST controllers for the Account and Address domains. Each domain now has an Application class to bootstrap the Spring context, configuration classes for transaction management, Jackson, and Swagger documentation, and a REST controller exposing standard CRUD endpoints (find, findAll, create, update, delete) with Swagger annotations for API documentation.

account/src/main/kotlin/htnk128/kotlin/ddd/sample/account/external, address/src/main/kotlin/htnk128/kotlin/ddd/sample/address/external · high confidence

Added core DDD domain abstractions

Introduced foundational interfaces and abstract classes for Domain-Driven Design, including DomainEvent, DomainEventPublisher, DomainEventSubscriber, Entity, Identity, and ValueObject. These additions provide the core building blocks for defining domain models, managing events, and ensuring identity and value object semantics within the ddd-core module.

ddd-core · high confidence

Added initial database migration for the address table

A new database migration script (V1\_\_address.sql) was added to create the 'address' table. This table stores address details including owner ID, full name, zip code, state/region, line 1 and 2, phone number, and timestamps for creation, update, and deletion.

address/src/main/resources/db · high confidence

Initial account schema and application configuration

Added the initial database migration script (V1\_\_account.sql) which creates the 'account' table with fields for ID, name, email, password, and timestamps. Additionally, the application configuration (application.yml) was added, defining the H2 in-memory database connection, Flyway migration settings, server port 8080, and an external API address for addresses.

account/src/main/resources · medium confidence

Introduce account address book domain model

Added new domain model classes for the account address book, including AccountAddress, AccountAddressId, AddressBook, and the AddressBookService interface, enabling users to manage and retrieve account addresses within the system.

account/src/main/kotlin/htnk128/kotlin/ddd/sample/account/domain/model/addressbook · high confidence

Introduce address domain model and events

Added the core address domain model, including the \Address\ entity with \update\ and \delete\ behaviors, along with associated value objects (\FullName\, \ZipCode\, \StateOrRegion\, etc.), identity types (\AddressId\, \OwnerId\), and domain events (\AddressCreated\, \AddressUpdated\, \AddressDeleted\). Also added exception classes for invalid states and requests, and an \Owner\ aggregate with its own identity and service interface.

address/src/main/kotlin/htnk128/kotlin/ddd/sample/address/domain/model · high confidence

Introduced DDD-based account and address management with Spring WebFlux

The application now exposes REST APIs for managing accounts and addresses using a Domain-Driven Design architecture. This includes controllers for CRUD operations, use-case interactors, and Spring-based adapters for database (Exposure), messaging (event publishing/subscribing), and external services. Users can now create, read, update, and delete accounts and addresses, with proper error handling and event publishing integrated into the workflow.

(repo-wide) · high confidence

Introduces domain repositories and shared infrastructure classes

The update introduces new domain repository interfaces for managing Account and Address entities, each providing methods for finding, listing, adding, updating, and removing records. Additionally, shared infrastructure components are added: an ErrorResponse model for standardized error handling, an ApplicationException for application-layer errors, a PaginationDTO for list responses, and database utilities including an InstantColumnType for JPA/Exposed timestamp handling and an abstract ExposedTable base class.

account/src/main/kotlin/htnk128/kotlin/ddd/sample/account/domain/repository, address/src/main/kotlin/htnk128/kotlin/ddd/sample/address/domain/repository, shared · low confidence

Behavioural changes

Centralized build configuration and dependency management

The buildSrc module now uses a centralized Kotlin-based Gradle configuration to manage plugins, dependencies, and repositories. This introduces a unified version catalog (Versions.kt) and helper functions for applying common module and Spring Boot dependencies, streamlining the build process and ensuring consistent dependency versions across the project.

buildSrc · high confidence

Project renamed to kotlin-ddd-sample with updated documentation

The project has been renamed from 'kotlin-spring-boot-exposed-sample' to 'kotlin-ddd-sample', reflecting its focus on Domain-Driven Design. The README has been updated to include build badges, run instructions for Account and Address modules, API endpoints for Swagger UI, and detailed domain models for Account and Address. Additionally, the .editorconfig was added to configure Ktlint rules, and the .gitignore was updated to include modern IDE and build directories.

(repo-wide) · high confidence

Upgraded Gradle wrapper to version 7.0.2

The project's Gradle wrapper has been updated to use Gradle 7.0.2, ensuring that all builds use a consistent and modern version of the Gradle build tool.

gradle · medium confidence

Test coverage

Added unit tests for account domain models; Added unit tests for address domain model.

Dependencies

Migrate project build to Kotlin DSL and update Spring Boot to 2.5

The project's build configuration has been migrated from Groovy to Kotlin DSL, introducing new Gradle build scripts for the root, shared, ddd-core, account, and address modules. This includes configuring ktlint for code style enforcement, setting JVM compatibility to Java 11, and updating the Spring Boot framework version to 2.5. Additionally, the project name was changed to 'kotlin-ddd-sample' and the 'account' module was renamed to 'customer' in the build structure.

(dependencies) · medium confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.

Score

  • CAI 59 → 65 (+5.3)
  • Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 100 → 98 (-1.2)
  • Architecture 60 → 79 (+19.0)
  • Maturity 66 → 66 (+0.0)
  • Readiness 50 → 50 (+0.0)
  • Security 68 → 93 (+25.1)
  • Domain Modelling 100 → 100 (+0.0)

Resolved (14)

  • Change coupling: Dependencies.kt ↔ Versions.kt (buildSrc/src/main/kotlin/Dependencies.kt)
  • Coverage not included — suite not readable by the collector
  • Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
  • Duplicated block (5 lines × 2) (address/src/main/kotlin/htnk128/kotlin/ddd/sample/address/adapter/gateway/db/AddressExposedRepository.kt)
  • Duplicated block (8 lines × 2) (account/src/main/kotlin/htnk128/kotlin/ddd/sample/account/external/spring/configuration/ApplicationConfiguration.kt)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • No exposed public API
  • Test reliability not included
  • single-maintainer — knowledge-concentration (bus factor) risk

New (20)

  • Dependency hygiene PARTLY measured — Maven/Gradle declarations read, no dependency graph resolved
  • Documentation: no installation or build instructions (README.md)
  • Duplicated block (23 lines × 2) (account/src/main/kotlin/htnk128/kotlin/ddd/sample/account/adapter/controller/ErrorAdvice.kt)
  • Duplicated block (27 lines × 2) (account/src/main/kotlin/htnk128/kotlin/ddd/sample/account/domain/model/account/AccountEvent.kt)
  • Duplicated block (6 lines × 2) (address/src/main/kotlin/htnk128/kotlin/ddd/sample/address/adapter/gateway/db/AddressExposedRepository.kt)
  • Duplicated block (7 lines × 2) (ddd-core/src/main/kotlin/htnk128/kotlin/ddd/sample/ddd/core/domain/SomeIdentity.kt)
  • Duplicated block (8 lines × 2) (account/src/main/kotlin/htnk128/kotlin/ddd/sample/account/external/spring/configuration/ApplicationConfiguration.kt)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • Medium: security finding (details withheld)
  • Medium: security finding (details withheld)
  • Medium: security finding (details withheld)
  • No dependency advisory monitoring
  • TodoComment (account/src/main/kotlin/htnk128/kotlin/ddd/sample/account/adapter/controller/ErrorAdvice.kt)
  • TodoComment (address/src/main/kotlin/htnk128/kotlin/ddd/sample/address/adapter/controller/ErrorAdvice.kt)
  • Workflow token permissions not restricted

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

htnk128/kotlin-ddd-sample was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 21 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit e8f038c29f08c6914f5c824164a2103f7b518e20 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-fa71c66cabd8.