Skip to content
CAI
Software that uses CAICheck a score

ESchouten/CleanArchitecture

41.6

Weak · 22 September 2026

1.5k

lines of production code

Kotlin

primary language

7

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This is a Kotlin-based backend system built on Clean Architecture principles, designed to manage user accounts and authentication. It exposes functionality through GraphQL and REST (OpenAPI) endpoints, handling user lifecycle operations such as creation, retrieval, and password management. The system integrates with a database via JPA repositories and secures access using JWT-based authentication.

Features

Added repository utility classes for search, ordering, and query handling

New utility classes and functions have been added to the repositories adapter to support search, ordering, and pagination. SearchFields and the search function enable filtering by string matching across specified table columns, while the order function applies sorting based on a Sort configuration. The query and limit functions handle pagination and filtering logic, with the search functionality explicitly skipping empty search strings to avoid unnecessary processing.

adapters/repositories/src/main/kotlin/repositories/utils · high confidence

Initial project scaffolding and documentation

The repository was initialized with essential project files, including a .gitignore configuration, an MIT LICENSE, and Gradle wrapper scripts (gradlew, gradlew.bat) to manage the build environment. The README was updated to document the Kotlin-based Clean Architecture backend, detailing the Domain, Usecases, and Adapters modules, and providing usage examples for the generated GraphQL and OpenAPI/REST endpoints.

(repo-wide) · high confidence

Introduce database initialization and generic repository base class

The repository layer now includes a DatabaseFactory to initialize the database connection, manage Flyway migrations, and handle schema creation or dropping based on configuration. Additionally, a new DefaultDAO base class is introduced to provide a generic implementation of the Repository interface, supporting find-by-id, find-all, delete, count, and paginated queries with sorting.

adapters/repositories/src/main/kotlin/repositories · high confidence

Introduce user domain models for account management and pagination

Added new data classes in the use-cases model layer to represent user entities and related operations. This includes UserModel and UpdateUserModel for user data transfer, ChangeOwnPasswordModel and ChangePasswordModel for password management, CreateUserModel for account creation, and LoginUserModel for authentication. The models support conversion to domain entities and include a UserPaginationResult for paginated user lists.

use-cases/src/main/kotlin/usecases/model · high confidence

Introduces domain exception classes and a database migration scaffold

The application now includes a set of domain-level exceptions (AlreadyExistsException, EmailAlreadyExistsException, InvalidPropertyException, etc.) to handle specific error conditions like duplicate emails or invalid credentials. Additionally, a new Flyway database migration script (V1\_\_create\_users) has been added to the repository layer, providing a scaffold for the initial user table creation, though the actual SQL schema generation is currently empty.

adapters/repositories/src/main/kotlin/repositories/db, domain/src/main/kotlin/domain · medium confidence

Introduces domain-level repository abstractions with pagination and sorting support

The domain layer now includes a new repository infrastructure: a generic Repository interface with methods for find, create, update, delete, and count operations, including pagination and sorting parameters. A Pagination data class supports items per page, page number, search, period, and sort order (ASC/DESC). A specific UserRepository interface extends the generic repository, adding a findByEmail method for User entities.

domain/src/main/kotlin/domain/repository · high confidence

Introduces logging and authentication abstractions

The codebase now includes a Logger interface for structured logging and interfaces for user authentication (Authenticator) and password encoding (PasswordEncoder). These new abstractions allow the application to swap out logging implementations and manage user credentials more flexibly.

use-cases/src/main/kotlin/usecases/dependency · medium confidence

Introduction of domain entity models for users and credentials

The domain layer now includes core entity definitions: a base Entity interface with an id, a generic ValueClass interface for value objects, and specific implementations for User, Email, Password, and PasswordHash. The User entity includes a locked status and authorities, while Email and Password types enforce validation rules (e.g., email format, password complexity) and override toString to prevent sensitive data leakage.

domain/src/main/kotlin/domain/entity · medium confidence

Ktor-based authentication and server setup

The application now uses Ktor to handle authentication and server configuration. A new login module manages JWT-based authentication, storing the token in an HTTP-only, secure cookie named 'JWT'. The server module initializes Ktor with Koin for dependency injection, configures GraphQL, and sets up OpenAPI documentation. Configuration is loaded from environment variables or files, including JWT secrets and database settings.

infrastructure/ktor/src/main/kotlin/ktor · medium confidence

New GraphQL schema generation for usecases and value classes

The GraphQL adapter now automatically generates schema definitions for all registered usecases, mapping Query and Mutation annotations to GraphQL operations. It resolves argument names from function parameters and provides descriptions based on executor method names. Additionally, the system now supports scalar types for primitive value classes (e.g., String, Int, Long, Double, Float, Boolean) and standard enums, ensuring that value classes inheriting from ValueClass are correctly serialized and deserialized within the GraphQL schema.

adapters/graphql · high confidence

