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.
Minimal Example
Section titled “Minimal Example”Create a basic Neon project with default settings:
import { NeonProject } from "alchemy/neon";
const project = await NeonProject("my-project", { name: "My Project",});Custom Region and Version
Section titled “Custom Region and Version”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),});Custom Branch Name
Section titled “Custom Branch Name”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",});Adopting an Existing Project
Section titled “Adopting an Existing Project”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",});