Go Pluggable Datastore Switcher
Implements a configuration-driven pattern for swapping repository and datastore implementations in Uber-fx services.
This skill provides a standardized architectural pattern for Go services using the Boost framework and Uber-fx to select concrete implementations of domain ports at boot time. It enables developers to switch between different backends—such as MongoDB for production and an in-memory implementation for local development—via simple configuration keys. By centralizing the selection logic in a dispatcher and ensuring constructors return interfaces rather than concrete types, it maintains a clean separation of concerns where domain and application layers remain entirely agnostic of the underlying infrastructure.
Key Features
01Interface-first constructors that simplify Uber-fx dependency injection
02Config-key-in-port pattern for centralized implementation selection
03Isolated fx.Module providers per implementation to prevent dependency leakage
04Optional health checker integration that noops when dependencies are inactive
05Zero-infra local development support via default in-memory implementations
0612 GitHub stars
Use Cases
01Swapping MongoDB for an in-memory repository during local development to bypass network dependencies
02Implementing multiple third-party providers for a single domain interface selectable by a configuration flag
03Switching between Redis and local cache drivers based on environment configuration