Prisma Next is designed around a thin, stable core. Domain-specific capabilities — vector similarity search, geospatial queries, encrypted columns, full-text search — are delivered as extension packs that you compose into your project rather than built into the core library. Extension packs contribute codecs, operations, migration support, and schema annotations, all gated by what you declare in your contract.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/prisma/prisma-next/llms.txt
Use this file to discover all available pages before exploring further.
What extension packs contribute
An extension pack is a structured bundle that can provide any combination of the following:- Schema annotations — new attributes you can apply to fields in PSL or TypeScript authoring (e.g.
@pgvector.column(length: 1536)) - Codecs — encode/decode implementations for new data types (e.g.
number[]for vector columns, brandedGeometryfor PostGIS) - Query operations — new methods on column references in the DSL (e.g.
.cosineDistance(),.cosineSimilarity()) - Capability declarations — capability keys that gate whether the runtime is allowed to use the pack’s operations
- Baseline migrations — on-disk migration files that install required database extensions (e.g.
CREATE EXTENSION IF NOT EXISTS vector)
Adding an extension pack
Add it to prisma-next.config.ts
Import the pack’s control-plane descriptor and add it to the extensions list. Use
extensions with the simplified @prisma-next/postgres/config facade, or extensionPacks with the full @prisma-next/cli/config-types directly:Use the pack in your contract
In TypeScript authoring mode, pass the pack’s pack-ref to In PSL mode, use the annotation syntax the pack provides:
defineContract and use its column types:Emit the contract
contract.d.ts.How extension packs gate capabilities
Every operation contributed by a pack is gated by a capability key declared in the contract. For example, the pgvector pack declares thepgvector.cosine capability. Your contract must include that key in its capabilities section for the cosineDistance and cosineSimilarity operations to be available in queries.
The migration runner verifies — before applying any migration — that the live database satisfies the declared capabilities. For pgvector, this means the vector Postgres extension must be installed. The pgvector pack ships a baseline migration that runs CREATE EXTENSION IF NOT EXISTS vector automatically when you run prisma-next db init or prisma-next db update.
If a query uses an operation from a pack that is not declared in the contract, the emitter or runtime surfaces a structured error — not a silent type mismatch or SQL error at execution time.
pgvector: vector similarity search
The@prisma-next/extension-pgvector pack adds support for the vector Postgres type and cosine distance/similarity operations.
vector(N) column factory enforces that every vector column declares an explicit dimension. The runtime codec is constructed against { length: N }, ensuring type-level dimension information (Vector<1536>) flows through to contract.d.ts and query result types.
Available extension packs
pgvector
Vector similarity search for PostgreSQL using the pgvector extension. Adds the
vector type, cosineDistance, and cosineSimilarity operations.PostGIS
Geospatial data support for PostgreSQL. Adds geometry and geography types, spatial indexes, and spatial query operations.
CipherStash
Encrypted column support using CipherStash EQL. Adds searchable encryption for sensitive fields with full query capability.