Introduction
Open draft specification and TypeScript SDK for portable fitness, nutrition, wearable, and laboratory data.
Draft specification — 0.0.0-local
FitData is currently an unreleased draft specification. All packages, wire schemas, and registry versions use the fixed 0.0.0-local placeholder during local iteration. No public release or backward-compatibility guarantee exists yet.
FitData defines portable, vendor-neutral data contracts for personal fitness, nutrition, wearables, sleep, and laboratory health records. It ships as a human-readable specification, generated JSON Schema files, typed TypeScript domain packages, semantic validators, JSON/JSONL serialization, and offline source mappers.
Workspace packages
Every domain owns its structural schemas, semantic checks, and generated JSON Schema. All four domains compose directly into the unified fitdata document schema using uniform domain.noun record kinds and optional ownership metadata.
| Package | Record kinds & scope |
|---|---|
@fitdata/core | Shared values, IDs, time, provenance, units and conversions, optional-ownership envelopes, core.measurement, core.series, core.summary, core.tombstone |
@fitdata/training | training.routine (step-based and timeline-based), training.workout (wearable and structured), training.threshold |
@fitdata/nutrition | nutrition.food, nutrition.nutrient, nutrition.intake, nutrition.meal, nutrition.goal, and createFoodIntake serving calculations |
@fitdata/lab | lab.biomarker, lab.test, lab.specimen, lab.result, lab.report, and the 55-biomarker / 87-test LOINC registry |
fitdata | Unified document composition (all four domains + sleep.session), profiles, JSON/JSONL, history, and seven offline provider mappers |
Quick example
Validate a FitData document or convert external provider exports offline:
import {
currentRecords,
parseDocument,
serializeJsonLines,
validateDocument,
} from "fitdata";
import { mapStravaActivities } from "fitdata/mappers";
const mapped = mapStravaActivities(stravaPayload, {
subject: "example:athlete",
importedAt: "2026-11-29T10:00:00Z",
revision: 1,
mode: "strict",
});
if (mapped.status !== "rejected") {
const checked = validateDocument(mapped.document);
if (checked.ok) {
const active = currentRecords(checked.value);
const jsonl = serializeJsonLines(checked.value);
console.log({ activeCount: active.length, bytes: jsonl.length });
}
}Explore FitData
Entity Model & Naming
Learn the domain.noun convention, optional ownership, and version vs revision lifecycles.
Training, Nutrition & Lab Specs
Read the full contracts for routines, workouts, food snapshots, and LOINC-mapped lab results.
SDK & Layered Validation
Combine JSON Schema structure checks with TypeScript semantic and graph validators.
Live Validator
Test real synthetic FitData documents and standalone entities directly in your browser.
Local workspace commands
Use Node.js 22 or later inside the monorepo:
npm ci
npm run check
npm run dev:webnpm run check runs Biome linting, TypeScript builds and type checks, JSON Schema drift checks, Vitest suites, browser bundle smoke tests, offline package install checks, and the unreleased version guard.