Skip to content

orm init: say where to get a Postgres database and how to deploy #30688

Open

Description

@gregory-boch-prisma

What problem are you trying to solve?

prisma orm init --target postgres leaves a new project with a localhost placeholder and nothing that says where a database can come from or how the app gets hosted.

Output today (prisma 8.0.0-rc.22, npx -y prisma@latest orm init --yes --target postgres --authoring psl), from the result document:

1. Set DATABASE_URL in your environment (export it or add it to .env).
2. Edit your schema at src/prisma/contract.prisma, then re-run `prisma contract emit`.
3. Open prisma-8.md for a quick reference on how to write your first typed query.
4. Working with a coding agent? Run `prisma init` in this project to set up the Prisma agent skills.
  • .env.example (and .env with --write-env) holds only DATABASE_URL="postgresql://user:password@localhost:5432/mydb" (src/commands/init/templates/env.ts).
  • prisma-8.md (templates/quick-reference-postgres.md) shows the same placeholder and names no way to get a database.
  • The prisma-8 skill's quickstart, under "DATABASE_URL not set", only says to have the user set it (skills/prisma-8/references/quickstart.md).

A coding agent in the project reads exactly this output and these files. With no database at hand it stops to ask, or improvises a local Postgres setup.

Prisma 7's init did name a cloud option for Postgres (packages/cli/src/Init.ts at tag 7.10.0, line 700):

CREATE NEW DATABASE:
  Local: npx prisma dev (runs Postgres locally in your terminal)
  Cloud: npx create-db (creates a free Prisma Postgres database)

and the generated schema carried // Get a free hosted Postgres database in seconds: npx create-db. Prisma 8's init dropped both, so this is a parity gap more than a new feature. (prisma dev is not proposed: in the unified CLI it runs a Composer app.)

Proposed solution

Postgres target only. The Mongo output and the Prisma 7 transition steps (pushPrisma7Steps) stay as they are.

  1. nextSteps, DATABASE_URL step (buildNextSteps in src/commands/init/output.ts). It keeps the DATABASE_URL substring that the doc comment tells agents to match on:

    Set DATABASE_URL in your environment (export it or add it to .env). No database yet? npx create-db@latest creates a temporary Prisma Postgres database and prints its URL; it is deleted after 24 hours unless you claim it.

  2. New step before the agent-skills step:

    To host the app: prisma deploy module.ts deploys a Prisma Composer (Early Access) app to Prisma Compute after prisma auth login and a build: https://www.prisma.io/docs/compute/getting-started

  3. Typed next actions (buildInitNextActions in src/orm/init-blocks.ts): the same two, as a run-command for npx create-db@latest and a user-choice for hosting.
  4. .env and .env.example, a comment above DATABASE_URL:

    # No database yet? npx create-db@latest creates a temporary Prisma Postgres database (deleted after 24 hours unless claimed).

  5. prisma-8.md, after the DATABASE_URL paragraph:

    Any PostgreSQL 15+ server works, local or hosted. No database yet? npx create-db@latest creates a temporary Prisma Postgres database and prints its connection string. It is deleted after 24 hours unless you claim it, and claiming it (free) needs a Prisma account. To host the app, npx prisma deploy module.ts deploys a Prisma Composer (Early Access) app to Prisma Compute after npx prisma auth login and a build: see Getting started.

  6. skills/prisma-8/references/quickstart.md, "DATABASE_URL not set" and Greenfield step 1: the same create-db option, with --json (connectionString, claimUrl) for agents.

Smoke test, 2026-10-12 (prisma 8.0.0-rc.22, @prisma/orm-postgres 8.0.0-rc.17, create-db 1.2.1, Node 22.23): prisma orm init --yes --target postgres --authoring psl, then npx create-db@latest --json with its connectionString in .env, then prisma db init (5 operations applied, database signed), then the quickstart's first arc (create plus select on User) printed the rows. Creating the database needed no account; I did not claim it.

Alternatives considered

  • Leave it to the docs. An agent working in the project reads the CLI output and the generated files, not docs pages.
  • A local database instead. Any PostgreSQL 15+ server keeps working; the new text says so in prisma-8.md. create-db is the one option that needs no install and no account, which is why Prisma 7 listed it.
  • Only the database line, no deploy step. Fine by me if you'd rather keep init about the ORM. The deploy step is the one I am least sure belongs here.

Scope and impact

  • packages/1-framework/3-tooling/cli: output.ts, init-blocks.ts, init.ts (passes target to buildInitNextActions), templates/env.ts, templates/quick-reference-postgres.md, tests (the templates.test.ts snapshot, nextSteps and next-action tests, including ones that pin the Mongo and Prisma 7 output).
  • skills/prisma-8/references/quickstart.md.
  • scripts/lint-framework-vocabulary.config.json: the new lines name the Postgres target in the framework CLI, so the ratchet goes from 254 to 259. If you'd rather the target-specific text live elsewhere, tell me where.
  • Not breaking: nextSteps is prose that agents match on by substring, and DATABASE_URL stays in the first step.

I have the change ready on feat/orm-init-database-and-deploy-steps and will open it as a draft PR that refs this issue. @wmadden @SevInf, does this direction work for you, and would you change the wording?

Activity

  1. added
    kind/feature
    on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions