Overview

The platform's Convex deployment: the schema, every table definition, and every server function the apps call. If data persists anywhere in Nordcom Commerce, it persists here.

Apps never import this package's functions directly — they go through the service seam in @nordcom/commerce-db (shops, users, sessions, identities, reviews, feature flags) or the storefront's CMS getters (the cms/read functions).

For the canonical reference, see the README on GitHub.

Layout

AreaPurpose
convex/schema.tsdefineSchema, composed by spreading the tables/ groups — never add tables here directly.
convex/tables/Table groups (shops, auth, reviews, cms*, revalidation). tables/cms.ts is generated by pnpm cms:gen.
convex/db/The packages/db seam: shops, shop_write (upsertShop), users, sessions, identities, feature_flags, reviews.
convex/cms/Editor + read functions: documents (drafts/autosave/versions/publish), read, media, prosemirror, list.
convex/revalidate/Publish → tag fanout → signed delivery to the storefront's /api/revalidate/convex route.
convex/lib/Trust tiers (server/tenant/system), RLS helpers, scan budgets, env access.

Trust tiers

Every public function is built with one of three constructors (convex/_constructors.ts):

  • tenantQuery/tenantMutation — requires a validated end-user identity (the NextAuth-derived RS256 JWT) and resolves the caller's shop membership.
  • serverQuery/serverMutation — admits an identity-less server caller only when it presents CONVEX_SERVER_SECRET; used for pre-tenant reads (Shop.findByDomain in middleware) and the Auth.js adapter.
  • systemQuery/systemMutation — internal/cron surfaces.

Testing

Unit tests run in-memory via convex-test. Boundary behavior against a REAL local backend (document-size ceilings, scan budgets, autosave OCC) lives in @nordcom/commerce-test-convex's limits suites, which CI runs whenever this package changes.

On this page