Documentation
IntroductionArchitectureMonorepo & ToolingRunning Locally
Screen Flow MapUser JourneysPersonas & RolesWeb ScreensClient Portal
Convex OverviewData ModelFunctions ReferenceAuth & SessionsRoles & PermissionsJobs & Providers
Web Design SystemAdmin Console DesignPatterns & Conventions
Web AppiOS AppMarketing Website
Testing & HarnessCI Pipeline

Functions Reference

Functions Reference

Every exported Convex function, by module. Org-scoped functions (orgQuery/orgMutation) implicitly take sessionToken + orgSlug; only additional args are listed. The policy in italics is the server-side gate (see Roles & Permissions). Nearly every mutation writes an audit log entry.

auth.ts

FunctionKindArgsDoes
signInactionemail, passwordPBKDF2 verify → {ok, token?, error?}; mints a 14-day session
signOutmutationsessionTokendeletes the session
mequerysessionTokencurrent user + active org memberships (account picker / shell)
userByEmail, createSession, setPassword, hashForSeedinternal—seeding & sign-in plumbing

orgs.ts

FunctionArgsDoes
shell—app-shell bootstrap: branding, my role, locations, unread badges, clocked-in state
updateGeneralSettingsname/timezone/accentColor/check-in windowssettings.manage
logoUploadUrl / logoSetstorageId?brand logo; settings.manage

clients.ts

FunctionArgsDoes
listPagepaginationOpts, search?, includeArchived?cursor-paginated alphabetical list; VIP masked without clients.view_vip
listsearch?, includeArchived?non-paginated (take 50 on search)
getclientIddetail with pets, orders, visits, agreements; null on bad/cross-tenant id
create / update / setArchivedclient fieldsclients.manage; update refuses to wipe a VIP flag hidden from the caller

pets.ts

FunctionArgsDoes
listPage / listsearch?, statusFilter?pet lists (list adds open-issue titles + in-house flag)
getpetIdfull detail: visits, care events, photos, medication needs
create / update / updateCarepet fieldspets.manage; updateCare is the focused feeding/allergies/status editor
birthdays—birthdays in the next 30 days

visits.ts

FunctionArgsDoes
liststatus?, locationId?filterable list (incl. checked-in-today / checked-out-today pseudo-filters)
getvisitIddetail with care events, order/deposit state, agreement checklist
bookpet/location/room/product/scheduleinserts as planned; visits.manage
checkInvisitId, roomId?, overrideAgreements?visits.checkin; blocks on unsigned required agreements unless override + visits.checkin_override
checkOutvisitId→ completed; visits.checkin
cancel / markNoShow / update / cancelMany—visits.manage

All transitions funnel through the internal transition() helper enforcing VISIT_TRANSITIONS.

careEvents.ts / medications.ts / issues.ts

FunctionArgsDoes
careEvents.forVisitvisitIdcare log
careEvents.logvisitId, type, note?, at?one-tap log; visits.checkin
careEvents.removeeventIdvisits.manage
medications.listForPetpetIdneeds with last dose
medications.addNeed / setNeedActive—pets.manage
medications.administerneedId, visitId, note?records a paired careEvent dose; visits.checkin
issues.listForPetpetIdissue history
issues.openpetId, visitId?, type, severity, title, note?visits.checkin
issues.resolveissueId, resolutionNote?serious issues require visits.checkin_override

agreements.ts / documents.ts

FunctionArgsDoes
agreements.statusForVisitvisitIddesk checklist of signed/unsigned required agreements
agreements.signAtDeskagreementId, clientId, visitId?, signedNamestaff-captured signature; visits.checkin
documents.generateUploadUrl / attach / remove—pets.manage; MIME allowlist (pdf/doc/docx/txt/jpeg/png)
documents.listForpetId? | visitId? | clientId?with signed URLs

products.ts / orders.ts / paymentMethods.ts

FunctionArgsDoes
products.list / gettype?, includeInactive?catalog
products.create / update / setActive—products.manage
orders.liststatus?, clientId?with balance/deposit rollups
orders.getorderIditems, payments, history
orders.createclientId, locationId, items[], notes?computes totals + per-location tax (default 925 bps), decrements retail inventory, assigns order number; orders.manage
orders.recordPaymentorderId, amountCents, methodType, last4?manual payment capped at balance; orders.manage
orders.refundorderId, paymentId, amountCentsorders.refund; caps against remaining refundable per payment; >30-day-old payments need orders.refund_override
orders.setFulfillment / setItemNote / markPickupComplete / archiveMany—orders.manage
paymentMethods.listForClientclientIdwallet
paymentMethods.addDevCard / remove / charge—dev vault; orders.manage; non-dev providers throw PROVIDER_NOT_CONFIGURED

portal.ts (customer self-service)

Scoped to the caller's own client record; staff pass asClientId (requires clients.manage, audit-logged via startImpersonation).

FunctionDoes
myOverviewpets, upcoming visits, orders, agreements to sign, bookable products, wallet
bookVisitself-serve booking: creates visit + order with deposit
payOrder / addCardpay own order / vault a card (dev)
myThread / sendMessagethe client's thread (find-or-create)
generateUploadUrl / attachDocumentupload vet records to own pets
signAgreementself-sign

messages.ts / notes.ts

FunctionDoes
messages.threadList / threadinbox with unread counts / full thread with attachment URLs
messages.send / startThread / generateAttachmentUploadUrloutbound by channel; messages.send
messages.markThreadReadread receipts
notes.listsorted: unacked-required → pinned → recent, with x/y ack counts
notes.create / update / removenotes.manage
notes.markReadacknowledge

staff.ts / timeclock.ts / schedules.ts

FunctionDoes
staff.list / getroster with pay + clocked-in state; PIN exposed only as hasPin; staff.manage
staff.invite / updateMembershipcreate/link user + membership; role/title/pay/PIN/active; staff.manage
timeclock.clockIn / clockOutself; double-punch guarded
timeclock.entriesuserId?, fromMs?, toMs?; employees forced to own entries
timeclock.approve / updateEntrytimeclock.approve; edits stamp editedBy
schedules.weekweekly grid per staff member
schedules.upsertShift / removeShiftstaff.manage

board.ts / dashboard.ts / reports.ts / search.ts

FunctionDoes
board.livethe flagship reactive board: rooms, in-house pets with care chips, arrivals with agreement/deposit prompts, counts
dashboard.dailyKPIs, arrivals/departures, issues, notes/threads, clocked-in, shifts, HR row, birthdays
reports.sales / transactions / petsClients / timeClock / overtime / missedPunches / readinessthe seven reports; all reports.view
search.globalq → combined client + pet search-index lookup (8 each)

settings.ts

All settings.manage unless noted: locationsList, locationUpsert, roomUpsert, policiesGet, policySet, policyReset, agreementsList, agreementUpsert (append-only versioning), remindersList, reminderUpsert, foodBrandsList (ungated), foodBrandUpsert, foodBrandRemove, feedInfo, regenerateFeedToken.

platform.ts (landlord — not org-scoped)

FunctionDoes
directorypublic list of active orgs
amIPlatformOwnernon-throwing check (active owner membership anywhere)
applicationsList / applicationSetStatusplatform-owner only; approval creates an inactive org
applypublic application submission (validates name/email)

crons.ts / http.ts / seed.ts / providers

See Jobs & Providers. Seed: seed.run (action) → seed.insertAll builds the deterministic demo-boarding world (mulberry32(20260712)).