Models

src/models/ holds the entity types (ShopBase, OnlineShop, UserBase, SessionBase, IdentityBase, ReviewBase, FeatureFlagBase). The storage schema itself — table validators and indexes — lives in packages/convex/convex/tables/ and must stay in sync with these types.

EntityTypes inDescription
Shopsrc/models/shop.tsA tenant. Holds domain, alternative domains, i18n config, integrations.
Usersrc/models/user.tsA human operator. Connected to one or more shops as a collaborator.
Sessionsrc/models/session.tsNextAuth session document (Auth.js database-session adapter).
Identitysrc/models/identity.tsOAuth identity / provider account record.
Reviewsrc/models/review.tsProduct reviews (where shops opt in).

All documents share the BaseDocument shape — a public string id (never the raw Convex _id) plus Date-typed managed timestamps:

type BaseDocument = { id: string; createdAt: Date; updatedAt: Date };