Skip to content
CAI
Software that uses CAICheck a score

8treenet/freedom

52.9

Adequate · 21 September 2026

15k

lines of production code

Go

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Freedom is a Go framework built on Iris that facilitates Domain-Driven Design and Hexagonal Architecture through a comprehensive dependency injection and lifecycle management system. It provides infrastructure for HTTP/2 communication, database persistence via GORM, Redis caching, and reliable domain event processing with Kafka. The system includes a CLI tool for scaffolding projects and generating code, along with middleware for tracing, logging, and metrics to support observability.

Features

Add FShop DDD example application with Docker support

Introduces the FShop example project, a complete e-commerce system demonstrating Domain-Driven Design (DDD) using the Freedom Framework. This addition includes a Dockerfile for containerized deployment, a go.mod file specifying dependencies (including Redis v9 and Freedom v1.9.2), a main.go entry point with database and Redis initialization, and a SQL dump for the required database schema (admin, cart, delivery, goods, order, user).

example/fshop · high confidence

Add HTTP controllers for the fshop example application

New controller files (cart, delivery, goods, order, user) are added to the adapter layer, registering HTTP routes such as /cart, /delivery, /goods, /order, and /user. These controllers expose endpoints for user registration, password changes, product browsing and management, cart operations, order payment and listing, and delivery handling, wiring the Freedom framework's initiator to bind routes and inject domain services.

example/fshop/adapter/controller · high confidence

Add HTTP/2 adapter controllers and repositories for goods and shop endpoints

New controller and repository files have been added to the HTTP/2 adapter layer to expose /goods and /shop endpoints. The GoodsController handles GET requests for individual goods by ID, returning hardcoded product details, while the ShopController delegates to a domain service. The GoodsRepository implements data access by making internal HTTP/2 client requests to the /goods/:id route and includes logic for concurrent HTTP/1 and HTTP/2 requests, registering itself via the framework's dependency injection system.

example/http2/adapter · high confidence

Add value object definitions for request and response data

New value object types have been introduced to define the structure of API requests and responses. The \example/fshop/domain/vo/req.go\ file adds request structs (such as \CartAddReq\, \RegisterUserReq\, and \GoodsAddReq\) with validation tags, while \example/fshop/domain/vo/vo.go\ defines response structs (like \UserInfoRes\ and \GoodsItemRes\) and \example/base/domain/vo/vo.go\ establishes the base package.

example/base/domain/vo, example/fshop/domain/vo · high confidence

Added domain event definitions for password changes and shop goods

New domain event structs, ChangePassword and ShopGoods, have been added to the event package. These events allow the system to track and process user password modification actions and shop goods purchase actions, respectively, by providing structured data models with identity, user, and transaction details.

example/fshop/domain/event · high confidence

Added domain persistence objects for Goods and Order

New persistence objects (POs) for Goods and Order have been added to the domain layer. These structs define the database schema and include methods for tracking field changes, supporting optimistic locking (via a Version field in Goods), and enabling atomic updates using GORM expressions.

example/infra-example/domain/po · high confidence

Added domain persistence objects for core shop entities

Introduced new Plain Old Go (PO) structs in the \example/fshop/domain/po\ package to represent core domain entities: Admin, Cart, Delivery, Goods, Order, OrderDetail, and User. These structs define the database schema mappings via GORM tags and provide a change-tracking mechanism through \Update\, \Set\\, and \Add\\ methods, enabling the application to persist and modify user, product, order, and administrative data.

example/fshop/domain/po · high confidence

Added domain services for goods and order management

The example application now includes domain-level services for managing goods and orders. GoodsService provides methods to retrieve goods and handle stock updates via domain events, while OrderService handles order creation, retrieval, and payment processing. These services integrate with repositories and a domain event transaction component to ensure data consistency during operations like purchasing goods.

example/infra-example/domain · high confidence

Adds demo infrastructure component with lifecycle management

A new demo infrastructure component (\Single\) is introduced in the \example/infra-example/infra/demo\ package. It registers itself via the framework's dependency injection system and implements a \Booting\ lifecycle hook that initializes a random 'life' value, exposing this state through a \GetLife\ method for use by controllers.

