Go continues to rise in popularity and is in 2023 a common choice for building cloud-native microservices applications.
While Go does not have a strong culture of relying on frameworks, over the past years a few have become established and in 2023 developers should definitely consider them in order to boost productivity.
However, making the right choice can be challenging, so in this article we take a look at the leading frameworks and compare features, key use cases, and potential drawbacks.
Encore is a modern alternative, aimed at teams looking for a developer-experience focused approach to microservies development. Encore is designed to make it easier to use robust and scalable services from AWS and GCP.
It works by providing an API Framework and an Infrastructure SDK that lets developers declare infrastructure as part of the application code, in a cloud-agnostic way.
With Encore you define a service by defining one or more APIs within a regular Go package. Encore recognizes this as a service, and uses the package name as the service name. When deploying, Encore will automatically provision the required infrastructure for each service.
- No boilerplate: Declare APIs with an annotation on any function, create services from Go packages.
- Built-in Distributed Tracing: Easily trace the path and performance of requests.
- Automating API Documentation & Architecture Diagrams: Automatically keep documentation and diagrams up-to-date.
- Built-in Secrets Management: Handle sensitive data securely.
- Cloud Infrastructure Automation: Automatically provision infrastructure in local, preview, and your cloud environment in GCP and AWS.
- Scalability: Designed with large-scale applications in mind, Encore is an efficient way of building large distributed systems using scalable cloud services.
- Simplicity and Speed: Encore abstracts away many of the complexities of infrastructure management, allowing developers to concentrate on coding.
- Standardization: Provides a uniform way of building microservices and APIs, and provisioning infrastructure, that follows best practices.
- Built-in Tools: Encore offers built-in distributed tracing, automated API documentation, preview environments, and more.
- Cloud Agnostic: Encore applications can be deployed to any cloud provider, providing flexibility and preventing vendor lock-in.
- To get the most value from Encore you need to use both the API Framework and the Infrastructure SDK, which depending on your current situation may involve making significant changes.
- For startups and teams looking for a batteries-included solution for building Go-based microservies that greatly reduces overhead, especially in setup and maintenance of distributed systems using cloud infrastructure.
- When you want to automate API documentation and Architecture Diagrams, and remove most microservies boilerplate.
- When you want built-in observability like Distributed Tracing, Metrics, and integrations with tools like Grafana and Datadog.
- When you want a seamless integration between your code and infrastructure.
- When you want to build event-driven systems using scalable infrastructure like Pub/Sub.
GoMicro (to be renamed Orb) is a cloud-native microservice framework that aims to simplify the challenges of building scalable and maintainable applications.
GoMicro provides a pluggable architecture that allows developers to select and adapt the framework to fit their requirements, and integrates with various service discovery systems.
Note: GoMicro has not had a new release since April 2023.
- Pluggable Architecture: Adapt and extend GoMicro based on your project's needs.
- Service Discovery & Load Balancing: Native integrations ensure efficient and smooth operations.
- Scalability: Designed with large-scale applications in mind, GoMicro can effortlessly manage increased loads.
- Flexibility: The pluggable nature means it can be tailored to a variety of project requirements.
- Complexity: The wide range of features and pluggability can be daunting for newcomers.
- Cloud-Native Dependency: May not be suitable for projects that aren't focused on cloud-native deployment.
- For teams focusing on cloud-native applications, especially those benefiting from an event-driven approach.
- When developing scalable, cloud-native, and event-driven applications.
- When flexibility and customization of the framework are your primary priority, and investing signiticant time on manual infrastructure setup and maintenance is acceptable.
Go kit is a collection of Go packages (libraries) for building microservices in Go.
It focuses on providing solutions to challenges commonly faced, while still remaining relatively unopinionated.
- Service Discovery: Integrates seamlessly with various service discovery systems.
- Pluggable Transports: Offers a range of transport mechanisms like HTTP and gRPC.
- Standardization: Provides a uniform way of building services that adhere to best practices.
- Flexibility: Despite being opinionated, it offers ways to plug in different components.
- Steep Learning Curve: Its specific way of doing things might require an initial investment in time to grasp.
- Potential Overhead: For simpler projects, Go kit might seem overkill.
- For teams that value standardization while maintaining flexibility.
- When you need a toolkit that balances standardizing an approaches with flexibility.
- When you don't mind investing time and effort in manually setting up and maintaining cloud infrastructure and observability tooling.
Gin is a performance-focused web framework for Go. Minimalistic in nature, Gin is appropriate for building small, focused, applications.
- Performance: One of the fastest web frameworks for Go.
- Middleware Support: Offers a range of middleware packages out of the box.
- Quick Start: Its minimalistic nature means you can get up and running quickly.
- Versatility: Being minimal, Gin offers a lot of flexibility at the expense of built-in tooling.
- Web-Focused: Primarily tailored for web apps, might not be the best for non-web microservices.
- Not as Feature-Rich: For more complex requirements, you may need to rely on third-party tools and extensions.
- For developers and small teams who prioritize performance and want to create simple lightweight web applications.
- When your project requires performance and the overall scope in small.
- When you are building few and simple services, so the overall time investment in setting up infrastructure is small.