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"); // 2759That’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.
1. Install
Section titled “1. Install”npm i @almostjacked/fitness-tools2. Run your first calculation
Section titled “2. Run your first calculation”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);3. Read the result
Section titled “3. Read the result”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 adetailshowing the intermediate numbers.consensus— the agreement across those formulas:mean,median,min,max, andn(how many ran). Usemeanormedianas your headline number andmin/maxas 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; providebody_fatand 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.
4. Prefer a single function?
Section titled “4. Prefer a single function?”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"); // 2759What next
Section titled “What next”- Browse what each calculator does on the Tools pages.
- Understand methods and consensus in depth.
- Validate untrusted input (forms, APIs): Validation.
- Calling from another language or an agent? See the HTTP API and MCP server.