npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sculpt-ai/nutrition

v0.3.0

Published

Calorie and macro engine: maintenance, pace, floors and macros, the one calculator behind Sculpt AI's app, server and website

Downloads

885

Readme

@sculpt-ai/nutrition

The one calorie and macro engine behind Sculpt AI. The app (on the device), the backend, the website and the calculator site all import this package, so a calorie number means the same thing everywhere. Change a rule here, publish, bump the consumers.

What it computes

  • BMR: Mifflin-St Jeor; when a body-fat percentage (3-70%) is known, the average of Mifflin-St Jeor and Katch-McArdle (Mifflin keeps age and sex, Katch-McArdle body composition, and a rough body-fat estimate moves the result half as far).
  • Maintenance (TDEE): resting burn plus planned training. Resting burn is BMR × 1.4 (BASELINE_PAL: everyday life with no structured exercise, food digestion included; doubly-labelled-water studies put sedentary adults at about 1.4-1.65 × BMR). Training is the session burn above resting (4.5 MET strength, from training days × sessionMinutes, 45 when unknown) averaged over the week, plus 10% for digestion. calculate() and computePlan() share this model, so a calculator page and the app give one number. An activityLevel input (no training days or minutes to price) keeps the old multiplier table (sedentary 1.2 … very active 1.9).
  • Pace: 500 kcal a day per lb a week (weeklyChangeKg × 2.20462 × 500).
  • Macros: protein by g/lb for the training style and week (a BMI-27.5 weight above BMI 30), fat 25% of calories (20% when the deficit left after the floor is 1,000 kcal a day or more) and never under 0.6 g per kg of that protein weight, carbs the rest.
  • Floor: 1,500 kcal (1,200 for women), or 13 kcal per kg when that is higher. A target under it is raised to it: protein kept, fat scaled (still at least the fat minimum), carbs fill the rest.
  • Add back what you burn: the target less the average day's add-back, never under the no-training target (resting burn less the pace).
  • Expenditure: today's measured burn from steps, workouts and BMR.

Use

import { computePlan } from '@sculpt-ai/nutrition';

const plan = computePlan({
  age: 26,
  gender: 'male',
  weight: 227,
  weightUnit: 'lbs',
  height: 72,
  heightUnit: 'in',
  bodyFatPercentage: 32,
  exerciseFrequency: 2,
  exerciseType: 'hypertrophy',
  weeklyChangeKg: -0.7938,
});

plan has calories, protein, carbs, fat, maintenanceCalories, dailyChangeKcal, calorieFloor, calorieFloorApplied and eatBack. kg/cm and lbs/in give the same plan.

calculate(request) is the calculator service's original request and response (results plus the worked steps), for pages that show the working.

Develop

npm install
npm test
npm run build

Release

Bump version, then npm run release. It tests, builds and publishes to public npm and to GitHub Packages: the app and backend resolve @sculpt-ai/* from GitHub Packages, the website and calculator site from npm. Then bump the dependency in all four.

MIT