example/infra-example/infra/demo · high confidence

CLI scaffolding updates: new project structure, PO generation, and version command

The CLI tool now includes a new \new-po\ command to generate CRUD model code (POs) and repository functions from a database DSN or JSON schema, supporting both MySQL and PostgreSQL drivers. The \new-project\ command has been refactored to generate a standard hexagonal architecture directory structure (domain, adapter, infra, etc.) using embedded templates instead of copying external template files, and it now injects the current version number into the generated project. A new \version\ command was added to display the CLI version (v1.10.1), and the root command's description was updated to English.

freedom/cmd · high confidence

Domain event persistence and retry mechanism

The domain event infrastructure now supports reliable event delivery through a database-backed retry system. Events are persisted in the database during transaction execution and only published to Kafka after the transaction commits successfully. If publishing fails or the consumer handler errors, the system automatically retries delivery based on a configurable policy (defaulting to 3 retries with a 60-second delay), ensuring eventual consistency without data loss.

example/infra-example/infra/domainevent · high confidence

Domain event persistence and retry mechanism added

The domain event infrastructure now supports reliable event delivery through a built-in retry mechanism. Events are persisted to the database (using monthly-sharded tables for published and subscribed events) and can be retried with configurable delays and attempt counts. This ensures that domain events are not lost during transient failures and are processed reliably by subscribers.

example/fshop/infra/domainevent · high confidence

Initial Kafka producer and consumer infrastructure

Added the \infra/kafka\ package providing a Kafka producer and consumer implementation for the application. The producer allows publishing messages to topics with configurable headers and keys, supporting a middleware chain for message processing. The consumer supports starting with a configuration, handling message consumption via a worker pool, and managing graceful shutdowns. This change introduces the foundational infrastructure for Kafka integration within the framework.

infra/kafka · high confidence

Initial release of Freedom DDD framework with Apache 2.0 license

The project introduces the Freedom framework, a Go library built on the Iris web server to support Domain-Driven Design (DDD) and Hexagonal Architecture. This release adds the Apache 2.0 license file and establishes the core application entry points (\app.go\, \profile.go\, \freedom.go\), providing APIs for installing databases, Redis, and custom data sources, managing HTTP middleware, and handling configuration via TOML or YAML profiles. It also includes a CLI tool for generating code from database schemas or JSON schemas, along with comprehensive documentation and example projects.

(repo-wide) · high confidence

Initial release of the Freedom Framework base example

This change introduces the 'base' example application for the Freedom framework, a Go-based DDD (Domain-Driven Design) web framework built on Iris. The example demonstrates the framework's core capabilities, including a hexagonal architecture with distinct domain, adapter, and infrastructure layers. It showcases key features such as dependency injection via the \Initiator\ interface, request-scoped lifecycle management through the \Worker\ interface, and integration with GORM for MySQL and Redis v9 for caching. The application also includes built-in observability middleware for tracing (via \x-request-id\), structured logging, and Prometheus metrics for HTTP client requests, along with a basic liveness check endpoint.

example/base · high confidence

Introduce base repository adapter with DI registration and context access

The repository adapter layer now includes a default implementation that registers itself via the framework's dependency injection system during initialization. This implementation provides methods to retrieve the client's remote address and user agent by accessing the underlying HTTP context through the worker, and includes a helper to fetch the database connection. An interface is also defined to standardize these repository capabilities.

example/base/adapter/repository · high confidence

Introduction of GORM-based transaction management infrastructure

The \infra/transaction\ package now provides a new transaction component built on GORM. It registers a \GormImpl\ service that implements a \Transaction\ interface, allowing users to execute database operations within a transactional context via the \Execute\ method. The implementation automatically manages the transaction lifecycle, storing the transaction handle in the worker context for reuse and handling rollbacks on panic.

infra/transaction · high confidence

Introduction of Goods and Order domain entities

