The move towards service-based architectures – constructing backend applications out of several services that are deployed separately and communicate with each other over an API – has drastically improved the reliability of cloud-based software.
At the same time, it has also slowed down development considerably through the additional work required to create these services, expose APIs, call APIs, migrate APIs, and so on.
In other words, microservices improve reliability but decrease velocity. This is regrettable; ideally we would like both!
With Encore, you don't have to choose. You get both reliability and velocity. This is possible because the work of managing the infrastructure to make your service architecture work is all taken care of by Encore.
In Encore, a service is represented by a regular Go package. The only distinction is that the Go package contains one or more top-level functions that use the
encore:api annotation to signal that they are APIs.
To learn more about how to create APIs, see the API Overview.
To call another service in Encore, simply import the Go package and call the API as if it were a regular function. When Encore compiles your application, it recognizes this as an API call and compiles it down into an actual API call at runtime.
In this way, you get the benefits of services in production: decoupling and performance, with none of the downsides at development time. You don't have to worry about things like service discovery, transport protocols, serializing or deserializing requests, and so on. It's all taken care of. You can just focus on building your application.