pbvex-functions
PBVex TypeScript functions
Expect a global CLI installed with npm install --global pbvex plus a matching local pbvex dependency. Use the direct pbvex command below; do not assume pnpm is installed in an application repository.
Author application code under pbvex/. Import schema/runtime APIs from public pbvex/server and validators from pbvex/values; import function factories and references from ./_generated/server and ./_generated/api after code generation. Do not import internal Go packages or manually construct function paths.
pbvex codegen
pbvex typecheck
pbvex build --check
rg -n "(query|mutation|action|httpAction)\(" pbvex
Define bounded contracts
Use defineSchema, defineTable, indexes, and v validators. Declare args and returns; validators are both runtime boundaries and generated TypeScript types. Use opaque v.id('table') values as IDs—never parse, manufacture, or retag them. Keep public and internal functions distinct: api is client-callable; internal is backend-only. Public exposure never replaces authorization: resolve ctx.auth.getUserIdentity() and enforce ownership/tenant rules.
Choose the narrowest function kind: