What if your backend framework could look at your code and automatically provision databases, pub/sub, cron jobs, and API gateways?
What Is Encore?
Encore is a backend framework (Go and TypeScript) that uses static analysis to understand your app's infrastructure needs and automatically provisions everything — locally, in CI, and in production.
// TypeScript version
import { api } from "encore.dev/api"
import { SQLDatabase } from "encore.dev/storage/sqldb"
const db = new SQLDatabase("users", { migrations: "./migrations" })
export const getUser = api(
{ method: "GET", path: "/users/:id", expose: true },
async ({ id }: { id: string }) => {
const user = await db.queryRow\`SELECT * FROM users WHERE id = \${id}\`
return user
}
)
Run encore run and Encore:
- Sees you defined a SQL database → provisions PostgreSQL locally
- Sees you defined an API → generates API gateway + docs
- Sees the dependency graph → creates architecture diagram
Go Version
package user
import "encore.dev/storage/sqldb"
var db = sqldb.NewDatabase("users", sqldb.DatabaseConfig{
Migrations: "./migrations",
})
//encore:api public method=GET path=/users/:id
func GetUser(ctx context.Context, id string) (*User, error) {
var user User
err := db.QueryRow(ctx, "SELECT * FROM users WHERE id = $1", id).Scan(&user)
return &user, err
}
Infrastructure From Code
// Pub/Sub — Encore creates the topic and subscription
import { Topic, Subscription } from "encore.dev/pubsub"
const signups = new Topic<SignupEvent>("signups")
// This creates a subscription automatically
const _ = new Subscription(signups, "send-welcome-email", {
handler: async (event) => {
await sendWelcomeEmail(event.email)
}
})
// Cron jobs
import { CronJob } from "encore.dev/cron"
const _ = new CronJob("cleanup", { every: "1h", endpoint: cleanup })
// Caching
import { CacheCluster, CacheKeyspace } from "encore.dev/storage/cache"
const cluster = new CacheCluster("main")
const userCache = new CacheKeyspace<User>(cluster, { keyPattern: "user/:id" })
You don't write Terraform. You don't configure Kubernetes. Encore reads your code and provisions the right infrastructure.
Auto-Generated Docs
encore run gives you:
- Interactive API docs at
localhost:9400 - Architecture diagram showing all services and their dependencies
- Distributed tracing for every request
Why Encore
- No boilerplate — no Docker, Terraform, K8s manifests
- Type-safe APIs — request/response types enforced
- Local dev = production — same infrastructure, same behavior
- Deploy anywhere — Encore Cloud or self-host on AWS/GCP
Building backend systems? Check out my developer tools or email spinov001@gmail.com.
Top comments (0)