Neon Introduces neon.ts for Infrastructure as Code in TypeScript
Neon's new `neon.ts` file allows developers to manage their cloud database services, functions, and other backend primitives using TypeScript, aiming to simplify infrastructure management for full-stack applications and AI agents.


Neon, a serverless Postgres provider, has launched `neon.ts`, a new feature that brings infrastructure-as-code (IaC) capabilities to its platform using TypeScript. This development aims to streamline the management of backend services for full-stack applications and AI agents, making it easier for developers to declare, provision, and manage their cloud infrastructure.
The introduction of `neon.ts` signifies Neon’s evolution into a broader platform offering backend primitives beyond its core serverless Postgres. These primitives include functions, object storage, an AI gateway, and authentication services, all of which can now be managed programmatically.
Declarative Service Management
Previously, developers could manage Neon services through the Neon CLI and a REST API. However, as projects grow in complexity, managing individual services via separate CLI commands becomes cumbersome. `neon.ts` addresses this by providing a unified, declarative configuration file. Developers can define the services their project branches should include directly within a `neon.ts` file.
For example, to enable Neon Auth and the Data API for a project, a developer would add the following to their `neon.ts` file:
import { defineConfig } from “@neondatabase/config/v1”;
export default defineConfig({
auth: true,
dataApi: true,
});
The Neon CLI, specifically `neonctl config plan`, can then show a preview of the changes, and `neonctl config apply` provisions these services. This process automatically pulls relevant environment variables into a local `.env.local` file, ensuring that the developer’s local environment stays synchronized with the deployed services.
Future Primitives and Preview Access
Neon plans to extend `neon.ts` to manage upcoming primitives such as functions, buckets, and the AI gateway. These are currently available under a preview program. Developers can sign up for the Neon Platform Preview to gain access to these features, which will be declared within a `preview` block in the `neon.ts` file.
The `neonctl deploy` command serves as a shorthand for `neonctl config apply` when the intention is solely to push configuration changes. Additionally, `neonctl link` and `neonctl checkout` commands are provided to connect a local project root to a Neon project and to switch between or create branches, respectively, supporting a branch-first development workflow.
Type-Safe Environment Variables
Complementing `neon.ts` is the new `@neondatabase/env` package, which offers type-safe environment variable management. Built on top of the `neon.ts` configuration, the `parseEnv` utility validates process.env variables against the declared Neon services. If any required variables are missing, it provides clear error messages.
This integration ensures that the shape of the environment variables directly mirrors the services enabled in `neon.ts`. For instance, enabling Neon Auth makes `env.auth` available, and enabling the Data API provides `env.dataApi`. Developers can also specify a subset of environment variables required for a particular application, further enhancing type safety and reducing potential errors.
The autocomplete feature within `neon.ts` allows developers to select only the variables that are enabled by the services in their configuration, ensuring precision and reducing the chances of misconfiguration.
Key facts
| Feature | Description |
|---|---|
| neon.ts | TypeScript-based infrastructure-as-code file for Neon services. |
| Provisioning | Manages Neon services like Postgres, Auth, Data API, Functions, and AI Gateway. |
| Environment Variables | Provides type-safe and validated environment variables via `@neondatabase/env`. |
| Workflow | Simplifies backend service management for full-stack apps and AI agents. |
This development is significant for ReviewArticle readers as it directly impacts the developer experience for building and managing applications that leverage cloud-native database services and AI primitives. By adopting an infrastructure-as-code approach with TypeScript, Neon is making it easier for developers and AI agents to provision and maintain the necessary backend infrastructure, potentially accelerating development cycles and reducing operational overhead. The focus on type safety for environment variables further enhances reliability, a crucial aspect for robust application development.
Source: Introducing neon.ts: infrastructure as code for your Neon projects – Neon Blog, https://neon.com/blog/introducing-neon-ts
Source
Neon Blog Publicacion original: 2026-06-15T12:00:00+00:00
Maya Turner
Colaborador editorial.
