What problem does it solve?
uber-go/fx helps you assemble complex Go application graphs while ensuring correct startup/shutdown behavior without relying on init() side effects.
Core Features & Use Cases
- Lifecycle-safe service boot: Use fx.Lifecycle hooks (OnStart/OnStop) so long-running work starts and stops gracefully and deterministically.
- Modular dependency injection: Compose large systems with fx.Module, and keep providers/invokes/decorators reusable and scoped.
- Ergonomic wiring patterns: Use fx.New, fx.Provide, fx.Invoke, fx.Annotate (name/group/As), fx.Decorate, fx.Supply, and fx.Replace for production wiring and test overrides.
- Run loop with signal awareness: app.Run blocks on SIGINT/SIGTERM and coordinates lifecycle hooks in the correct order.
Quick Start
Use the golang-uber-fx skill to structure your Go main() composition root with fx.New, register constructors with fx.Provide, trigger graph execution with fx.Invoke, and move server start/stop logic into fx.Lifecycle OnStart/OnStop hooks.