Encore
Open source framework for building robust type-safe distributed systems with declarative infrastructure
Install / Use
/learn @encoredev/EncoreREADME
-
Framework: The Encore framework, available for TypeScript and Go, lets you define APIs, services, and infrastructure (databases, Pub/Sub, caching, buckets, cron jobs) as type-safe objects in your code. Write your application once, then deploy it anywhere without code changes by exporting a Docker image and supplying the infra configuration.
-
Local Dev Tools: The Encore CLI runs your app locally and automatically provisions local infrastructure. Encore's local dev dashboard provides tools for a productive workflow: Tracing, API Explorer, Service Catalog, Architecture Diagrams, and Database Explorer.
-
DevOps Platform (Optional): Encore Cloud parses your application and automatically provisions the required infrastructure in your own AWS/GCP account. Other tools include Preview Environments for each PR, Service Catalog, Distributed Tracing, Metrics, and Cost Analytics.
⭐ Star this repository to help spread the word and stay up to date.
Get started
Install Encore:
- macOS:
brew install encoredev/tap/encore - Linux:
curl -L https://encore.dev/install.sh | bash - Windows:
iwr https://encore.dev/install.ps1 | iex
Create your first app:
- TypeScript:
encore app create --example=ts/hello-world - Go:
encore app create --example=hello-world
Use with AI coding assistants:
Add Encore's LLM instructions to your project, so your AI tools can understand your architecture, generate type-safe code, and use Encore's infrastructure primitives. Use the built-in MCP server to give your AI runtime context (query databases, call APIs, analyze traces) for seamless debugging and faster iterations. Learn more
https://github.com/user-attachments/assets/461b902f-8fd3-46f1-a73c-0ebbfa789ce3
Encore's local development dashboard
How it works
Encore's open source backend frameworks, Encore.ts and Encore.go, enable you to define resources like services, databases, Pub/Sub, caches, buckets, and cron jobs, as type-safe objects in your application code.
You only define infrastructure semantics (what matters for the behavior of the application), not configuration for specific cloud services. Here's how you define a database in Encore.ts:
const db = new SQLDatabase("users", { migrations: "./migrations" });
Encore parses your application to understand your infrastructure requirements, then sets up infrastructure in different environments:
-
Locally: The Encore CLI sets up local infrastructure (microservices, Postgres, Pub/Sub, etc.) and provides a development dashboard with distributed tracing, API documentation, service catalog, architecture diagrams, and database explorer. Works offline, no Docker Compose needed.
-
AWS/GCP: Encore Cloud deploys to your AWS/GCP account without any Terraform or YAML needed. It automatically sets up compute instances (serverless or Kubernetes), databases (RDS/Cloud SQL), Pub/Sub (SQS/GCP Pub/Sub), storage (S3/GCS), caching (ElastiCache/Memorystore), and all other required resources like security groups and IAM policies, according to best practices.
-
Self-hosted: Use the Encore CLI to export your app as Docker images, then supply your infra config to host anywhere.
Encore orchestrates infrastructure from local development and testing, to production in your cloud.
Encore makes it simpler to build distributed systems
-
Microservices without boilerplate: Call APIs in other services like regular functions. Encore handles service discovery, networking, and serialization. Get cross-service type-safety and auto-complete in your IDE.
-
Modular monolith to microservices: Structure your application using independent services for clarity. Then deploy them colocated in a single process or as distributed microservices, without changing a single line of code. Encore handles service communication whether in-process or over the network.
-
Testing built-in: Mock API calls, get dedicated test infrastructure, and use distributed tracing for tests.
Example: Hello World
Defining microservices and API endpoints is very simple. With less than 10 lines of code, you can create a production-ready, deployable service.
Hello World in Encore.ts
import { api } from "encore.dev/api";
export const get = api(
{ expose: true, method: "GET", path: "/hello/:name" },
async ({ name }: { name: string }): Promise<Response> => {
const msg = `Hello ${name}!`;
return { message: msg };
}
);
interface Response {
message: string;
}
Hello World in Encore.go
package hello
//encore:api public path=/hello/:name
func World(ctx context.Context, name string) (*Response, error) {
msg := fmt.Sprintf("Hello, %s!", name)
return &Response{Message: msg}, nil
}
type Response struct {
Message string
}
Example: Using Pub/Sub
If you want a Pub/Sub Topic, you declare it directly in your application code and Encore will integrate the infrastructure and generate the boilerplate code necessary. Encore orchestrates the relevant Pub/Sub infrastructure for different environments:
- NSQ for local environments
- GCP Pub/Sub for environments on GCP
- SNS/SQS for environments on AWS
Using Pub/Sub in Encore.ts
import { Topic } "encore.dev/pubsub"
export interface SignupEvent {
userID: string;
}
export const signups = new Topic<SignupEvent>("signups", {
deliveryGuarantee: "at-least-once",
});
Using Pub/Sub in Encore.go
import "encore.dev/pubsub"
type User struct { /* fields... */ }
var Signup = pubsub.NewTopic[*User]("signup", pubsub.TopicConfig{
DeliveryGuarantee: pubsub.AtLeastOnce,
})
// Publish messages by calling a method
Signup.Publish(ctx, &User{...})
Need some infrastructure Encore doesn't provide?
Encore never prevents you from using arbitrary infrastructure.
You can use any external resource as you normally would, directly integrating standard SDKs (AWS SDK, GCP client libraries, third-party APIs, etc.). You then provision that resource yourself as you normally would.
Want to use Encore in an existing system?
You don't need a complete rewrite, Encore supports incremental adoption.
Service-by-service adoption (recommended): Build new services with Encore and run them alongside your existing system, integrated via APIs. Then incrementally migrate existing services as needed. Each migrated service immediately gets Encore's full feature set: infrastructure provisioning, tracing, architecture diagrams.
Deployment options:
- Your Kubernetes cluster: Deploy directly to your existing Kubernetes infrastructure. Run Encore alongside legacy systems in the same environment.
- Encore-managed infrastructure: Encore provisions and manages infrastructure in your AWS/GCP account, deployed within your existing VPC and security setup.
- Terraform provider: Encore provides a Terraform provider to make it simple to integrate Encore managed infrastructure with your existing infrastructure landscape.
Start with low-risk, frequently-changed services to validate the approach. Learn more in our migration guide.
Learn more
-
Documentation: Encore Docs
-
See example apps: Example Apps Repo
-
See products built with Encore: Showcase
-
Hear from teams using Encore: Case studies
-
Have questions? Join the friendly developer community on Discord
-
Talk to a human: Book a 1:1 demo with one of our founders
-
Videos:
- <a href="https://youtu.be/vvqTGfoXVsw" alt="Intro video: Encore concepts & features" target="_blank">Intro: Encore concepts & features</a>
- <a href="https://youtu.be/wiLDz-JUuqY" alt="Demo video: Getting started with Encore.ts" target="_blank">Demo video: Getting started with Encore.ts</a>
- <a href="https://youtu.be/IwplIbwJtD0" alt="Demo video: Building and deploying a simple service" target="_blank">Demo: Building and deploying a simple Go service</a>
- <a href="https://youtu.be/ipj1HdG4dWA" alt="Demo video: Building an event-driven system" target="_blank">Demo: Building an event-driven system in Go</a>
- Find more videos in our YouTube channel.
How Encore compares to other tools
| Tool | What it does | How Encore differs | | ---------------------------------- | ------------------------------------------------------------- | -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
