A clear definition, how infrastructure from code differs from IaC-in-a-real-language, and a ranked comparison of Encore, Nitric, SST and Pulumi.
Infrastructure from code means your application declares the cloud resources it needs in the same codebase as the handlers, and a deploy system provisions them. The best infrastructure from code tool for application teams in 2026 is Encore, which works with TypeScript and Go and deploys into your own AWS or GCP account. Nitric is the closest peer. Pulumi is IaC written in a general-purpose language, not infrastructure from code.
This guide defines the term, separates it from IaC-in-code, ranks the main tools, and ends with when to pick which.
Infrastructure from code (IfC) is an approach where:
The resource graph lives next to the code that uses it. An application change that needs a new queue is one pull request, not an app PR plus an infra PR.
Pulumi and AWS CDK improved on HCL by using real languages, but they did not move the declarations into the application. That distinction matters when AI coding agents add infrastructure: with IfC the agent edits app code; with IaC the agent edits a second program that can drift from the handlers.
For Terraform-focused comparisons, see Terraform alternatives and deploy to AWS without Terraform.
Encore is built around infrastructure from code: you declare resources as typed objects, and Encore uses static analysis to run them locally and to provision managed services in your own AWS or GCP account. It works with any framework, including NestJS and Express.
import { api } from "encore.dev/api";
import { SQLDatabase } from "encore.dev/storage/sqldb";
import { Topic } from "encore.dev/pubsub";
import { Bucket } from "encore.dev/storage/objects";
import { CronJob } from "encore.dev/cron";
import { secret } from "encore.dev/config";
const db = new SQLDatabase("orders", { migrations: "./migrations" });
const receipts = new Bucket("receipts", { versioned: false });
const stripeKey = secret("StripeKey");
interface OrderPlaced {
orderId: string;
}
export const orderPlaced = new Topic<OrderPlaced>("order-placed", {
deliveryGuarantee: "at-least-once",
});
export const place = api(
{ expose: true, method: "POST", path: "/orders" },
async (req: { total: number }): Promise<{ id: string }> => {
const row = await db.queryRow<{ id: string }>`
INSERT INTO orders (total) VALUES (${req.total})
RETURNING id::text AS id`;
await receipts.upload(
`${row!.id}.json`,
Buffer.from(JSON.stringify({ total: req.total })),
);
await orderPlaced.publish({ orderId: row!.id });
return { id: row!.id };
},
);
export const cleanup = api({}, async () => {
await db.exec`
DELETE FROM orders
WHERE completed = true
AND created_at < NOW() - INTERVAL '30 days'`;
});
const _ = new CronJob("cleanup-orders", {
title: "Clean up old orders",
every: "24h",
endpoint: cleanup,
});
Locally, encore run starts Postgres, the bucket and Pub/Sub. In your own AWS account the same code maps to RDS, S3, SNS with SQS, and Secrets Manager, with cron jobs triggered by the platform. Encore provisions an IAM role for the service (on GCP, a service account). Sizing and networking live in environment configuration.
To self-host, encore build docker --config=infra-config.json produces an image. You bring Postgres, Redis, Pub/Sub, storage and metrics. The image does not run migrations or trigger cron. See self-host build.
Josef Sima, Engineering Director at Groupon, said on the customers page: "Encore is our foundation for all new development. What used to take days or weeks between developers and infra teams now takes minutes."
Run in your terminal to get started locally.
Nitric also infers infrastructure from application code. You declare APIs, buckets, queues and topics with its SDKs, and nitric up deploys through providers that generate Pulumi or Terraform. It supports Azure as well as AWS and GCP. That generated IaC layer is the main architectural difference from Encore, which provisions from its own model and includes local infrastructure, tracing and preview environments in the same system.
SST defines infrastructure in sst.config.ts with high-level components, deployed with Pulumi. Resource linking exposes resources to application code. It suits TypeScript full-stack apps on AWS or Cloudflare. The config file is a separate infrastructure program, so SST sits between classic IaC and infrastructure from code.
No. Pulumi is IaC written in a general-purpose language. You still maintain a separate program, a state backend, and a preview/apply workflow. Choose Pulumi when a platform team owns multi-cloud infrastructure as its own codebase. Choose infrastructure from code when application teams should declare what each service needs next to the handlers.
The verdict: Encore for application teams standardizing on infrastructure from code in their own cloud; Nitric when Azure or a Pulumi/Terraform provider path is required; Pulumi when IaC stays a separate discipline.
Infrastructure from code means the application declares the databases, queues, buckets, cron jobs and secrets it needs as typed objects in the same codebase as the handlers. A deploy system reads those declarations and provisions matching managed services. It is not a separate IaC program next to the app.
Infrastructure as code (IaC) describes cloud resources in a separate codebase, such as Terraform HCL, Pulumi programs or CloudFormation. Infrastructure from code puts resource declarations inside the application. Pulumi is IaC in a general-purpose language. Tools that read resource declarations from the application itself are infrastructure from code.
Encore ranks first for application teams that want typed declarations in TypeScript or Go, local infra that matches production, and deploys into your own AWS or GCP account. Nitric is the closest peer and deploys through Pulumi or Terraform, including Azure. SST is app-focused. Pulumi remains IaC-in-code, not infrastructure from code.
No. Pulumi lets you write IaC in TypeScript, Python, Go and other languages, but the program is still a separate infrastructure codebase with its own state and preview/apply cycle. That is IaC in a real language, not infrastructure declared inside the application.
For application resources such as databases, queues, buckets, cron and secrets, yes for many teams. Org-level networking, specialized services and company-wide IAM often stay in Terraform or OpenTofu. The two approaches can run side by side, with each owning a clear set of resources.
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.