Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* The minimal `.gitignore` lines a Prisma Next scaffold needs (FR3.3).
* The minimal `.gitignore` lines a Prisma ORM scaffold needs (FR3.3).
* Order matches what Node tooling typically writes today.
*
* `node_modules/` first because it's the byte-largest miss; `dist/`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Welcome to Prisma Next!
# Welcome to Prisma ORM!

Prisma Next lets you query your database in simple, easy-to-read TypeScript. Define what your data looks like, and Prisma Next gives you a fully typed client — with autocomplete for every collection, field, and relation.
Prisma ORM lets you query your database in simple, easy-to-read TypeScript. Define what your data looks like, and Prisma ORM gives you a fully typed client — with autocomplete for every collection, field, and relation.

This project is set up for MongoDB. Prisma Next also supports other databases.
This project is set up for MongoDB. Prisma ORM also supports other databases.

{{requirements}}

Expand Down Expand Up @@ -34,7 +34,7 @@ Your contract has two companion files in the same directory:

Commit both files to git. When you change your contract, run `{{pkgRun}} contract emit` to update them.

If you use a framework like Next.js or Vite, the Prisma Next plugin will do this for you automatically.
If you use a framework like Next.js or Vite, the Prisma ORM plugin will do this for you automatically.

## Configuration

Expand Down Expand Up @@ -97,14 +97,14 @@ Multi-document transactions and change streams require MongoDB to run as a **rep
- **`mongodb-memory-server`:** use `MongoMemoryReplSet` instead of `MongoMemoryServer` in tests.
- **MongoDB Atlas:** every Atlas cluster is already a replica set.