New domain entity files for Goods and Order have been added to the example infrastructure. These entities embed the framework's base Entity type and their respective persistence objects, providing Identity methods to return unique identifiers based on their IDs.

example/infra-example/domain/entity · high confidence

New HTTP request client with middleware, H2C, and tracing support

The \infra/requests\ package now provides a new HTTP client library that supports both standard HTTP and HTTP/2 Cleartext (H2C) protocols. Users can configure default clients via \SetHTTPClient\ and \SetH2CClient\, or inject custom clients per request. The library introduces a middleware system (\InstallMiddleware\) allowing interceptors to modify requests, handle errors, or enable connection tracing (\EnableTrace\). It offers a fluent API for building requests (GET, POST, PUT, etc.), setting JSON/form/file bodies, and parsing responses into JSON, XML, or strings. Features include single-flight deduplication for concurrent identical requests, automatic cookie parsing, and detailed connection timing traces (DNS, TLS, TCP, server time).

infra/requests · high confidence

New HTTP/2 and H2C example application with middleware and monitoring

Added a new example application in the \example/http2\ directory that demonstrates the Freedom framework's support for HTTP/2 and H2C (HTTP/2 Cleartext). The example includes a server configuration using \NewH2CRunner\, a client implementation with H2C capabilities, and a middleware system featuring recovery, distributed tracing, request logging, Prometheus monitoring for HTTP clients, and bus filtering. It also illustrates dependency injection patterns and best practices for request tracing and concurrent processing.

example/http2 · high confidence

New HTTP/2 example configuration structure

The example/http2/config location now provides a dedicated configuration package and sample files for the HTTP/2 example application. A new Go source file defines the configuration schema, including specific sections for database and Redis connection pooling, while accompanying TOML and YAML files supply default settings such as the listen address (:8000), service name, and connection parameters. This change establishes the configuration foundation for the HTTP/2 example, replacing the previous generic template structure with example-specific defaults.

example/http2/config · high confidence

New JSON request and response handling infrastructure

The infrastructure layer now includes dedicated components for handling HTTP requests and responses. A new \Request\ struct provides methods to read JSON bodies, query parameters, and form data, with optional validation support using the go-playground/validator library. Additionally, a \JSONResponse\ struct standardizes API responses by wrapping code, error messages, and data into a consistent JSON format, automatically setting appropriate content types and status codes.

example/infra-example/infra · high confidence

New code generation tool for CRUD entities with multi-database support

The \freedom/template/crud\ package has been replaced with a new code generation system that creates Plain Old Go (PO) entities and repository templates. This new generator supports both MySQL and PostgreSQL databases, mapping their specific column types to Go types, and includes a test suite for JSON-based schema generation. The previous static \todo.go\ example file has been removed as the new system dynamically generates code based on database schemas.

freedom/template/crud · high confidence

New consumer adapter for domain event processing and service initialization

A new consumer adapter has been added to the application to handle domain event consumption and service lifecycle management. It registers a service locator callback to inject request-scoped logging and trace IDs into workers, and sets up a boot sequence that pre-warms the goods service cache. Additionally, it starts a background goroutine to periodically mark specific goods as 'HOT' and another to consume shop goods domain events, routing them through the goods service for processing.

example/fshop/adapter/consumer · high confidence

New domain aggregate roots and factory pattern for shopping operations

This change introduces a new set of domain aggregate roots and their corresponding factories in the fshop example, enabling structured shopping workflows. Specifically, it adds \CartAddCmd\ and \CartItemQuery\ for managing cart items, \CartShopCmd\ and \GoodsShopCmd\ for purchasing goods (either from the cart or directly), \OrderPayCmd\ and \DeliveryCmd\ for order lifecycle management, and a \ShopFactory\ to abstract the creation of these commands based on purchase type. These aggregates rely on dependency-injected repositories (User, Cart, Goods, Order, Delivery) and a transaction component to ensure data consistency during operations like stock deduction, order creation, and payment processing.

example/fshop/domain/aggregate · high confidence

New domain entity models for the fshop example

