A generics-based dependency injection and aspect-oriented programming framework for Go, built around components and interceptors.
Kod is a dependency injection application framework for Go that uses generics and a component-based architecture. It simplifies building modular applications by managing dependencies and enabling cross-cutting concerns like logging and tracing through aspect-oriented programming via interceptors.
Go developers building modular, maintainable applications that require clean dependency management, configuration, and built-in observability. It is particularly suited for teams needing enterprise-grade features like structured logging, OpenTelemetry integration, and integrated testing utilities.
Developers choose Kod for its type-safe, generics-based approach that eliminates dependency management complexity while providing out-of-the-box support for configuration, testing, and observability. Its unique selling point is the combination of a component-based architecture with built-in interceptors for metrics and tracing, reducing boilerplate code for cross-cutting concerns.
A generics based dependency injection application framework for Go, supporting aspect oriented programming based on interceptors
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses Go generics with embedded fields like `kod.Implements[T]` for compile-time type safety, as shown in the Adder component example.
Automatically integrates OpenTelemetry for traces and metrics, configurable via environment variables like OTEL_SDK_DISABLED, reducing manual instrumentation.
Provides `kod.RunTest` for unit tests and benchmarks, along with `kod.Fake` for mocking components, simplifying test setup as demonstrated in the testing section.
Supports TOML, YAML, and JSON config files for both component-specific and global settings using `WithConfig` and `WithGlobalConfig`, per the config examples.
Requires running commands like `kod generate` and `kod struct2interface` to automate boilerplate, adding an extra step to development and build processes.
Demands understanding of component interfaces, struct embedding with generics, and interceptors, which can be verbose and error-prone for newcomers.
Interceptors for metrics and tracing, along with lazy initialization via `kod.LazyInit`, introduce runtime overhead that may impact performance-sensitive applications.