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, and Dart. Additional languages can be supported using Nitric's gRPC API, allowing developers to choose their preferred language. Currently Encore supports Go and TypeScript.
  3. Infrastructure Provisioning: Nitric uses Pulumi or Terraform 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. Encore's language frameworks are provided as open-source software, however infrastructure provisioning requires users to create their own IaC scripts or sign-up to Encore's hosted platform, which may incur 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 apis.Ctx, 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, TypeScript
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 Dec 19, 2024