The transaction API (`db.transaction(...)`) is on the roadmap and tracked under [TML-2313](https://linear.app/prisma-company/issue/TML-2313/mongo-dev-replica-set-story-is-missing-transactions-change-streams). Prisma Next's Mongo facade does not expose it yet — until that ticket lands, drive transactions yourself with a raw `MongoClient` using the escape hatch in the next section.
The transaction API (`db.transaction(...)`) is on the roadmap and tracked under [TML-2313](https://linear.app/prisma-company/issue/TML-2313/mongo-dev-replica-set-story-is-missing-transactions-change-streams). Prisma ORM's Mongo facade does not expose it yet — until that ticket lands, drive transactions yourself with a raw `MongoClient` using the escape hatch in the next section.

## Escape hatches

The ORM covers the common cases. For the rest, two escape hatches are designed in:

- **Typed raw aggregations — `db.query`.** The facade exposes `db.query`, a typed builder for aggregation pipelines that runs through the same runtime + middleware + codec stack as `db.orm`. Reach for it when the ORM can't express a `$lookup`/`$facet`/`$graphLookup`/window-function pipeline.
- **Direct `mongodb` driver control — `mongoClient` binding.** Construct your own `MongoClient` and pass it to `mongo({ mongoClient, dbName, contractJson })`. Your code keeps the `MongoClient` reference and uses it directly (transactions, change streams, sessions, anything Prisma Next doesn't surface yet); the same `db` object continues to give you the typed ORM.
- **Direct `mongodb` driver control — `mongoClient` binding.** Construct your own `MongoClient` and pass it to `mongo({ mongoClient, dbName, contractJson })`. Your code keeps the `MongoClient` reference and uses it directly (transactions, change streams, sessions, anything Prisma ORM doesn't surface yet); the same `db` object continues to give you the typed ORM.

`db.runtime()` is **not** the escape hatch — it returns the internal executor (`MongoRuntime`), not a `mongodb` `MongoClient` or `Db`. Use `db.query` for raw aggregations and the `mongoClient` binding for direct driver control.

Expand All @@ -113,5 +113,5 @@ The ORM covers the common cases. For the rest, two escape hatches are designed i
If this project lives inside a pnpm workspace, a few things are worth knowing:

- **Catalogs.** When the workspace's `pnpm-workspace.yaml` defines a `catalogs` entry for `prisma` or `{{pkg}}`, pnpm uses the catalog version everywhere — `init` does too. If you wanted the published `latest` instead, update or remove the catalog entry, then re-run `pnpm install`.
- **`pnpm dlx`.** `pnpm dlx prisma@next orm init …` works in any directory. Inside a workspace, pnpm still resolves dependencies through the workspace's catalog/overrides rather than the registry; expect the installed Prisma Next packages to reflect the workspace's catalog rather than `latest`.
- **`pnpm` → `npm` fallback.** If `pnpm` ever fails to install Prisma Next with a `workspace:*` or `catalog:` resolution error (a leak in a published artefact), `init` falls back to `npm install` and surfaces a warning. Once the offending package republishes a clean version you can switch back with `pnpm install`.
- **`pnpm dlx`.** `pnpm dlx prisma@next orm init …` works in any directory. Inside a workspace, pnpm still resolves dependencies through the workspace's catalog/overrides rather than the registry; expect the installed Prisma ORM packages to reflect the workspace's catalog rather than `latest`.
- **`pnpm` → `npm` fallback.** If `pnpm` ever fails to install Prisma ORM with a `workspace:*` or `catalog:` resolution error (a leak in a published artefact), `init` falls back to `npm install` and surfaces a warning. Once the offending package republishes a clean version you can switch back with `pnpm install`.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Welcome to Prisma Next!
# Welcome to Prisma ORM!

Prisma Next lets you query your database in simple, easy-to-read TypeScript. Define what your data looks like, and Prisma Next gives you a fully typed client — with autocomplete for every table, column, and relation.
Prisma ORM lets you query your database in simple, easy-to-read TypeScript. Define what your data looks like, and Prisma ORM gives you a fully typed client — with autocomplete for every table, column, and relation.

This project is set up for PostgreSQL. Prisma Next also supports other databases.
This project is set up for PostgreSQL. Prisma ORM also supports other databases.

{{requirements}}

Expand Down Expand Up @@ -32,7 +32,7 @@ Your contract has two companion files in the same directory:

Commit both files to git. When you change your contract, run `{{pkgRun}} contract emit` to update them.

If you use a framework like Next.js or Vite, the Prisma Next plugin will do this for you automatically.
If you use a framework like Next.js or Vite, the Prisma ORM plugin will do this for you automatically.

## Configuration

Expand Down Expand Up @@ -92,5 +92,5 @@ You can customize how your environment variables are loaded by changing or remov
If this project lives inside a pnpm workspace, a few things are worth knowing:

- **Catalogs.** When the workspace's `pnpm-workspace.yaml` defines a `catalogs` entry for `prisma` or `{{pkg}}`, pnpm uses the catalog version everywhere — `init` does too. If you wanted the published `latest` instead, update or remove the catalog entry, then re-run `pnpm install`.
- **`pnpm dlx`.** `pnpm dlx prisma@next orm init …` works in any directory. Inside a workspace, pnpm still resolves dependencies through the workspace's catalog/overrides rather than the registry; expect the installed Prisma Next packages to reflect the workspace's catalog rather than `latest`.
- **`pnpm` → `npm` fallback.** If `pnpm` ever fails to install Prisma Next with a `workspace:*` or `catalog:` resolution error (a leak in a published artefact), `init` falls back to `npm install` and surfaces a warning. Once the offending package republishes a clean version you can switch back with `pnpm install`.
- **`pnpm dlx`.** `pnpm dlx prisma@next orm init …` works in any directory. Inside a workspace, pnpm still resolves dependencies through the workspace's catalog/overrides rather than the registry; expect the installed Prisma ORM packages to reflect the workspace's catalog rather than `latest`.
- **`pnpm` → `npm` fallback.** If `pnpm` ever fails to install Prisma ORM with a `workspace:*` or `catalog:` resolution error (a leak in a published artefact), `init` falls back to `npm install` and surfaces a warning. Once the offending package republishes a clean version you can switch back with `pnpm install`.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Generated by `prisma orm init` with the Minimal template.

## Available scripts

- `{{runDev}}` — run the Prisma Next sample script
- `{{runDev}}` — run the Prisma ORM sample script

### Database and migrations

Expand All @@ -21,15 +21,15 @@ Generated by `prisma orm init` with the Minimal template.
- `{{runMigrate}}` — apply the planned MongoDB migration
- `{{runDbSeed}}` — insert sample users manually

## Prisma Next
## Prisma ORM

Prisma Next setup is scaffolded in:
Prisma ORM setup is scaffolded in:

- `{{contractPath}}`
- `prisma.config.ts`
- `prisma/db.ts`
- `src/lib/prisma.ts`

For provider-specific Prisma Next reference docs, see `prisma-next.md`. Prisma Next skills live in the upstream `skills/` directory: https://github.com/prisma/prisma/tree/main/skills.
For provider-specific Prisma ORM reference docs, see `prisma-next.md`. Prisma ORM skills live in the upstream `skills/` directory: https://github.com/prisma/prisma/tree/main/skills.

Node-based Prisma Next projects expect Node.js 24 LTS or newer.
Node-based Prisma ORM projects expect Node.js 24 LTS or newer.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Generated by `prisma orm init` with the Minimal template.

## Available scripts

- `{{runDev}}` — run the Prisma Next sample script
- `{{runDev}}` — run the Prisma ORM sample script

### Database and migrations

Expand All @@ -20,15 +20,15 @@ Generated by `prisma orm init` with the Minimal template.
- `{{runMigrate}}` — apply a planned migration
- `{{runDbSeed}}` — insert sample users manually (run after `db:init`)

## Prisma Next
## Prisma ORM

Prisma Next setup is scaffolded in:
Prisma ORM setup is scaffolded in:

- `{{contractPath}}`
- `prisma.config.ts`
- `prisma/db.ts`
- `src/lib/prisma.ts`

For provider-specific Prisma Next reference docs, see `prisma-next.md`. Prisma Next skills live in the upstream `skills/` directory: https://github.com/prisma/prisma/tree/main/skills.
For provider-specific Prisma ORM reference docs, see `prisma-next.md`. Prisma ORM skills live in the upstream `skills/` directory: https://github.com/prisma/prisma/tree/main/skills.

Node-based Prisma Next projects expect Node.js 24 LTS or newer.
Node-based Prisma ORM projects expect Node.js 24 LTS or newer.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import type {
} from './types';

/**
* Creates a programmatic control client for Prisma Next operations.
* Creates a programmatic control client for Prisma ORM operations.
*
* The client accepts framework component descriptors at creation time,
* manages driver lifecycle via connect()/close(), and exposes domain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ export function planSpacePath({
// migration packages at all. Advancing the marker without migrations
// (the db-init aggregate planner's declared-state strategy, mirrored
// here) is valid exclusively when every element the space declares is
// externally managed — nothing Prisma Next owns exists in such a space
// externally managed — nothing Prisma ORM owns exists in such a space
// (e.g. Supabase's auth/storage), so its declared state needs no
// migration to be true, and there is no command that could author an
// edge for it. A space that declares a managed element but ships no
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ export interface ContractEmitResult {
// ============================================================================

/**
* Programmatic control client for Prisma Next operations.
* Programmatic control client for Prisma ORM operations.
*
* Lifecycle: `connect(connection)` before operations, `close()` when done.
* Both `init()` and `connect()` are auto-called by operations if needed,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Programmatic Control API for Prisma Next.
* Programmatic Control API for Prisma ORM.
*
* This module exports the control client factory and types for programmatic
* access to control-plane operations without using the CLI.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function sectionAbsentDiagnostic(): Diagnostic {
return {
code: 'CONFIG.FILE_NOT_FOUND',
severity: 'error',
summary: 'No Prisma Next configuration was loaded',
summary: 'No Prisma ORM configuration was loaded',
why: `The ${ORM_CONFIG_SECTION_NAME} config section is absent, so prisma.config.ts was never evaluated.`,
nextActions: [MISSING_CONFIG_ACTION],
};
Expand All @@ -50,7 +50,7 @@ function notAnObjectDiagnostic(): Diagnostic {
return {
code: 'CONFIG.VALIDATION_FAILED',
severity: 'error',
summary: 'Prisma Next configuration must be an object',
summary: 'Prisma ORM configuration must be an object',
why: `The ${ORM_CONFIG_SECTION_NAME} config section is not an object, so no section can be read from it.`,
nextActions: [
{ kind: 'edit-file', label: 'Export a configuration object from prisma.config.ts' },
Expand All @@ -62,7 +62,7 @@ function unreadableDiagnostic(error: unknown): Diagnostic {
return {
code: 'CONFIG.VALIDATION_FAILED',
severity: 'error',
summary: 'Prisma Next configuration could not be inspected',
summary: 'Prisma ORM configuration could not be inspected',
why: error instanceof Error ? error.message : String(error),
nextActions: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { normalizeError } from './normalize-error';
*
* An `InternalError` is the one thing this boundary does not convert. Its own contract says never
* to catch it outside the outermost boundary: it means an invariant broke, which is a bug in
* Prisma Next rather than something the user did. Re-throwing lets the engine settle it as a bug
* Prisma ORM rather than something the user did. Re-throwing lets the engine settle it as a bug
* at exit 1, where converting it would report the same number as a bad connection string.
*/
function isRecord(value: unknown): value is Record<string, unknown> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function pnpmLeakedASpecifier(failure: CliStructuredError): boolean {
function fallbackWarning(failure: CliStructuredError): string {
const firstLine = redactSecrets(metaString(failure, 'stderrTail')).trim().split('\n')[0] ?? '';
return [
'pnpm could not install: a published Prisma Next dependency leaked a `workspace:*` or `catalog:` specifier.',
'pnpm could not install: a published Prisma ORM dependency leaked a `workspace:*` or `catalog:` specifier.',
'Falling back to npm so init can complete.',
firstLine === '' ? '' : ` pnpm error: ${firstLine}`,
'Both installs ran under npm, which writes a package-lock.json beside the pnpm lockfile — delete whichever of the two you do not want to keep.',
Expand Down
4 changes: 2 additions & 2 deletions packages/1-framework/3-tooling/cli/src/orm/init-scaffold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const ENV_EXAMPLE_FILE = '.env.example';
* one of these is the destructive act consent is asked for.
*
* `.env.example` is written the same way but deliberately left out: it is a
* conventional filename in projects that have never seen Prisma Next, and a
* conventional filename in projects that have never seen Prisma ORM, and a
* consent token demanded for it would fire on first runs. The scaffold warns
* when it replaces one instead.
*/
Expand Down Expand Up @@ -201,7 +201,7 @@ function planScaffold(ctx: {

if (existsSync(join(cwd, ENV_EXAMPLE_FILE))) {
warnings.push(
`${ENV_EXAMPLE_FILE} already existed and was replaced with the Prisma Next template.`,
`${ENV_EXAMPLE_FILE} already existed and was replaced with the Prisma ORM template.`,
);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/1-framework/3-tooling/cli/src/orm/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export interface InitCommandDependencies {
export const createInitCommand = (injected: InitCommandDependencies) =>
defineOrmCommand({
help: {
summary: 'Initialize a new Prisma Next project',
summary: 'Initialize a new Prisma ORM project',
description:
'Scaffolds config, schema, and runtime files, installs dependencies,\n' +
'and emits the contract. Gets you from zero to typed queries in one step.\n' +
Expand Down Expand Up @@ -188,7 +188,7 @@ export const createInitCommand = (injected: InitCommandDependencies) =>
{
why: `The success document failed schema validation: ${String(validated)}`,
nextActions: [
chooseAction('This is a bug in Prisma Next. Please report it with `-v` output.'),
chooseAction('This is a bug in Prisma ORM. Please report it with `-v` output.'),
],
docsUrl: docsUrlFor('CLI.INIT_INVALID_OUTPUT_DOCUMENT'),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface LoadOrmConfigOptions {
* The engine ships its own synchronous loader, but the bin owns the load: the
* ORM's c12 loader evaluates the module asynchronously and finalizes paths
* against the config file's own directory. It reads the same shape the engine
* does — defineConfig from `@prisma/cli-engine` with the whole Prisma Next
* does — defineConfig from `@prisma/cli-engine` with the whole Prisma ORM
* configuration nested as the single `orm` section.
*
* Only failures that prevent evaluation entirely are diagnostics here, and
Expand Down
4 changes: 2 additions & 2 deletions packages/1-framework/3-tooling/cli/src/orm/lsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ function signalExitCode(reason: unknown): number {

export const lspCommand = defineServerCommand({
help: {
summary: 'Start the Prisma Next language server',
summary: 'Start the Prisma ORM language server',
description:
'Launches a Language Server Protocol server that publishes PSL parse diagnostics\n' +
'and handles whole-document PSL formatting for the schema inputs declared in\n' +
'your config (contract.source.inputs). Formatting uses the Prisma Next PSL\n' +
'your config (contract.source.inputs). Formatting uses the Prisma ORM PSL\n' +
'formatter and the formatter block from the project config.\n' +
'Communicates over stdio; intended to be spawned by an\n' +
'editor, not run interactively. The server keeps running until the editor client\n' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function senderPath(): string {

function firstRunNotice(configPath: string): string {
return [
'Prisma Next collects anonymous CLI usage data, enabled by default.',
'Prisma ORM collects anonymous CLI usage data, enabled by default.',
"What's collected and why: https://prisma-next.dev/docs/cli/telemetry.",
'Opt out: run "prisma telemetry disable", set DO_NOT_TRACK=1 or',
`PRISMA_NEXT_DISABLE_TELEMETRY=1, or set "enableTelemetry": false in ${configPath}.`,
Expand Down
Loading
Loading