backend/packages/db/prisma/schema.prisma. Role and envelope types come from backend/packages/types/src/index.ts.
People and tenancy
| Term | Meaning |
|---|---|
| Studio | A coaching business and the tenant boundary. Model Studio. Every domain row carries a studioId. Studio-level settings live in the Studio.settings JSON field. |
| Organization | The better-auth side of a studio, stored in the auth schema. Studio.externalOrgId links the two. The web lane creates the Studio row the first time it sees a new organization. In web URLs the studio appears as [organizationSlug]. |
| User | A better-auth account in the auth schema. Owners and coaches are users. Trainees are not. |
| Coach | A staff member of a studio. Model Coach, with CoachRole HEAD_COACH or SUB_COACH. Also called a trainer or team member in the UI. |
| Owner | The user who owns the organization. Provisioned automatically as a head coach. |
| Studio role | The role on an authenticated request: OWNER, HEAD_COACH, SUB_COACH or TRAINEE (StudioRole). |
| Permission group | A finer staff permission level: super_admin, full_access, standard or read_only (StaffPermissionGroup). |
| Client | The database name for a person who trains with the studio. Model Client. Statuses: ACTIVE, PAUSED, CHURN_RISK, CHURNED, ARCHIVED. |
| Trainee | The product name for a client. The UI, the mobile app and the /v1/trainee lane say trainee. The database and most backend modules say client. They are the same thing. |
| Assigned coach | A coach responsible for a trainee. A trainee can have several, through the ClientCoach join table. |
| Lead | A prospect in the CRM, before becoming a client. Models Lead, LeadNote, LeadActivity. |
Plans, subscriptions and billing
The word plan has three meanings. Check which one is meant.| Term | Meaning |
|---|---|
| Plan (what a studio sells) | A package the studio sells to its trainees. Model Product, with an optional price in agorot (priceAgorot), an optional duration (durationValue, durationUnit), and optional links to an onboarding form and an update form. The module is products. |
| Subscription | A trainee’s purchase of a product for a period. Model ClientSubscription. Statuses: SCHEDULED, ACTIVE, FROZEN, CANCELED, EXPIRED, AWAITING_START. A trainee can hold several, including queued ones. |
| Freeze | A pause on a subscription (FROZEN). The trainee lane locks a frozen trainee out of the app unless the coach left access on through appAccessWhileFrozen. |
| Plan (training or nutrition) | In the UI, a training plan or nutrition plan is a Program. See the next section. |
| Plan (the studio’s own subscription to Perform) | The SaaS tier a studio pays for: start, grow, pro, elite or enterprise, plus extra team seats. Handled by @repo/payments with Polar and the billing module. Purchases are stored in the auth schema. |
| Seat | A staff slot included in or added to a studio’s SaaS plan. |
Programs and libraries
| Term | Meaning |
|---|---|
| Program | A training or nutrition plan assigned to one trainee. Model Program. ProgramType is TRAINING, NUTRITION or COMBINED. ProgramStatus is DRAFT, ACTIVE, PAUSED or ARCHIVED. The content is stored as JSON. |
| Template | A reusable program blueprint that belongs to the studio. Model ProgramTemplate. Assigning a template to a trainee creates a Program. |
| Folder | A grouping of templates. Model ProgramFolder. |
| Exercise library | The exercise catalog. Model ExerciseLibraryItem. Contains system exercises shared by every studio and exercises a studio created. A studio can change how a system exercise appears to it through ExerciseStudioOverride without touching the shared row. |
| Food library | The food catalog. Model FoodLibraryItem, with per-studio changes in FoodLibraryOverride and scanned products in FoodBarcodeProduct. |
| System item | A library row shared by all studios, as opposed to a studio-specific item. |
| Substitute | An alternative exercise or food a trainee may swap in. |
| File plan, link plan | A program delivered as a PDF or as a link to a site, stored in Program.pdfUrl, instead of a structured plan. |
Nutrition
| Term | Meaning |
|---|---|
| Macros | Protein, carbohydrate and fat, in grams. |
| Macro type | The dominant macro of a food: protein, carb or fat (MacroType in modules/foods/mbp.ts). Computed from the largest calorie contributor. |
| MBP | A portion-based way of expressing nutrition. Instead of calories and grams, the coach and the trainee see portions of protein, carbohydrate and fat. Enabled per studio with the mbpEnabled setting. The math lives in backend/apps/core-api/src/modules/foods/mbp.ts and is mirrored in the web and mobile apps. |
| Anchor | The number of calories that equals one portion for each macro (MbpAnchors: proteinKcal, carbKcal, fatKcal). A studio setting. |
| Serving tier | One defined serving size of a food with its macros and portion values (ServingTier). A food can have several. |
| Meal log | A meal a trainee recorded. Model MealLog. NutritionDayLog holds the trainee’s snapshot for a whole day. |
| Daily metric | Body and activity numbers for one day, such as weight, water, steps and measurements. Model DailyMetric. WeightEntry and HealthSample hold finer records. |
| Shopping list | A trainee’s grocery checklist. Model ShoppingListItem. |
Training
| Term | Meaning |
|---|---|
| Workout log | A recorded workout session with its sets. Model WorkoutLog. |
| Cardio log | A recorded cardio session. Model CardioLog. |
| Technique video | A video a trainee submits for a coach to review. Model TechniqueVideo. |
| Personal record (PR) | A trainee’s best result for an exercise, computed by the backend. |
| RIR | Reps in reserve. An optional column in the workout logger. |
| Super-set | Exercises performed back to back that share one rest timer. |
| Live Activity | The iOS lock screen card that shows the running workout or cardio session. Android uses an ongoing notification from the local cardio-notification module. |
Forms and check-ins
| Term | Meaning |
|---|---|
| Form template | A form definition built in the form builder. Model FormTemplate. FormType is INTAKE, CHECK_IN, ONE_TIME or PDF_SIGNATURE. |
| Default form | A form template supplied by Perform to every studio. Model DefaultFormTemplate. |
| Form assignment | A form sent to a specific trainee. Model FormAssignment. |
| Form response | The trainee’s submitted answers. Model FormResponse. |
| Intake form | The form a new trainee fills in at the start. FormType.INTAKE. |
| Check-in | A recurring form a trainee fills in so the coach can review progress. FormType.CHECK_IN, with a FormCadence of WEEKLY, BIWEEKLY or MONTHLY. Also called an update form. The update-forms module and the update form scheduler send them. |
| Check-in review | The coach’s review of one submitted check-in, including a draft reply and internal notes. Model CheckinReview. The module is checkins. |
| Conditions | Rules that show or hide a form field based on other answers. One engine, implemented in all three repositories. |
| PDF signature form | A document a trainee signs through a public link. FormType.PDF_SIGNATURE. The module is form-sign. |
Work surface
| Term | Meaning |
|---|---|
| Inbox item | A unit of work or a notification for a coach. Model InboxItem. InboxItemType covers messages, form events, missed check-ins, inactivity, expiring plans, calorie alerts and manual tasks. |
| Task | An inbox item that needs action. Shown on the Work Board. |
| Work Board | The coach’s task board in the web app. |
| Task automation | A rule that creates tasks when a trigger fires. Models TaskAutomation and TaskAutomationTask. TaskAssigneeMode is OWNER, RESPONSIBLE, SPECIFIC or UNASSIGNED. |
| Automation flow | A multi-step automation with waits. Runs are stored in AutomationFlowRun and FlowNodeExecution and executed by the flow-run queue. |
| Automation hook | An outbound webhook subscription for an external tool. Model AutomationHook. Delivered by the automation-hook-deliver queue. |
| Client activity | The activity feed entry on a trainee’s card. Model ClientActivity. |
| Audit log | The record of who changed what. Model AuditLog. |
Content and branding
| Term | Meaning |
|---|---|
| Content item | Something the studio publishes to its trainees. Model ContentItem. Its type is recipe, video, knowledge, pdf, link or other. Organised by ContentCategory and ContentTag. |
| Home banner | The banner at the top of the trainee app’s home screen. One per studio. Model HomeBanner. |
| Branding | The studio’s logo, name and colours. The trainee app restyles itself with them after sign-in. |
| Trainee preview | A web export of the trainee app, served by the web app under /trainee-preview, that coaches see next to a trainee’s card. |
Messaging and integrations
| Term | Meaning |
|---|---|
| SmartSend | The WhatsApp Business API provider. Sends templates, login codes and receives inbound messages. |
| OTP | A one-time code. Trainees and coaches can sign in with a code sent over WhatsApp. |
| Agent, assistant | The AI assistant coaches can message on WhatsApp. Modules agent and assistant, queue agent-reply. |
| API key | A per-studio key with the pf_live_ prefix. Model StudioApiKey. Used by the partner lane, the automation API and the MCP server. |
| MCP | Model Context Protocol. The /mcp endpoint and the perform-mcp binary expose studio data as tools for AI clients. |
| AutoFit import | A migration tool that imports a coach’s data from the AutoFit product. Module autofit-import. |
| Push token | An Expo push token registered by a trainee’s device. Model TraineePushToken. |
Engineering terms
| Term | Meaning |
|---|---|
| Core API | The Express service in backend/apps/core-api. |
| Lane | A group of routes under /v1 that share one authentication method: web, trainee, bearer, partner, automation, internal, public. |
| Web lane, web gateway | /v1/web/*. Called by the Next.js server with an HMAC signature. |
| Trainee lane | /v1/trainee/*. Called by the mobile app with a trainee token. |
| BFF proxy | The catch-all /api/* route in the web app that forwards requests and cookies to the core API. |
| Hono gateway | The Express middleware that hands /api/* requests to the Hono app holding better-auth, oRPC and the payments webhook. |
| Service auth | The HMAC signature scheme between the web app and the API, with a nonce and a timestamp for replay protection. |
| Envelope | The standard response shape: ok, then data or code and message, plus requestId. |
| Five-file module | The backend module layout: routes, controller, service, repository, schema. |
| Server consolidation | The project that moved auth, billing, mail and storage from the web repository into the backend. |
| Runtime version | The value that decides which app binaries may receive an OTA update. Equal to the app version in this project. |
| OTA | An over-the-air JavaScript update published with EAS Update, without a store release. |
| Channel | The EAS Update channel a build listens to: preview or production. |