Skip to content
GitHubXDiscordRSS

Prisma Postgres

  • A Prisma Postgres workspace
  • A service token with workspace access
  • PRISMA_SERVICE_TOKEN set in your environment
Terminal window
bun i alchemy

Create a workspace service token in the Prisma dashboard and export it before running Alchemy commands:

Terminal window
export PRISMA_SERVICE_TOKEN="sk_..."
import alchemy from "alchemy";
import { Connection, Database, Project } from "alchemy/prisma-postgres";
const app = await alchemy("prisma-postgres-example");
const project = await Project("project");
const database = await Database("database", {
project,
region: "us-east-1",
});
const connection = await Connection("connection", { database });
console.log("Database URL", connection.connectionString.unencrypted);
await app.finalize();

To remove all resources created by the guide, run:

Terminal window
alchemy destroy