From the CLI
Start a Prisma ORM app with Prisma Postgres from the command line.
Use the CLI when you want Prisma ORM and Prisma Postgres set up without leaving the terminal.
Start a new app
Section titled “Start a new app”bun create prisma@latestpnpm create prisma@latestyarn create prisma@latestnpm create prisma@latestChoose PostgreSQL when prompted, and answer No to Deploy to Prisma now?. Setup adds prisma-8.md, installs project-level Prisma ORM skills for your coding agent, and writes the generated scripts used below.
Create the database
Section titled “Create the database”Create a Prisma Postgres database from the terminal and export its connection string. The generated scripts read the environment variable, not .env:
bunx create-db@latestpnpm dlx create-db@latestyarn dlx create-db@latestnpx create-db@latestexport DATABASE_URL="<the connection string create-db printed>"The command also prints a claim URL; open it within 24 hours to keep the database in your account.
Initialize the database
Section titled “Initialize the database”From the generated project directory, run:
bun run db:initpnpm run db:inityarn db:initnpm run db:initRun the app
Section titled “Run the app”Sample users are seeded automatically on the app's first query.
bun run devpnpm run devyarn devnpm run devAdd Prisma ORM to an existing app
Section titled “Add Prisma ORM to an existing app”If the app already exists, run Prisma ORM from the project root:
bunx prisma@latest orm initpnpm dlx prisma@latest orm inityarn dlx prisma@latest orm initnpx prisma@latest orm initChoose PostgreSQL and set DATABASE_URL to your Prisma Postgres connection string. Init adds prisma-8.md, package scripts, and the Prisma ORM skills for your coding agent. Then follow Add Prisma ORM to an existing PostgreSQL database.
Import an existing database
Section titled “Import an existing database”- Use Import from PostgreSQL when your source database is PostgreSQL.
- Use Import from MySQL when your source database is MySQL.