Vector
Add provider-agnostic named vector indexes with similarity search.
Use Vector to define named vector indexes once and resolve them at runtime with getVector(name) across Cloudflare Vectorize, pgvector-backed Postgres, and Upstash Vector.
- Define indexes in
server/vectors/**. - Register an index with
defineVector(options). - Resolve a handle with
getVector(name).
What Vector is
Vector gives you one portable handle for embedding, upserting, querying, fetching, and deleting vector records while keeping provider config in app setup.
When Vector fits
Vector is a good fit when you want to:
- keep named vector indexes in the repo
- use similarity search behind one runtime API
- switch vector backends without rewriting application call sites
- keep index metadata and optional embedding generation close to the index definition
Use When to use Vector when you need to choose between vector search, relational queries, and other storage primitives.
What stays portable
These parts stay stable when you switch providers:
- the discovery directory
- the definition API
defineVector() - the runtime API
getVector() - the vector name derived from the file path
- the common handle methods such as
embed(),upsert(),fetch(),query(), anddelete()
Provider-specific credentials, binding names, namespaces, and connection details live on the provider pages.