The example application now includes domain entity definitions for core shop concepts: Admin, Cart, Delivery, Goods, Order, and User. These entities embed persistence objects and the framework's base Entity type, providing identity resolution and specific domain behaviors such as order status management (paid, shipment), goods tagging, and password changes with event publishing.

example/fshop/domain/entity · high confidence

New domain event types for order payments and shop goods

The example application now includes specific domain event structures for order payments and shop goods transactions. The new \OrderPay\ event carries order and user identifiers for standard messaging scenarios, while the \ShopGoods\ event supports retryable publishing by binding to the event manager's retry mechanism and includes methods for serialization, identity management, and prototype injection.

example/infra-example/domain/event · high confidence

New domain service implementations with dependency injection support

The base domain layer now includes two new service implementations, Default and DefaultV2, which are registered for dependency injection via the framework's initiator. The Default service provides a RemoteInfo method that retrieves IP and User-Agent data from repository interfaces, while DefaultV2 extends this functionality with mock data. Both services are wired into the controller layer for injection, enabling the application to utilize these domain services in request handling.

example/base/domain · high confidence

New domain services for cart, goods, order, and user management

The example application now includes domain-layer services for core e-commerce entities: Cart, Goods, Order, and User. These services expose operations such as adding items to a cart, managing product inventory, processing payments and deliveries, and handling user registration and password changes. They are registered with the framework's dependency injection system via \BindService\ and \InjectController\, relying on abstracted repositories and aggregate factories to enforce dependency inversion. Additionally, unit tests have been added to verify the Goods service's creation, stock updates, and purchasing flows against a real MySQL and Redis backend.

example/fshop/domain · high confidence

New entity caching layer with Redis integration

The infra/store package now includes a new EntityCache component that implements first-level (in-memory) and second-level (Redis) caching for domain entities. This feature allows the application to cache entity data to reduce database load, with configurable expiration times (defaulting to 5 minutes), custom key prefixes, and optional asynchronous writes to Redis. The cache integrates with the existing dependency injection framework and relies on the go-redis/v9 client for Redis operations.

infra/store · high confidence

New example controllers demonstrating routing, middleware, and request handling

Added \default.go\ and \defaultV2.go\ to the example base adapter controller, providing concrete implementations for the Freedom framework. These controllers demonstrate binding routes (GET, POST, PUT, DELETE) with path parameters and query string parsing, applying controller-specific middleware for logging, handling JSON and form data validation, and supporting file uploads. The V2 controller further illustrates service inheritance and versioned API structure.

example/base/adapter/controller · high confidence

New example controllers for goods, orders, and shop operations

The example application now includes three new HTTP controllers: GoodsController exposes endpoints to retrieve goods and handle shop purchase events with domain event retry logic; OrderController provides order retrieval and payment processing, including a dedicated event listener for order payment messages; and ShopController implements a shopping cart purchase flow that automatically retries on optimistic lock conflicts. These controllers demonstrate integration with the domain services, event management, and request handling infrastructure.

example/infra-example/adapter/controller · high confidence

New infra-example project demonstrating Freedom framework infrastructure

The example/infra-example directory introduces a complete demonstration application for the Freedom framework, showcasing core infrastructure capabilities. It includes a detailed README explaining how to register and use singleton and prototype infrastructure components, manage transactions, and handle domain events via Kafka. The project provides a runnable Go application (main.go) that configures MySQL via GORM, sets up Kafka producers and consumers with Prometheus metrics, and implements middleware for tracing and logging. It also includes SQL schema definitions for goods and orders, DTOs for request/response handling, and an error definition for version expiration, serving as a practical reference for building event-driven, infrastructure-heavy applications.

example/infra-example · high confidence

New middleware components for request logging, tracing, and client monitoring

The middleware package now includes several new capabilities: a request logger that captures access logs, request bodies, and metadata (with support for skipping multipart uploads); a trace middleware that generates and propagates unique trace IDs via a bus; a bus filter middleware that sanitizes HTTP headers by removing non-prefixed keys; and a Prometheus client middleware that monitors outgoing HTTP client requests with latency and request count metrics. Additionally, the existing recover middleware has been refactored to use the new bus-based worker context and updated logging infrastructure.

