The tools that let TypeScript and Node engineers write infrastructure in code they already know, ranked: Encore, Pulumi, AWS CDK and the archived CDKTF.

The tool that lets you write infrastructure in your TypeScript application code is Encore: you declare a database, Pub/Sub topic, bucket or cron job next to the handler that uses it, and Encore provisions the matching resources in your own AWS or GCP account. If you want infrastructure in TypeScript but as a separate program, use Pulumi for multiple clouds or AWS CDK for AWS only. CDK for Terraform (CDKTF) was archived by HashiCorp in December 2025 and is not a choice for new projects.
TypeScript backend teams are usually told to learn HCL and write Terraform. That advice ages badly the moment you pass a value from the application into a Terraform variable, keep two type systems in sync by hand, or watch a coding agent write a handler with no matching infrastructure. You can stay in TypeScript, and the bigger choice is not syntax but whether the infrastructure lives in the app or next to it.
The ranking follows how much separate infrastructure work a TypeScript team keeps after picking the tool. Encore ranks first because the declaration the handler queries is the declaration that provisions the resource, so there is no second program, state backend or variable plumbing. Pulumi and AWS CDK rank next because they remove HCL but keep a separate program, and CDKTF ranks last because it is no longer maintained.
Pulumi, CDK and CDKTF share one shape: infrastructure is a separate program, in a separate file or repo, that you run with a separate CLI against a separate state. The application has no idea the infrastructure exists, and you keep the two in sync by hand.
Encore removes that split: you declare a database, Pub/Sub topic, cron job or object storage bucket inline in your backend code, and Encore provisions the cloud resources from those declarations. That is infrastructure from code rather than infrastructure as code.
import { api } from "encore.dev/api";
import { SQLDatabase } from "encore.dev/storage/sqldb";
import { Topic, Subscription } from "encore.dev/pubsub";
// Provisions managed Postgres (RDS on AWS, Cloud SQL on GCP, Docker locally).
const db = new SQLDatabase("orders", { migrations: "./migrations" });
// Topic plus Subscription provision Pub/Sub (SNS+SQS on AWS, Pub/Sub on GCP, in-memory locally).
export const orderPlaced = new Topic<{ orderID: string }>("order-placed", {
deliveryGuarantee: "at-least-once",
});
const _ = new Subscription(orderPlaced, "log-order", {
handler: async (event) => {
console.log("Order placed", event.orderID);
},
});
export const create = api(
{ method: "POST", path: "/orders", expose: true },
async (req: { customerID: string }) => {
const row = await db.queryRow<{ id: string }>`
INSERT INTO orders (customer_id) VALUES (${req.customerID})
RETURNING id
`;
if (!row) throw new Error("insert failed");
await orderPlaced.publish({ orderID: row.id });
return row;
},
);
The same code runs locally with encore run, which starts Postgres and an in-memory Pub/Sub broker. Encore hosts a preview environment per pull request. A production deploy provisions the resources in your own AWS or GCP account. On AWS the database is RDS and the topic is SNS with SQS; Encore provisions an IAM role for the service, or a service account on GCP. The db object your handler queries is the same declaration that provisioned the database, so the resource and its use cannot drift apart.
An AI coding agent editing this codebase sees the declarations too. Ask it to add an endpoint that writes to a queue, and it uses the existing Topic instead of guessing at a Terraform file in another repository.
Encore covers application infrastructure: databases, queues, cron, object storage, secrets, caches and the services around them. It is not a general-purpose cloud resource compiler. VPC peering, custom IAM boundary policies or a fleet of raw EC2 instances belong in Pulumi, CDK or Terraform. Running Encore for the application layer and one of those for the rest is a common split. The resources live in your own cloud account, the framework is open source under MPL 2.0, and encore build docker produces a standalone image if you decide to leave.
Simon Vans-Colina, CTO at Pave Bank, said in their customer story: "My challenge was to find a way to skip building a platform as good as Monzo's. The Encore platform fit that description perfectly."
Windows: iwr https://encore.dev/install.ps1 | iex
Linux: curl -L https://encore.dev/install.sh | bash
Pulumi made general-purpose-language IaC mainstream. You write a normal TypeScript program, import provider packages, and construct resources as objects. The Pulumi CLI diffs the desired state against the actual state and applies the changes.
import * as aws from "@pulumi/aws";
const db = new aws.rds.Instance("orders-db", {
engine: "postgres",
engineVersion: "16",
instanceClass: "db.t3.micro",
allocatedStorage: 20,
dbName: "orders",
username: "app",
manageMasterUserPassword: true,
});
const topic = new aws.sns.Topic("order-placed");
export const dbEndpoint = db.endpoint;
What works well: loops, conditionals, functions and npm packages, so a reusable component is a class. One program can provision AWS, GCP, Azure, Cloudflare and Kubernetes resources side by side.
The friction is the async value model. Resource outputs are Output<T>, not plain values, as they are unknown until apply time, and you compose them with .apply() and pulumi.interpolate. State lives in Pulumi Cloud by default, or in a backend you host on S3, GCS or local disk, which is one more system to run and secure.
Good fit for: teams deploying across several clouds, or anyone who wants a full imperative language for infrastructure and is comfortable running a state backend.
The AWS Cloud Development Kit is Amazon's own TypeScript IaC. You define constructs, synthesize them to a CloudFormation template, and CloudFormation does the provisioning. AWS owns both ends, so the construct library is deep and the higher-level constructs bake in sensible defaults.
import * as cdk from "aws-cdk-lib";
import * as rds from "aws-cdk-lib/aws-rds";
import * as sns from "aws-cdk-lib/aws-sns";
import * as ec2 from "aws-cdk-lib/aws-ec2";
export class OrdersStack extends cdk.Stack {
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const vpc = new ec2.Vpc(this, "Vpc", { maxAzs: 2 });
new rds.DatabaseInstance(this, "OrdersDb", {
engine: rds.DatabaseInstanceEngine.postgres({
version: rds.PostgresEngineVersion.VER_16,
}),
vpc,
instanceType: ec2.InstanceType.of(
ec2.InstanceClass.T3,
ec2.InstanceSize.MICRO,
),
databaseName: "orders",
});
new sns.Topic(this, "OrderPlaced");
}
}
What works well: no separate state to manage, as CloudFormation tracks it inside AWS. Drift detection, rollback and change sets come from CloudFormation. Higher-level constructs handle IAM policies and security groups you would otherwise wire up by hand.
The costs: CDK is AWS-only. You inherit CloudFormation's rough edges, such as slow deploys on large stacks, occasional stuck stacks that need manual recovery, and a 500-resource-per-stack limit that pushes you into stack splitting. cdk synth output is verbose to audit.
Good fit for: teams committed to AWS who want first-party constructs and no external state backend.
CDKTF let teams keep Terraform's engine and provider registry while writing TypeScript. Constructs synthesize to Terraform JSON and run through terraform or tofu with a normal state file.
HashiCorp archived CDKTF on December 10, 2025. The repository is read-only, no compatibility fixes ship, and HashiCorp recommends migrating to standard Terraform HCL or AWS CDK. It remains usable under MPL 2.0, but it is frozen code.
import { App, TerraformStack } from "cdktf";
import { Construct } from "constructs";
import { AwsProvider } from "@cdktf/provider-aws/lib/provider";
import { DbInstance } from "@cdktf/provider-aws/lib/db-instance";
import { SnsTopic } from "@cdktf/provider-aws/lib/sns-topic";
class OrdersStack extends TerraformStack {
constructor(scope: Construct, id: string) {
super(scope, id);
new AwsProvider(this, "aws", { region: "us-east-1" });
new DbInstance(this, "orders-db", {
engine: "postgres",
engineVersion: "16",
instanceClass: "db.t3.micro",
allocatedStorage: 20,
dbName: "orders",
username: "app",
manageMasterUserPassword: true,
});
new SnsTopic(this, "order-placed");
}
}
const app = new App();
new OrdersStack(app, "orders");
app.synth();
When something breaks, you debug two layers: your TypeScript, the synthesized JSON or Terraform itself. Provider bindings are generated from Terraform schemas, so the types are accurate but not idiomatic. Keep it only for an existing codebase, and plan a move. The CDKTF alternatives guide covers the options.
Encore fits if you are building a TypeScript backend, most of your infrastructure is databases, queues, cron and storage, and you would rather declare those inline than maintain a parallel infrastructure program in your own AWS or GCP account.
Pulumi fits if you deploy across several clouds and want a full imperative language for infrastructure.
AWS CDK fits if you are all-in on AWS and want CloudFormation-managed state.
Avoid CDKTF for new work, as it is archived.
Pulumi and CDK answer "how do I write my existing IaC in TypeScript." Encore answers "what if the backend code and its infrastructure were the same thing." The right question depends on whether you maintain an infrastructure estate or build an application, and plenty of companies need both answers at once.
Encore is the tool that puts infrastructure inside the application code itself: you declare a Postgres database, Pub/Sub topic, bucket or cron job next to your TypeScript or Go handlers, and Encore provisions the matching resources in your own AWS or GCP account. Pulumi and AWS CDK let you write infrastructure in TypeScript too, but as a separate infrastructure program with its own deploy step.
AWS CDK is the better fit if you are all-in on AWS and want CloudFormation-backed deployments with no extra state to manage. Pulumi is better if you deploy across AWS, GCP, Azure or Kubernetes, or want a single tool across clouds.
No. HashiCorp archived CDK for Terraform on December 10, 2025. The repository is read-only and HashiCorp recommends moving to standard Terraform HCL or AWS CDK. Existing CDKTF code keeps working, but it receives no fixes.
Yes. Pulumi and AWS CDK both define infrastructure in TypeScript, and CDKTF did until it was archived. None of them require HCL. Infrastructure from code goes one step further and removes the separate infrastructure program.
Deploy to your cloud on AWS and Google Cloud
without managing infrastructure
Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.