);
// Enqueue a task await emailQueue.enqueue( to: "user@example.com", body: "Welcome" ); One of the most frustrating parts of cloud development is local emulation. Encore.ts provides a local backend daemon that spins up Docker containers for your databases, queues, and caches. You get a local developer dashboard (running on http://localhost:9400 ) that shows every request, trace, and log. 5. Distributed Tracing by Default Every request automatically receives a trace ID. Encore.ts captures spans for database queries, HTTP calls, and queue jobs. In production (if using Encore Cloud), you get a Prometheus/Grafana stack without configuration. How It Compares | Feature | Encore.ts | Express + Manual Setup | | :--- | :--- | :--- | | Database migrations | Automatic via SQLDatabase | Manual ( knex , prisma migrate ) | | Message queues | Built-in Queue type | Manual (BullMQ, SQS SDK) | | API client generation | Automatic, type-safe | Manual (OpenAPI + codegen) | | Infrastructure provisioning | None (encoded in code) | Terraform, CDK, or manual | | Local cloud emulation | Built-in with dashboard | Docker Compose (custom setup) | | Error handling | Structured, traceable | Custom middleware required | The Catch (Current Limitations) Encore.ts is not a drop-in replacement for express in existing projects. It requires you to structure your project in a specific way (top-level api functions, specific file layout). It is not a generic HTTP framework—it is a platform.
In your Next.js or React frontend:
// Backend: my-app/hello.ts interface PingParams name: string export const ping = api( method: "POST", path: "/ping/:name", expose: true , async (params: PingParams): Promise< message: string > => return message: Hello, $params.name! ;
For years, building a backend in TypeScript has followed a predictable pattern: grab express or Fastify , add some zod for validation, wire up a few ts-node scripts, and pray your async error handling doesn't silently fail. While this works, it feels bolted together. encore ts
When you deploy, Encore.ts parses this, creates the necessary cloud resources (RDS, Cloud SQL, etc.), and runs your migrations automatically. Forget generating OpenAPI specs (Swagger) and praying your frontend matches. With Encore.ts, your backend endpoints define request/response shapes, and Encore automatically generates a fully type-safe TypeScript client:
is a new breed of TypeScript backend framework that flips the script. It is not just an HTTP router; it is a complete backend development platform that includes infrastructure tooling, type-safe clients, and built-in distributed systems primitives. What is Encore.ts? Developed by the team behind Encore (originally a Go framework), Encore.ts brings the same "backend development platform" philosophy to TypeScript. It is an opinionated framework that compiles your TypeScript code into a deployable backend, automatically handling infrastructure provisioning (like databases, queues, and cron jobs) and generating idiomatic API clients. ); // Enqueue a task await emailQueue
import SQLDatabase from "encore/storage"; // This single line provisions a real database in dev/prod const db = new SQLDatabase("user-db", migrations: "./migrations", );