Why use Cobra for microservices?

This page summarizes the projects mentioned and recommended in the original post on /r/golang

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • cobra

    A Commander for modern Go CLI interactions

  • I was used to see the initialization of services just on a main.go file, with all of the initialization of the structs or functions that are needed for the system to start. However, I've been seeing a bunch of projects (including some at my company) that have started to use Cobra for creating these services, and I don't mean a CLI application, but stuff like a REST or gRPC server, or kafka consumers/producers.

  • kubernetes

    Production-Grade Container Scheduling and Management

  • Kubernetes itself is a good example. They aren’t using Cobra, but each of the cluster components (kube-apiserver, kube-proxy , etc.) have a CLI entrypoint. While probably overkill for smaller projects, I’ve seen this on larger projects once the number of arguments and flags grows beyond what you’d want to deal with on your own in a main function. For example, just look at the number of arguments to the kube-apiserver.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • service

    Run go programs as a service on major platforms.

  • Here's a library that I use to create system services: https://github.com/kardianos/service

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts