crossroad0201/ddd-on-scala
49.5
Weak · 21 September 2026
889
lines of production code
Scala
primary language
4
measurements over time
What this system is
This system is a Scala-based implementation of Domain-Driven Design (DDD) and Hexagonal Architecture, serving as a reference for structuring complex applications. It manages the lifecycle of tasks and users through a layered architecture that separates domain logic, application services, and infrastructure concerns. The system supports both command and query operations, utilizing relational databases for persistence and message queues for event publishing, while providing a RESTful interface for task management.
Features
Add RDB adapter implementation using ScalikeJDBC and H2
Introduces a new RDB infrastructure module containing a ScalikeJDBC-based implementation for the Task repository, including database configuration for H2 and associated unit tests. The repository provides a concrete 'get' operation that queries the 'tasks' and 'task\_comments' tables, while 'save' and 'delete' operations are currently unimplemented.
modules/adapter/infrastructure/rdb · high confidence
Added CQRS query model for task views
Introduced new Scala classes and interfaces to support a CQRS-based query model for viewing tasks. A new \TaskView\ case class aggregates task details with joined user information (author and assignee names), and a \TaskSearchResult\ wrapper is provided for search results. The \TaskViewQueryProcessor\ trait defines the interface for searching tasks by keyword, enabling keyword-based queries on task and user data.
modules/query · high confidence
Added TaskService application service for task lifecycle management
A new TaskService trait was added to the application layer, providing use-case methods for creating, assigning, unassigning, commenting on, closing, and reopening tasks. The service coordinates between the task and user repositories, handles domain events via a publisher, and maps infrastructure errors to application-level ServiceError types.
modules/application/src/main/scala/crossroad0201/dddonscala/application/task · high confidence
Added documentation for diagram files
Added a new file, doc/README.asciidoc, which explains that the \*.xml files in the doc directory are shape data created with draw.io. This provides context for users about the diagram files included in the repository.
doc · high confidence
Added placeholder infrastructure adapters for Elasticsearch and Kafka
New trait implementations for Elasticsearch (TaskViewQueryProcessorOnES) and Kafka (TaskEventPublisherOnKafka, UserEventPublisherOnKafka) have been added to the adapter/infrastructure modules. These components currently throw UnsupportedOperationException, indicating that the actual integration logic is not yet implemented in this sample project.
modules/adapter/infrastructure/elasticsearch, modules/adapter/infrastructure/kafka · high confidence
Initial project structure and documentation
The repository was initialized with a Scala-based DDD (Domain-Driven Design) implementation example. This includes the addition of a \.scalafmt.conf\ for code formatting, an MIT \LICENSE\ file, and a comprehensive \README.asciidoc\ that explains the Onion Architecture, layer/module structure, and setup instructions. The \.gitignore\ was also updated to exclude database files.
(repo-wide) · high confidence
Introduce Task domain model with CQRS and domain events
Added the core domain model for the Task aggregate, including the Task entity, Comment value object, and associated domain events (TaskCreated, TaskAssigned, TaskUnAssigned, TaskCommented, TaskClosed, TaskReOpened). The Task entity now supports state transitions (open, close, reopen) and business methods that return DomainResult containing both the updated entity and a domain event, enabling CQRS-style event publishing. Error handling is provided via TaskError types (TaskAlreadyOpened, TaskAlreadyClosed). Repository and event publisher interfaces are defined for persistence and event handling, while a domain service and implicit role-based extensions (Author, Assignee, Commenter) are added to the task package.
modules/domain/src/main/scala/crossroad0201/dddonscala/domain/task · high confidence
Introduce sample DDD adapter with controller, components, and tests
Added new Scala files for the sample DDD adapter: a controller (SampleController) that exposes create, close, and search task endpoints; a Components object that wires up the TaskService and TaskViewQueryProcessor with their respective infrastructure implementations (RDB, Kafka, Elasticsearch); and an InfrastructureAware trait providing transaction management and error handling. Additionally, a comprehensive test suite (SampleControllerSpec) was added to verify the controller's behavior using mocked dependencies.
modules/adapter/interface · high confidence
Introduce user domain model and repository interfaces
Added the core user domain components: a User entity with a factory method for creation, a UserRepository trait for persistence operations, a UserEventPublisher trait for event handling, and associated value types (UserId, UserName) and domain events (UserCreated, UserModified).
modules/domain/src/main/scala/crossroad0201/dddonscala/domain/user · high confidence
Introduces foundational DDD domain abstractions
The domain module now includes core building blocks for Domain-Driven Design: a DomainError trait that captures stack traces for better debugging, a DomainEvent trait, an Entity trait with identity and metadata support, a UnitOfWork trait for transactional boundaries, and a Value type class for value objects. These changes establish the structural foundation for domain logic, including optimistic concurrency control via EntityMetaData and a DomainResult wrapper for entity-event pairs.
modules/domain/src/main/scala/crossroad0201/dddonscala/domain · medium confidence
Introduces structured error handling and transaction management for application services
The application layer now includes a structured error handling system with a new \ServiceError\ hierarchy that tracks error codes and stack traces for better debugging. Additionally, a \TransactionAware\ trait is introduced to define transaction boundaries for application services, accompanied by a note advising against using application services as transaction boundaries in favor of aggregate-level transactions. Error conversion utilities are also provided to transform domain and infrastructure errors into service errors.
modules/application/src/main/scala/crossroad0201/dddonscala/application · high confidence
Behavioural changes
Initial database schema for tasks and comments
A new Flyway migration (V1\_\_create\_tables.sql) defines the initial database schema, creating 'tasks' and 'task\_comments' tables. The tasks table includes a 'version' column, supporting optimistic locking for entity persistence.
src/main · medium confidence
Restructured infrastructure layer with new domain adapters
The infrastructure module has been refactored to align with a hexagonal architecture. This change introduces new implementation classes for domain interfaces, specifically adding EntityMetaDataCreatorImpl and UUIDEntityIdGenerator. Additionally, implicit conversion functions for domain types (such as Task, User, and general Value types) have been organized into dedicated package objects (task, user, and infrastructure) to facilitate automatic type conversions.
modules/adapter/infrastructure/src · medium confidence
Dependencies
Add build dependencies and plugins for Scalafmt, H2, and Flyway
The project's build configuration has been updated to include new dependencies and SBT plugins. A Scalafmt plugin (sbt-scalafmt-coursier) is added for code formatting. New dependency groups are defined: CommonDepends includes logging and testing libraries (Scalatest, Scalamock), while InfrastructureDepends adds ScalikeJDBC, the H2 in-memory database, and ScalikeJDBC test utilities. Additionally, the Flyway SBT plugin is added to enable database migration execution from the build tool.
project · high confidence
Restructures project into modular architecture with new infrastructure components
The build configuration has been reorganized to support a hexagonal architecture with separated infrastructure concerns. New sub-projects for RDB, Kafka, and ElasticSearch have been added under the infrastructure module, each depending on the core domain and application layers. The root project now aggregates these new modules alongside the existing domain, application, and infrastructure modules. Additionally, the project name has been updated to 'dddonscala' and the Scala version is set to 2.12.3.
(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
Score
- CAI 49 → 50 (+0.5)
- Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 100 → 99 (-0.8)
- Architecture 100 → 69 (-31.0)
- Maturity 37 → 54 (+16.7)
- Readiness 24 → 26 (+1.4)
- Security 100 → 100 (+0.0)
- Domain Modelling 100 → 100 (+0.0)
Resolved (6)
- 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
- complexity unreadable for .scala — churn × complexity hotspots could not be measured
- single-maintainer — knowledge-concentration (bus factor) risk
New (3)
- Documentation: no architecture or design documentation (README.asciidoc)
- FixmeComment (modules/adapter/interface/sample/src/main/scala/crossroad0201/dddonscala/adapter/controller/sample/InfrastructureAware.scala)
- FixmeComment (modules/application/src/main/scala/crossroad0201/dddonscala/application/package.scala)
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
crossroad0201/ddd-on-scala 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 e42b33854a78c77423f5bd0e92f9bb31e6c45487 — 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.