{"id":20236349,"url":"https://github.com/micro/plugins","last_synced_at":"2025-12-30T06:05:56.205Z","repository":{"id":37857127,"uuid":"478934986","full_name":"micro/plugins","owner":"micro","description":"Go Micro plugins","archived":false,"fork":false,"pushed_at":"2024-08-11T15:16:36.000Z","size":10603,"stargazers_count":97,"open_issues_count":31,"forks_count":93,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-10-22T23:42:41.067Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/micro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-07T10:27:56.000Z","updated_at":"2024-10-16T05:41:17.000Z","dependencies_parsed_at":"2023-11-24T14:25:33.661Z","dependency_job_id":"1acef229-555d-4d0e-9b0d-ccac0e862294","html_url":"https://github.com/micro/plugins","commit_stats":{"total_commits":140,"total_committers":38,"mean_commits":"3.6842105263157894","dds":0.7285714285714286,"last_synced_commit":"11eebaeb9bcba8e88b26ba631506415f322ef957"},"previous_names":["go-micro/plugins"],"tags_count":892,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micro%2Fplugins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micro%2Fplugins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micro%2Fplugins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micro%2Fplugins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micro","download_url":"https://codeload.github.com/micro/plugins/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237882311,"owners_count":19381182,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T08:20:11.298Z","updated_at":"2025-04-30T04:40:51.185Z","avatar_url":"https://github.com/micro.png","language":"Go","readme":"# Plugins [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![GoDoc](https://godoc.org/github.com/micro/plugins?status.svg)](https://godoc.org/github.com/micro/plugins) [![Unit Tests](https://github.com/micro/plugins/actions/workflows/main.yaml/badge.svg)](https://github.com/micro/plugins/actions/workflows/main.yaml)\n\nGo plugins is a place for community maintained plugins.\n\n## Overview\n\nMicro tooling is built on a powerful pluggable architecture. Plugins can be swapped out with zero code changes.\nThis repository contains plugins for all micro related tools. Read on for further info.\n\n## Getting Started\n\n* [Contents](#contents)\n* [Usage](#usage)\n* [Build](#build)\n\n## Contents\n\nContents of this repository:\n\n| Directory | Description                                                     |\n| --------- | ----------------------------------------------------------------|\n| Broker    | PubSub messaging; NATS, NSQ, RabbitMQ, Kafka                    |\n| Client    | RPC Clients; gRPC, HTTP                                         |\n| Codec     | Message Encoding; BSON, Mercury                                 |\n| Micro     | Micro Toolkit Plugins                                           |\n| Registry  | Service Discovery; Etcd, Gossip, NATS                           |\n| Selector  | Load balancing; Label, Cache, Static                            |\n| Server    | RPC Servers; gRPC, HTTP                                         |\n| Transport | Bidirectional Streaming; NATS, RabbitMQ                         | \n| Wrapper   | Middleware; Circuit Breakers, Rate Limiting, Tracing, Monitoring|\n\n## Usage\n\nPlugins can be added to go-micro in the following ways. By doing so they'll be available to set via command line args or environment variables.\n\nImport the plugins in a `plugins.go` file\n\n```go\npackage main\n\nimport (\n\t_ \"github.com/go-micro/plugins/v5/broker/rabbitmq\"\n\t_ \"github.com/go-micro/plugins/v5/registry/kubernetes\"\n\t_ \"github.com/go-micro/plugins/v5/transport/nats\"\n)\n```\n\nCreate your service and ensure you call `service.Init`\n\n```go\npackage main\n\nimport (\n\t\"go-micro.dev/v5\"\n)\n\nfunc main() {\n\tservice := micro.NewService(\n\t\t// Set service name\n\t\tmicro.Name(\"my.service\"),\n\t)\n\n\t// Parse CLI flags\n\tservice.Init()\n}\n```\n\nBuild your service\n\n```\ngo build -o service ./main.go ./plugins.go\n```\n\n### Env\n\nUse environment variables to set the\n\n```\nMICRO_BROKER=rabbitmq \\\nMICRO_REGISTRY=kubernetes \\ \nMICRO_TRANSPORT=nats \\ \n./service\n```\n\n### Flags\n\nOr use command line flags to enable them\n\n```shell\n./service --broker=rabbitmq --registry=kubernetes --transport=nats\n```\n\n### Options\n\nImport and set as options when creating a new service\n\n```go\nimport (\n\t\"go-micro.dev/v5\"\n\t\"github.com/go-micro/plugins/v5/registry/kubernetes\"\n)\n\nfunc main() {\n\tregistry := kubernetes.NewRegistry() //a default to using env vars for master API\n\n\tservice := micro.NewService(\n\t\t// Set service name\n\t\tmicro.Name(\"my.service\"),\n\t\t// Set service registry\n\t\tmicro.Registry(registry),\n\t)\n}\n```\n\n## Build\n\nAn anti-pattern is modifying the `main.go` file to include plugins. Best practice recommendation is to include\nplugins in a separate file and rebuild with it included. This allows for automation of building plugins and\nclean separation of concerns.\n\nCreate file plugins.go\n\n```go\npackage main\n\nimport (\n\t_ \"github.com/go-micro/plugins/v5/broker/rabbitmq\"\n\t_ \"github.com/go-micro/plugins/v5/registry/kubernetes\"\n\t_ \"github.com/go-micro/plugins/v5/transport/nats\"\n)\n```\n\nBuild with plugins.go\n\n```shell\ngo build -o service main.go plugins.go\n```\n\nRun with plugins\n\n```shell\nMICRO_BROKER=rabbitmq \\\nMICRO_REGISTRY=kubernetes \\\nMICRO_TRANSPORT=nats \\\nservice\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicro%2Fplugins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicro%2Fplugins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicro%2Fplugins/lists"}