Encore vs. Nitric

Nitric is a framework that empowers developers to build complete cloud applications on their preferred cloud platform, combining infrastructure declaration and application code in one place. On the other hand, Encore is a development platform tailored for building cloud backend applications using the Go language, with deployment options for AWS or Google Cloud Platform. Both serve the purpose of simplifying cloud application development but operate in slightly different ways and cater to different specific needs.

These are the main differences between the two:

  1. Cloud Provider Support: Nitric is provider-agnostic, capable of deploying to multiple cloud providers such as AWS, Google Cloud, and Azure. Encore currently deploys to AWS or Google Cloud.
  2. Language Support: Nitric provides libraries for TypeScript/JavaScript, Python, Go, C# .NET and Java, allowing developers to choose their preferred language. Currently Encore supports Go, with TypeScript scheduled for Preview.
  3. Infrastructure Provisioning: Nitric uses Pulumi by default for provisioning cloud resources, but also allows the use of custom providers. Encore uses a hosted provisioning engine via their online platform.
  4. Open Source: As an open-source framework, Nitric does not require a platform or subscription to deploy applications, while Encore requires sign-up and may involve additional costs.

Code Comparison

To get a deeper understanding of the differences, let's see the same app built in both Nitric and Encore.

Nitric

package main
import (
"context"
"github.com/nitrictech/go-sdk/nitric"
"github.com/nitrictech/go-sdk/nitric/apis"
)
func main() {
api := nitric.NewApi("main")
api.Get("/hello/:name", func(ctx *apis.Ctx) {
ctx.Response.Body = []byte("Hello " + ctx.Request.PathParams()["name"])
})
nitric.Run()
}

Encore

package hello
import (
"context"
)
//encore:api public path=/hello/:name
func Hello(ctx context.Context, name string) (*Response, error) {
msg := "Hello " + name
return &Response{Message: msg}, nil
}
type Response struct {
Message string
}

The Nitric example shows an API where HTTP request handling is achieved using faas.HttpContext, providing control over the request and response objects. The Encore example demonstrates an API where HTTP request handling is reflected through the function parameters and return types, with defined structs for responses.

Differences

NitricEncore
LanguageYour choiceGo
Lines of code2615
Cloud InfrastructureInferredInferred
ExtensibilityCustom providers can be createdNo
Local simulationBuilt-in local simulatorBuilt-in local simulator
Cloud providersAWS, Azure, GCP and Custom providersAWS and GCP
Provisioning enginePulumi by default, other custom providers can be createdHosted provisioning engine
Last updated on Nov 11, 2024