PowerX CRUD Dependency Injection

•
339
•

Standardizes backend architecture using dependency injection for CRUD operations within the PowerX ecosystem.

This skill implements a strict dependency injection (DI) pattern for Go-based PowerX applications, ensuring a clean separation of concerns between transport layers, services, and repositories. By enforcing a single 'Deps' entry point and constructor-based injection, it prevents global state, facilitates cross-transport code reuse for HTTP, gRPC, and MQ, and simplifies the lifecycle management of database connections and external clients. It is essential for developers maintaining or extending the PowerX private traffic platform who need to ensure architectural consistency and testability.

主な機能

01Includes standardized Go templates for Repositories, Services, and Route registration.
02Implements constructor-based injection (NewXxxService) to eliminate global singletons.
03Decouples transport layers from business logic, preventing DB access from Handlers.
04Enforces a centralized 'Deps' struct as a service container for infrastructure and logic.
05Provides automated checks for codebase structure, naming conventions, and imports.
06339 GitHub stars

ユースケース

01Standardizing the architecture of a new module or microservice within a PowerX project.
02Refactoring legacy Go backend code to follow clean architecture and DI principles.
03Implementing multi-protocol support where HTTP and gRPC share the same service logic.