CodeVetter · Repo Unpack · Feature catalog
prisma/prisma
User-facing surface is the prisma CLI command family plus three database facades (postgres, mongo, sqlite) and extension packs. Contract commands are offline; db commands need a live connection; migration commands manage on-disk contract-to-contract edges and named refs. The language server speaks LSP over stdio. A Vite plugin re-emits the contract during dev. The Postgres client exposes sql, orm, raw, enums, transactions, and prepared statements, with a separate serverless entry that returns a connectable runtime.
- ormCommandFamily registers these command keys: contract emit, contract format, contract infer, db init, db migrate, db schema, db sign, db update, db verify, lsp, migration check, migration graph, migration list, migration log, migration new, migration plan, migration ref delete, migration ref list, migration ref set, migration show, migration status, and orm init.
- Retired invocations redirect rather than fuzzy-match: migration apply becomes {bin} db migrate --to <contract>; migration status --graph becomes migration graph; migration status --all and --limit become migration log --db <url>; migration status --ref becomes migration status --to <contract>.
- BIN_GROUPS documents four user groups: orm (only init), contract (offline emit/sign/verify artifacts), db (live database; every command needs a connection), and migration plus migration ref (on-disk packages and named pointers such as staging/production under migrations/app/refs/). The telemetry group from @prisma/cli-engine is spread in beside them.
- contract emit reads TypeScript or Prisma schema via the config source provider and writes contract.json and contract.d.ts. It is documented as offline (no database). Flags include --output-path. The human presentation prints storageHash, optional executionHash, and profileHash.
- db update compares the live database to the emitted contract and applies additive, widening, and destructive operations. Destructive work requires typing the database name, or --no-interactive --confirm <database> when there is no TTY. --dry-run previews; --to accepts a hash, prefix, ref, migration directory, or path; --advance-ref moves a named ref.
- lsp is a server command. It lazy-imports startServer from @internal/language-server, speaks stdio, accepts --clientProcessId from vscode-languageclient, and maps SIGTERM to exit 143 and other aborts to 130. The server publishes PSL diagnostics and whole-document formatting for contract.source.inputs.
- README documents the product entrypoints npm create prisma (scaffolds Next.js, Hono, Nuxt, Astro, NestJS, SvelteKit, TanStack Start, or Elysia against PostgreSQL or MongoDB) and npx prisma orm init, which writes prisma.config.ts, a starter contract, and db.ts under src/prisma/. npx prisma skills sync installs per-workflow SKILL.md files.
- Shipped extensions named in the README are @prisma/orm-extension-pgvector, @prisma/orm-extension-postgis, @prisma/orm-extension-paradedb (experimental BM25), @prisma/orm-extension-supabase (experimental), and @prisma/orm-extension-arktype-json. Postgres is the primary target, MongoDB is first-class, SQLite is a proof of concept, and MySQL is explicitly later.
- The default postgres() factory returns a PostgresClient with sql, orm, enums, nativeEnums, raw, context, contract, stack, connect, runtime, transaction, prepare, close, and Symbol.asyncDispose. Passing contract keeps a no-emit TypeScript authoring path; passing contractJson requires an explicit Contract type parameter.
- postgres/serverless exports a PostgresServerlessClient whose connect({ url }) returns a Runtime that is also AsyncDisposable. It still takes extensions, middleware, verifyMarker, and cursor options, and builds the same postgres target, adapter, and driver stack.
- Mongo and SQLite each expose defineConfig that returns PrismaNextConfig<'mongo','mongo'> or PrismaNextConfig<'sql','sqlite'> and threads an extensions array into the core config. Mongo defineConfig accepts a .ts contract path or a PSL path with enum inference codecs.
- prismaVitePlugin (default config prisma.config.ts, debounce 150ms) watches the contract source and calls the same executeContractEmit path as the CLI, serializing overlapping emits and ignoring writes to the emitted artifacts themselves.