Skip to main content

Data model

Moveat uses PostgreSQL as the product source of truth. The schema is normalized by default. Derived summaries are used only when they improve read performance or preserve historical snapshots.

Main data areas

AreaTables
Identityusers, auth accounts, user channels.
Fitness setupuser profiles, user goals, nutrition settings.
Nutritionmeal entries, meal entry items, daily summaries.
Trainingexercises, exercise media, workout sessions, workout exercises, workout sets.
Progressweight logs.
Coachinguser coaching profile/context.

Why profile, goals and nutrition settings are separate

They represent different business concepts:
  • Profile describes the user’s physical baseline.
  • Goals describe desired outcome and activity assumptions.
  • Nutrition settings describe calorie and macro targets.
Keeping them separate avoids accidental coupling and makes updates easier to reason about.

Daily summaries

Daily nutrition summaries are derived rollups. They make dashboards cheaper and preserve the calorie target snapshot for a given day. They should remain rebuildable from meal entries.

Idempotency

Agent-originated writes should use idempotency keys. This prevents duplicated logs when external webhooks retry delivery.

Unit system

The database stores metric canonical values. User-facing APIs can return display values based on the user’s configured unit system.

Naming conventions

Physical database names use English snake_case. Prisma models use singular PascalCase and map to physical table names.