takashabe/go-ddd-sample
58.8
Adequate · 21 September 2026
288
lines of production code
Go
primary language
4
measurements over time
What this system is
This system is a Go-based sample application demonstrating Domain-Driven Design principles for managing user entities. It provides a layered architecture that exposes RESTful HTTP endpoints to create, retrieve, and list users, persisting data through a MySQL database. The implementation includes domain models, application use cases, and infrastructure adapters to abstract database interactions.
Features
Added initial database schema and sample data for the users table
The project now includes SQL files to initialize the database structure and populate it with test data. A new schema defines a \users\ table with \id\, \name\, \created\_at\, and \updated\_at\ columns using InnoDB and utf8mb4 charset. Additionally, sample data is provided to insert five initial user records (satoshi, kasumi, takeshi, kojiro, musashi) into the \users\ table after clearing existing entries.
_\sql · high confidence
Initial domain model and repository interface for users
This change introduces the core domain layer for user management. It defines the \User\ entity with basic fields and validation logic, establishes the \UserRepository\ interface to abstract data access, and includes a generated mock implementation to support unit testing of components depending on this repository.
domain · high confidence
Initial user persistence layer with MySQL support
The infrastructure/persistence package now provides the concrete implementation for the user repository, enabling user data storage and retrieval via MySQL. This includes the \userRepository\ struct which implements the domain repository interface, supporting operations to get, get all, and save users. Additionally, integration tests have been added to verify these repository methods against a MySQL database using test fixtures.
infrastructure/persistence · high confidence
Introduce HTTP handler for user management endpoints
Added a new HTTP handler in the interfaces layer that exposes REST endpoints for user operations: GET /user/:id to retrieve a single user, GET /users to list users (wrapped in a {"users": \[...\]} JSON object), and POST /user to create a new user from a JSON body. The handler uses the application interactor and domain repository, serializes responses as JSON, and includes error handling with standardized error responses. Tests verify the GET /user/:id endpoint behavior, including success and not-found cases.
interfaces · high confidence
Introduction of application-layer user use cases
The application layer now includes a UserInteractor that exposes user-related use cases. Users can retrieve a single user or a list of users, and create new users through this service, which delegates to the domain repository for data persistence.
application · high confidence
Behavioural changes
Database connection configuration moved to dedicated config package
The logic for initializing the MySQL database connection has been relocated to the config package (config/database.go). This change establishes a centralized entry point for database connectivity, resolving import cycles by ensuring the database initialization code resides within the configuration layer rather than being scattered or defined in packages that depend on it.
config · high confidence
Update persistence test fixtures and schema reference
The persistence test data directory now uses a symbolic link for the schema definition, pointing to the shared SQL schema at the repository root, and includes a new users.yml fixture file containing sample user records (Satoshi, Kasumi, Takeshi, Kojiro, and Musashi) for testing purposes.
infrastructure/persistence/testdata · high confidence
Dependencies
Initial Go module definition and dependency lock
The project now includes a go.mod file and a corresponding go.sum lockfile, establishing the module path as github.com/takashabe/go-ddd-sample and requiring Go 1.12. This change introduces specific dependencies for the application, including the MySQL driver (v1.4.1), mocking tools (golang/mock v1.3.1), comparison utilities (google/go-cmp v0.3.1), error handling (pkg/errors v0.8.1), and internal packages for fixtures and routing. It also pulls in indirect dependencies such as the Google App Engine SDK and YAML parsing libraries.
(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
Baseline
- First survey — no prior run to compare against. CAI 59.
Lenses
- Code Health 100
- Architecture 69
- Maturity 81
- Readiness 35
- Security 95
- Domain Modelling 100
Changes since last survey
- 29 commits — 22 feature/other, 7 fixes
By area
- (root) — 7 commits
- infrastructure/persistence — 6 commits
- interfaces/handler.go — 4 commits
- _sql/sample_data.sql — 2 commits
- application/database.go — 2 commits
- application/user.go — 2 commits
- (repo) — 1 commit
- application/: — 1 commit
- config/database.go — 1 commit
- domain/repository — 1 commit
- interfaces/handler_test.go — 1 commit
- interfaces/testdata — 1 commit
Notable commits
- fix: Fix architecture design
- fix: Fix database name
- fix: Fix decoder type
- fix: Fix exit code of the main_test
- fix: Fix for follow the updated library
- fix: Fix import package
- fix: Fix sql
- change: Add application, infrastructure layer
- change: Add base directories
- change: Add design memo
- change: Add doamin layer
- change: Add handler_test
- change: Add interfaces layer
- change: Add makefile
- change: Add persistence test
- change: Add sql
- change: Add test case
- change: Add testcase
- change: Change fixture file from regular file to symbolic link
- change: Change number of parallel for avoid deadlock database
- …and 9 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
takashabe/go-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 bd0062b0bec08302c2d27cc0d8acb35de0e5e9a8 — 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-28e75b8e3254.