truanguyenvan/go-clean-architecture-example
63.8
Adequate · 20 September 2026
3.8k
lines of production code
Go
primary language
4
measurements over time
What this system is
This system is a Go-based backend service that utilizes the Fiber HTTP framework and Clean Architecture principles to manage API requests. It provides role-based access control via Casbin and supports multiple data stores, including PostgreSQL, MySQL, and MongoDB, alongside Redis for caching. The application includes infrastructure for health monitoring, dynamic expression evaluation, and dependency injection to ensure robust and maintainable operation.
Features
Initial RBAC authorization configuration added
Added the Casbin RBAC model configuration and initial policy definitions to enable role-based access control. The new files define the request, policy, and role structures, along with specific permissions for roles such as admin, partner, store, and accountant to access resources like statistics, partner creation, and service usage.
config/casbin · high confidence
Initial configuration structure and local environment settings
The application now includes a foundational configuration system that loads settings from a local YAML file (config-local.yml) and Go structs. This setup defines parameters for the HTTP server (including SSL and timeouts), logging, PostgreSQL, Redis, MongoDB, and Casbin-based authorization. It also integrates Google Wire for dependency injection to provide the configuration instance.
config · high confidence
New database, caching, and infrastructure health-check packages
This change introduces new packages for data access and system observability. The \pkg/db\ area now includes \gorm\ (supporting MySQL and PostgreSQL with connection pooling and transaction helpers), \mongo\ (with a full CRUD client, aggregation pipeline builder, and query builder), and a Postgres factory. The \pkg/cache/redis\ package adds support for both standalone and cluster Redis connections with configurable timeouts and retry policies. Additionally, \pkg/health\ provides a framework for liveness and readiness checks, including built-in checks for SQL, Redis, HTTP pings, environment variables, and Go runtime metrics (goroutines, GC pauses).
pkg · high confidence
Behavioural changes
Refactored Crag API to use Fiber and Clean Architecture
The internal Crag API has been migrated from a standard library HTTP handler using Gorilla Mux to a Fiber-based implementation. This change introduces a new HTTP layer (\internal/api/crag\_http.go\) that integrates with a refactored application layer (\internal/app/app.go\) using Google Wire for dependency injection. The update includes new request/response DTOs, a centralized error handling strategy via \CustomErrorHandler\, and the addition of middleware for caching, logging, and Casbin-based authorization. The previous handler and its tests have been removed as part of this structural overhaul.
internal · high confidence
Refactored application startup to use dependency injection and graceful shutdown
The command-line entry point has been rewritten to replace manual service instantiation with a dependency-injected server instance. This change introduces graceful shutdown handling via OS signals (SIGINT, SIGTERM) and configures the application to utilize all available CPU cores. Users will now experience a cleaner startup process where the server port is determined by configuration rather than being hardcoded, and the application will shut down cleanly upon receiving termination signals.
cmd · high confidence
Dependencies
Added vendor dependency for Knetic/govaluate expression evaluation
The project now includes the Knetic/govaluate library in the vendor directory, enabling the application to evaluate arbitrary C-like arithmetic and string expressions. This addition allows for dynamic expression parsing and execution, supporting features such as parameterized queries, logical and bitwise operators, and custom function injection.
vendor · high confidence
Major dependency upgrade and Go version bump
The project has upgraded its Go runtime requirement from version 1.16 to 1.19. This change includes a significant refresh of the dependency tree: the Redis client library was upgraded from v8 to v9, and the HTTP framework was updated from gorilla/mux to gofiber/fiber/v2. Additionally, new capabilities were introduced via the addition of Google Wire for dependency injection, Casbin for authorization, and Swagger for API documentation, while several older indirect dependencies were removed or updated to their latest compatible versions.
(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 66 → 64 (-2.6)
- Rubric changed (rubric-2026.08.17 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 99 → 99 (-0.1)
- Architecture 100 → 92 (-8.1)
- Maturity 75 → 75 (+0.0)
- Readiness 41 → 41 (+0.4)
- Security 100 → 84 (-15.8)
- Domain Modelling 100 → 100 (+0.0)
Resolved (9)
- Coverage not included — suite not readable by the collector
- Dependency hygiene not measured — no supported dependency manifest was read
- Duplicated block (11 lines × 2) (internal/common/decorator/metric.go)
- Duplicated block (12 lines × 2) (internal/common/decorator/logging.go)
- Duplicated block (14–15 lines × 2) (pkg/health/checks/infra/redis.go)
- No exposed public API
- Test reliability not included
- early-stage repository — too few commits for a meaningful bus factor
- early-stage repository — too little history to judge knowledge freshness
New (37)
- Critical CVE: [GHSA redacted] (go.mod)
- Critical CVE: [GHSA redacted] (go.mod)
- Critical CVE: [GHSA redacted] (go.mod)
- Deprecated module: go.mongodb.org/mongo-driver
- Documentation: no installation or build instructions (docs/README.md)
- Documentation: no usage examples (docs/README.md)
- Duplicated block (10 lines × 2) (internal/common/decorator/metric.go)
- Duplicated block (13 lines × 2) (pkg/health/checks/infra/redis.go)
- Duplicated block (8 lines × 2) (pkg/cache/redis/cluster.go)
- Flaky test: .::go-clean-architecture-example/internal/infrastructure/persistence.Test_inMemoryRepo_GetCrags
- Flaky test: .::go-clean-architecture-example/internal/infrastructure/persistence.Test_inMemoryRepo_GetCrags/should_return_2_crags
- High CVE: [GHSA redacted] (go.mod)
- High CVE: [GHSA redacted] (go.mod)
- Medium CVE: [GHSA redacted] (go.mod)
- Medium CVE: GO-2023-2041 (go.mod)
- Medium CVE: GO-2025-3540 (go.mod)
- Medium CVE: GO-2026-5024 (go.mod)
- Medium CVE: GO-2026-5970 (go.mod)
- Medium vulnerability: GO-2026-4950 (go.mod)
- Medium vulnerability: GO-2026-5841 (go.mod)
- …and 17 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
truanguyenvan/go-clean-architecture-example 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 20 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 f9400e050ce57ca8de0832df484d917feec6c541 — 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.