Go Micro Logo Go Micro

ADR-001: Plugin Architecture

Status

Accepted

Context

Microservices frameworks need to support multiple infrastructure backends (registries, brokers, transports, stores). Different teams have different preferences and existing infrastructure.

Hard-coding specific implementations:

Decision

Go Micro uses a pluggable architecture where:

  1. Core interfaces define contracts (Registry, Broker, Transport, Store, etc.)
  2. Multiple implementations live in the same repository under interface directories
  3. Plugins are imported directly and passed via options
  4. Default implementations work without any infrastructure

Structure

go-micro/
├── registry/          # Interface definition
│   ├── registry.go
│   ├── mdns.go       # Default implementation
│   ├── consul/       # Plugin
│   ├── etcd/         # Plugin
│   └── nats/         # Plugin
├── broker/
├── transport/
└── store/

Consequences

Positive

Negative

Neutral

Alternatives Considered

Separate Plugin Repositories

Used by go-kit and other frameworks. Rejected because:

Single Implementation

Like standard net/http. Rejected because:

Dynamic Plugin Loading

Using Go plugins or external processes. Rejected because: