Skip to content
GitHubXDiscordRSS

NeonProject

Learn how to create, configure, and manage Neon serverless Postgres projects and databases using Alchemy.

The NeonProject resource lets you create and manage Neon serverless PostgreSQL projects.

Create a basic Neon project with default settings:

import { NeonProject } from "alchemy/neon";
const project = await NeonProject("my-project", {
name: "My Project",
});

Create a project in a specific region with a specific PostgreSQL version:

import { NeonProject } from "alchemy/neon";
const project = await NeonProject("eu-project", {
name: "EU Project",
region_id: "aws-eu-west-1",
pg_version: 16,
apiKey: alchemy.secret(process.env.NEON_API_KEY),
});

Create a project with a custom default branch name:

import { NeonProject } from "alchemy/neon";
const project = await NeonProject("dev-project", {
name: "Development Project",
default_branch_name: "development",
});

Use NeonProject to adopt an existing project by name.

import { NeonProject } from "alchemy/neon";
const project = await NeonProject("my-project", {
adopt: true,
});

Referencing an Existing Project (NeonProjectRef)

Section titled “Referencing an Existing Project (NeonProjectRef)”

Use NeonProjectRef to reference an existing project by name.

import { NeonProjectRef } from "alchemy/neon";
const projectRef = await NeonProjectRef({
name: "my-project",
});