Skip to content
infra-ts is early and moving fast.npm
infra-ts
Esc
navigateopen⌘Jpreview

Quickstart

Check out Neon environments with the infra-ts CLI.

Install the focused packages:

bun add @infra-ts/core @infra-ts/runtime @infra-ts/neon @infra-ts/cli

Create infra.ts:

import { buildNeonProject } from "@infra-ts/neon";
import { neonProjectProviderBinding } from "@infra-ts/neon/runtime";
import { defineStack } from "@infra-ts/runtime";

const database = buildNeonProject({
	projectName: "my-app-db",
	orgId: "org-example",
	region: "aws-us-east-2",
});

export default defineStack({
	name: "my-app",
	definitions: { database },
	providers: [neonProjectProviderBinding],
	environment: {
		default: "production",
		stage: (name) => (name === "production" ? "production" : "preview"),
	},
	git: { resolve: ({ branch }) => branch },
});

Set NEON_API_KEY or authenticate with the Neon CLI:

infra-ts checkout production
infra-ts checkout feature-one
infra-ts env --json
infra-ts run -- bun app.ts

Production selects the Neon default branch. feature-one gets a managed preview branch. Pooled and direct URLs are fetched in memory. To opt into a protected file:

infra-ts env --write .env.local --format dotenv

Install Git follow mode only after trusting worktree code:

infra-ts git install --trust-worktree-code

The managed post-checkout hook uses sticky local branch mappings. It never runs Git network or checkout/reset commands and never deletes provider resources.

Was this page helpful?