Prisma.Project reference
Branch
Section titled “Branch”Source:
packages/prisma/src/Branch.ts
A Prisma project branch for preview-class databases and compute resources.
Standalone Branch resources always have the preview role. Promotion
changes only the default branch; Alchemy restores the previous default
before deleting a promoted branch.
Branch: Creating a Branch
Section titled “Branch: Creating a Branch”const branch = yield* Prisma.Branch("preview", { project: project.projectId, gitName: "feature/search", // optional — omitted, a stable name is generated});
branch.role; // "preview"branch.isDefault; // falseBranch: Promoting a Branch
Section titled “Branch: Promoting a Branch”const release = yield* Prisma.Branch("release", { project, gitName: "release/next", isDefault: true,});
release.role; // still "preview"release.isDefault; // trueBranch: Looking up an existing branch
Section titled “Branch: Looking up an existing branch”Branch.lookup references a branch Alchemy doesn’t manage (created in
the Prisma Console or by another stack). It is read during plan/deploy,
never created, updated or deleted.
const preview = Prisma.Branch.lookup({ branchId: "br_cmabc123def456ghi789jkl0" });Project
Section titled “Project”Source:
packages/prisma/src/Project.ts
A Prisma project, optionally with a default Prisma Postgres database.
A Project is the ownership boundary for its databases, branches, apps, and
repository link. Destroying this resource deletes the project and its
contained data. Set createDatabase: false when you want standalone
Prisma.Database resources with independent lifecycles.
Project: Creating a Project
Section titled “Project: Creating a Project”Project with a default database
const project = yield* Prisma.Project("app", { name: "app", region: "us-east-1",});Project only
const project = yield* Prisma.Project("control-plane", { createDatabase: false,});Project: Looking up an existing project
Section titled “Project: Looking up an existing project”Project.lookup references a project Alchemy doesn’t manage (created in
the Prisma Console or by another stack). It is read during plan/deploy,
never created, updated or deleted.
Prisma returns connection strings only when it creates a database, so a
looked-up one has none; declare a Prisma.Connection on it to mint
credentials.
const project = Prisma.Project.lookup({ projectId: "proj_cmabc123def456ghi789jkl0" });const db = yield* Prisma.Database("Analytics", { project });