with one click
service-registry
// Register and retrieve services at runtime using a thread-safe service registry pattern for loose coupling between plugins.
// Register and retrieve services at runtime using a thread-safe service registry pattern for loose coupling between plugins.
Write unit tests in Go following Red-Green-Refactor TDD principles.
Define and implement services that encapsulate business logic with proper constructor-based dependency injection.
Implement HTTP handlers that parse requests, invoke use cases, and format responses following REST conventions.
Build pluggable authentication features using the plugin system with initialization, migrations, routes, and service registration.
Implement repository interfaces for data persistence and abstraction over database operations using Bun ORM.
Orchestrate services and repositories through use cases to implement application-level workflows and business scenarios.
| name | service-registry |
| description | Register and retrieve services at runtime using a thread-safe service registry pattern for loose coupling between plugins. |
any back to specific interfacesServices are registered in plugin Init() methods using the registry interface:
// Get a core service
service, ok := ctx.ServiceRegistry.Get(models.ServiceXxx.String()).(ServiceInterface)
if !ok {
return errors.New("service not available")
}
// Register your plugin's service
ctx.ServiceRegistry.Register(models.ServicePlugin.String(), myService)
Always check the ok flag on type assertions. Store retrieved services in plugin struct for internal use.
See bootstrap.go for implementation.
ok flag on type assertionsmodels.ServiceXxx constants