Project
The Project resource lets you create and manage Prisma Postgres projects, which serve as containers for your databases and their configurations. Projects belong to a workspace and can contain multiple databases.
Minimal Example
Section titled “Minimal Example”Create a basic project with default settings:
import { Project } from "alchemy/prisma-postgres";
const project = await Project("my-app");
console.log(`Project ID: ${project.id}`);console.log(`Project Name: ${project.name}`);console.log(`Workspace: ${project.workspace.name}`);
Project with Delete Protection
Section titled “Project with Delete Protection”By default, projects are not deleted when the Alchemy resource is destroyed in order to prevent accidental data loss. Enable deletion if you want the project to be removed:
import { Project } from "alchemy/prisma-postgres";
const ephemeralProject = await Project("test-project", { name: "test-project", delete: true });
Complete Example with Database
Section titled “Complete Example with Database”Create a project and add databases to it:
import { Project, Database } from "alchemy/prisma-postgres";
const project = await Project("my-app", { name: "my-app"});
const productionDb = await Database("production", { project: project, region: "us-east-1"});console.log(`Production DB: ${productionDb.name}`);
Related Resources
Section titled “Related Resources”- Database - Create databases within a project
- Connection - Create connection strings for databases
- Workspace - Learn about Prisma workspaces