Skip to content

Getting started

Fitness Tools is a set of deterministic fitness calculators — TDEE, body fat, one-rep max, macros, and more. Each calculator runs several published formulas and reports a consensus across them, so you get a defensible range instead of one black-box number. It’s a plain TypeScript library: install it, call it, done. No server, no network, no API key.

In a hurry? npm i @almostjacked/fitness-tools, then:

import { mifflinBmr, activityMultiplier } from "@almostjacked/fitness-tools";
mifflinBmr("male", 80, 180, 30) * activityMultiplier("moderate"); // 2759

That’s a single formula with no validation. The rest of this page shows the validated, multi-method version that returns a consensus across formulas — and explains what you get back.

Terminal window
npm i @almostjacked/fitness-tools

Every calculator is reached through the REGISTRY. Here’s TDEE (daily calories burned):

import { REGISTRY } from "@almostjacked/fitness-tools";
const tdee = REGISTRY.get("tdee")!;
const out = tdee.compute(
tdee.input.parse({
sex: "male",
age: 30,
height: { value: 180, unit: "cm" },
weight: { value: 80, unit: "kg" },
activity: "moderate",
}),
);
console.log(out);

You get back three things:

{
results: [
{ method: "mifflin", value: 2759, unit: "kcal/day", detail: { bmr: 1780, multiplier: 1.55 } },
{ method: "harris", value: 2873.1, unit: "kcal/day", detail: { bmr: 1853.6, multiplier: 1.55 } },
],
consensus: { mean: 2816.05, median: 2816.05, min: 2759, max: 2873.1, n: 2 },
skipped: [
{ method: "katch", reason: "katch: requires body_fat or lean_mass" },
{ method: "cunningham", reason: "cunningham: requires body_fat or lean_mass" },
],
}
  • results — one entry per formula that ran. Each is a { value, unit } plus a detail showing the intermediate numbers.
  • consensus — the agreement across those formulas: mean, median, min, max, and n (how many ran). Use mean or median as your headline number and min/max as the honest range.
  • skipped — formulas that couldn’t run and why. Here, two methods need body-fat or lean-mass to estimate lean body mass; provide body_fat and they’ll join the consensus.

Notice that units are always explicit ({ value: 180, unit: "cm" }). The library never guesses whether you meant cm or inches.

The formulas are also exported directly — fully tree-shakeable, no validation:

import { mifflinBmr, activityMultiplier } from "@almostjacked/fitness-tools";
mifflinBmr("male", 80, 180, 30) * activityMultiplier("moderate"); // 2759