New JWT and Password Encoder implementations

The authentication adapter now includes new implementations for handling user credentials: JWTAuthenticatorImpl generates JSON Web Tokens that include the user's email and authorities as claims, while PasswordEncoderImpl uses the BCrypt library to hash and verify passwords.

adapters/authentication · high confidence

New Ktor plugins for dependency injection and OpenAPI documentation

Added new Ktor plugins for Koin-based dependency injection and automatic OpenAPI documentation generation. The Koin plugin provides extension functions to retrieve Koin instances from the Application and Routing contexts. The OpenAPI plugin automatically generates REST endpoints for use cases, mapping queries to GET requests and mutations to POST requests, while also handling common domain exceptions with appropriate HTTP status codes.

infrastructure/ktor/src/main/kotlin/ktor/plugins · high confidence

New Usecase base classes for suspend function inheritance

The Usecase.kt file introduces a new UsecaseType sealed class and abstract UsecaseA0 and UsecaseA1 classes that enable suspend function inheritance. These classes provide a structured way to handle authentication, authorization, and logging for use cases, with built-in support for up to one argument. The implementation includes a before() method that performs authorization checks and optional logging, which is then used by the abstract executor methods in the UsecaseA0 and UsecaseA1 classes.

use-cases/src/main/kotlin/usecases/usecase · medium confidence

New user management use cases

Added new use-case classes for user operations: AuthenticatedUser, ChangeOwnPassword, ChangePassword, CreateUser, DeleteUser, GetUser, ListUsers, LoginUser, UpdateUser, and UserExists. These implement the core user lifecycle and authentication flows, including password management, user creation, deletion, retrieval, listing with pagination, and email uniqueness checks.

use-cases/src/main/kotlin/usecases/usecase/user · high confidence

Behavioural changes

Automatic discovery and registration of usecases and repositories via Koin

The application now automatically scans for and registers all usecases and repositories within the 'usecases' and 'repositories' packages using Koin's reflection-based module setup. This removes the need for manual registration of each component, simplifying the addition of new usecases and repositories. The configuration module now includes a setup function that initializes a default user with specific authorities and a locked state, and provides a Config data class to manage database and JWT settings.

adapters/config · high confidence

Ktor infrastructure configuration and logging setup

The Ktor-based infrastructure layer now includes its own application configuration and logging setup. The new application.conf file configures the Ktor server to run on port 8080, sets the application module, and defines database connection properties (defaulting to an in-memory H2 database with JDBC) and JWT secret/domain settings. Additionally, a logback.xml file has been added to configure console-based logging with a standard timestamp and level format.

infrastructure/ktor/src/main/resources · high confidence

Upgrade to Gradle 8.1

The Gradle wrapper has been updated to version 8.1, which brings the latest improvements and compatibility updates to the build system.

gradle · high confidence

User repository implementation with pagination and locking support

The user repository has been implemented with full pagination support, allowing users to search, sort, and page through user lists. The implementation includes a database-backed repository (UserRepositoryImpl) and an in-memory variant (InMemoryUserRepository) for testing. Key features include search functionality, sorting by multiple fields, and support for user locking status.

adapters/repositories/src/main/kotlin/repositories/user · medium confidence

Test coverage

Added test utilities for inline value handling and logging; Added tests for User entity validation; Added tests for the user repository; Added tests for user-related use cases.

Dependencies

Initial project structure and dependency configuration

The project is initialized with a multi-module Gradle build, defining modules for domain, use-cases, infrastructure (Ktor), and various adapters (authentication, config, graphql, logging, repositories). Dependencies are managed via a version catalog (libs.versions) in settings.gradle.kts, specifying versions for Kotlin (1.8.20), Ktor (2.3.0), Koin (3.4.0), KGraphQL (0.19.0), and others. The build script configures subprojects to apply the Kotlin JVM plugin, use Maven Central, and include test dependencies like MockK and Kotlin test utilities.

(dependencies) · high 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

Score

  • CAI 46 → 42 (-4.3)
  • Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 100 → 100 (+0.0)
  • Architecture 94 → 64 (-30.2)
  • Maturity 45 → 45 (+0.0)
  • Readiness 18 → 18 (+0.0)
  • Security 100 → 100 (+0.0)

Resolved (6)

  • Change coupling: Config.kt ↔ DatabaseFactory.kt (adapters/config/src/main/kotlin/config/Config.kt)
  • Coverage not included — suite not readable by the collector
  • Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
  • No exposed public API
  • Test reliability not included
  • dormant codebase — no living knowledge left to concentrate

New (4)

  • Dependency hygiene PARTLY measured — Maven/Gradle declarations read, no dependency graph resolved
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • No ADRs found

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

Survey your own repository

ESchouten/CleanArchitecture 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 22 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 ae29f9c8b810e64b20730fe51ce54c560d145f37 — 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-90d5d2fe38ee.