middleware · high confidence

New repository adapters for Goods and Order with optimistic locking and Kafka integration

This change introduces new repository implementations for the Goods and Order domains within the infrastructure example. The Goods repository now implements optimistic locking by incrementing a version field on save and returning a version-expired error if the update fails. The Order repository adds a Pay method that updates the order status to PAID and publishes an OrderPay message to Kafka, while also supporting retrieval by user ID. These adapters are registered via dependency injection and include unit tests for the Goods repository.

example/infra-example/adapter/repository · high confidence

New repository adapters for fshop domain entities

The example/fshop/adapter/repository package now includes new repository implementations for Admin, Cart, Delivery, Goods, Order, and User entities. These adapters register themselves with the framework's dependency injection system via \freedom.Prepare\ and \initiator.BindRepository\, implementing domain-specific repository interfaces (e.g., \dependency.AdminRepo\). They handle data persistence using GORM, with Goods and Order repositories additionally integrating Redis-based entity caching and domain event management.

example/fshop/adapter/repository · high confidence

New request and response infrastructure components

Added new \Request\ and \JSONResponse\ infrastructure components in the \example/base/infra\ and \example/fshop/infra\ packages. The \Request\ component provides methods to read and validate JSON bodies, query parameters, and form data using the go-playground/validator library, while the \JSONResponse\ component standardizes the serialization and dispatching of JSON API responses, including error handling and status code management.

example/base/infra, example/fshop/infra · high confidence

Removals

Removal of legacy HTTP client implementations

The \general/requests\ package has removed the legacy \FastRequest\ (based on \fasthttp\), \H2CRequest\ (based on \http2\), and the \Request\ interface definition. This eliminates the previous HTTP client abstractions and their associated types, requiring users to adopt the current HTTP client implementation provided in this location.

general/requests · high confidence

Removal of the general application framework package

The \general\ package, which provided the core application bootstrap, service pooling, and repository abstractions for the framework, has been removed. This deletion eliminates the \Application\ struct and its associated methods for binding controllers and services, the \ServicePool\ for object lifecycle management, and the \RepositoryDB\/\RepositoryCache\ interfaces for database and cache access. Users can no longer initialize the application via \NewApplication()\ or use the built-in dependency injection and request-scoped service patterns defined in this location.

general · high confidence

Behavioural changes

Internal framework restructure with domain event and dependency injection support

The internal application core has been restructured to introduce a comprehensive dependency injection system, including dedicated pools for services, repositories, factories, and infrastructure components, alongside a new \UnitTest\ interface for easier testing. This change adds support for Domain Events with configurable sequential or concurrent processing via \ListenEvent\, and integrates Redis v9 for caching. The framework now also supports HTTP/2 Cleartext (H2C) requests and provides a message bus mechanism for passing data through HTTP headers during request processing.

internal · high confidence

Introduce domain-layer service and dependency injection for the shop example

The example now includes a domain package that defines a ShopService with a Shopping method, exposing a Goods value object and integrating with the framework's dependency injection system via init() registrations. This change shifts the example from a reflection-heavy approach to explicit service binding and controller injection, improving performance and aligning with the framework's OCP-style DI.

example/http2/domain · high confidence

Introduces domain repository interfaces for dependency inversion

The fshop domain layer now defines explicit interfaces for data access (User, Cart, Goods, Order, Delivery, and Admin repositories). This change implements dependency inversion, allowing external adapters to provide concrete implementations rather than relying on runtime reflection, which improves performance and supports Open/Closed Principle compliance.

example/fshop/domain/dependency · high confidence

Project template restructured to use Freedom framework v1.1.7

The project scaffolding has been completely rewritten to align with the new Freedom framework architecture. The old template files (under \cmd/\, \models/\, \repositorys/\, \services/\) are removed and replaced with new Go source files that generate a modernized project structure. Key changes include: migrating from \kataras/iris\ to the \freedom\ runner and \freedom.Worker\ interface; replacing \jinzhu/gorm\ with \gorm.io/gorm\ and \go-redis/redis\ with \github.com/redis/go-redis/v9\; adopting a new configuration system using \freedom.Configure\ with support for both TOML and YAML; introducing a new \infra\ package for request/response handling with validation; and updating the dependency injection and lifecycle management to use \freedom.Prepare\ and \initiator\ patterns. The generated \go.mod\ now targets Go 1.18 and depends on \github.com/8treenet/freedom\ at the current version.

freedom/template/project · high confidence

Standardized configuration structure for example projects

The example projects (base, fshop, infra-example) now use a unified configuration schema that explicitly defines database connection pools and Redis client settings (including pool size, timeouts, and retry logic) alongside application metadata. This change replaces the previous template-based approach with a consistent structure supporting both TOML and YAML formats, ensuring that connection parameters like \max\_open\_conns\, \pool\_size\, and \read\_timeout\ are explicitly configurable for each service.

example/base/config, example/fshop/config, example/infra-example/config · high confidence

Test coverage

Added API integration tests for the fshop example; Added integration tests for the example API endpoints.

Dependencies

Major dependency overhaul and Go version upgrade

The project has been upgraded to Go 1.25.0 and underwent a comprehensive dependency refresh. Key updates include migrating from the legacy \jinzhu/gorm\ to \gorm.io/gorm\ (v1.31.1) with new drivers for MySQL (\gorm.io/driver/mysql\) and PostgreSQL (\gorm.io/driver/postgres\), upgrading the Redis client to \github.com/redis/go-redis/v9\ (v9.17.2), and updating the Kafka client to \github.com/IBM/sarama\ (v1.46.3). The HTTP framework was updated to \github.com/8treenet/iris/v12\ (v12.1.9), and critical security patches were applied to \golang.org/x/crypto\ (v0.52.0) and \github.com/jackc/pgx/v5\ (v5.9.2).

(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 53.

Lenses

  • Code Health 90
  • Architecture 80
  • Maturity 57
  • Readiness 35
  • Security 88
  • Domain Modelling 70
  • Event-Driven 91

Changes since last survey

  • 300 commits — 283 feature/other, 17 fixes

By area

  • (root) — 78 commits
  • example/fshop — 45 commits
  • freedom/template — 30 commits
  • freedom/cmd — 24 commits
  • example/base — 21 commits
  • example/infra-example — 21 commits
  • (repo) — 15 commits
  • example/event-example — 11 commits
  • infra/requests — 10 commits
  • infra/kafka — 9 commits
  • general/requests — 7 commits
  • internal/app.go — 5 commits
  • example/http2 — 4 commits
  • general/app.go — 3 commits
  • doc/http-client-guide.md — 2 commits
  • example/com — 2 commits
  • middleware/logger_config.go — 2 commits
  • doc/route-guide.md — 1 commit
  • general/freedom_test.go — 1 commit
  • general/models.go — 1 commit

Notable commits

  • fix: Fix errors and upgrade dependency versions
  • fix: Fix errors and upgrade dependency versions
  • fix: Fix errors and upgrade dependency versions
  • fix: Fix event
  • fix: Fix scaffold
  • fix: Merge pull request #12 from 8treenet/revert-3-master
  • fix: Revert "Add English README"
  • fix: fix http-client
  • fix: fix install
  • fix: fix template
  • fix: fix template
  • fix: fix template
  • fix: fix(deps): upgrade github.com/jackc/pgx/v5 to v5.9.2 to fix memory-safety vulnerability
  • fix: fix(deps): upgrade golang.org/x/crypto to v0.52.0 to resolve security vulnerabilities
  • fix: fix(middleware): skip reading request body for multipart/form-data uploads
  • fix: fix: add timeout to Redis ping in project template
  • fix: logger fix
  • change: Application.InstallSerializer
  • change: Application.InstallSerializer
  • change: Better and more convenient code generation.
  • …and 280 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

8treenet/freedom 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 8ad36d4bce211f5e76022bf668c16ab641e34711 — 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.