Skip to content

Latest commit

ย 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

-> Download the latest version of Masscience from the /Releases section by clicking here!

๐Ÿงฌ Masscience

Build Muscle. Control the Rate. Minimize Unnecessary Fat Gain.

A privacy-first, client-side lean bulk & mini-cut companion built around bodyweight trends instead of obsessive calorie tracking.


License Platform JavaScript Electron Android GitHub Pages Client Side


๐Ÿš€ Try Masscience ยท ๐Ÿ“– Documentation ยท ๐Ÿงฎ Algorithms ยท ๐Ÿค Contributing


๐ŸŽฏ What is Masscience?

Masscience is a data-driven bodyweight and nutrition management application designed for people who want to gain muscle while keeping unnecessary fat gain under control.

Traditional bulking often creates two extremes:

"I'll just eat everything and hope I gain muscle."

or:

"I need to weigh every ingredient of every meal."

Masscience takes a different approach.

The core idea

You don't necessarily need to know exactly how many calories you ate. You need to know how your body is responding.

Masscience observes the user's bodyweight trajectory and uses that information to estimate whether the current calorie target is producing the desired rate of gain.


๐Ÿง  How It Works

             USER PROFILE
                  โ”‚
                  โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚ Initial Estimates โ”‚
        โ”‚ BMR / TDEE / BF   โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚
                  โ–ผ
           LEAN BULK START
                  โ”‚
                  โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚ Weight Collection โ”‚
        โ”‚ + Trend Analysis  โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚
                  โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚ Rate of Gain      โ”‚
        โ”‚ kg/week           โ”‚
        โ”‚ % BW/week         โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚
                  โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚ Control Engine    โ”‚
        โ”‚                   โ”‚
        โ”‚ Is the trajectory โ”‚
        โ”‚ on target?        โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚
           โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”
           โ–ผ             โ–ผ
        ON TARGET      OFF TARGET
           โ”‚             โ”‚
           โ”‚             โ–ผ
           โ”‚       Adjust Calories
           โ”‚
           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ–ผ
             CONTINUE
                  โ”‚
                  โ–ผ
          BULK PROJECTION
                  โ”‚
                  โ–ผ
             MINI-CUT
                  โ”‚
                  โ–ผ
               REPEAT

The user does not need to understand the mathematics behind this system.

Masscience handles the calculations.


PS C:\Users\wesle\Documents\Masscience> python linesofcode.py

============================================================
                 CODE LINE COUNTER
============================================================

JavaScript              49 files        12,682 lines
JSON                     8 files        11,680 lines
Markdown                11 files         2,920 lines
CSS                      2 files         1,481 lines
XML                     12 files           303 lines
Batch                    2 files           237 lines
Python                   1 file            137 lines
PowerShell               1 file             49 lines
Shell                    1 file             44 lines
Java                     3 files            38 lines
HTML                     2 files            36 lines
TypeScript               1 file              7 lines

------------------------------------------------------------
TOTAL                   93 files        29,614 lines
============================================================


โšก Core Features

๐Ÿ‹๏ธ Lean Bulk / Mini-Cut Cycles

Masscience uses a default cycle of:

10 weeks โ€” Lean Bulk
       โ†“
3 weeks โ€” Mini-Cut
       โ†“
Repeat

Initial calorie targets:

Phase Target
Lean Bulk TDEE + 300 kcal
Mini-Cut TDEE โˆ’ 500 kcal

The system can adapt the calorie target based on observed weight trajectory.


โš–๏ธ Smart Weigh-In Frequency

One of the main goals of Masscience is to reduce the annoyance of constant weighing.

Instead of requiring daily measurements indefinitely, the application progressively reduces the frequency when enough evidence exists.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ First 10 days      โ”‚
โ”‚ DAILY               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Every other day    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ 3ร— per week        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ†“
      Maintain

If the trend becomes unreliable, Masscience can increase measurement frequency again.

Missing days

When a measurement is missing, Masscience can estimate the expected weight using the current trend.

Estimated values are explicitly marked as:

ESTIMATED

They are never presented as actual measurements.


๐Ÿ“ˆ Intelligent Weight Tracking

Daily bodyweight is noisy.

A person can gain or lose more than a kilogram without meaningfully changing their body composition.

Masscience therefore analyzes the trend, rather than reacting to individual measurements.

The trend engine accounts for:

  • day-to-day noise
  • outliers
  • measurement frequency
  • rolling observation windows
  • regression
  • trend confidence
  • rate of change

Primary metrics:

Current weight
Trend weight
Rate of gain
% bodyweight/week
Trend confidence

๐ŸŽฏ Adaptive Gain Targets

Masscience does not simply tell everyone:

Gain 0.2 kg/week.

Instead, its primary target is expressed relative to bodyweight:

% bodyweight / week

This makes the target scale between users.

The target can be influenced by:

  • bodyweight
  • training age
  • current BF estimate
  • training frequency

The objective is a conservative bulk with enough progression to support muscle gain while avoiding unnecessarily aggressive weight gain.


๐Ÿง  Adaptive TDEE

Masscience starts with an estimated TDEE:

BMR ร— Activity Factor

As the user accumulates data, the application can infer an effective TDEE from:

Observed weight change
+
Calorie target
+
Time

The system intentionally distinguishes between:

Calories prescribed

and:

Calories actually consumed

If the user does not log their food intake, Masscience cannot know their exact intake.

Therefore TDEE is presented as an estimate with uncertainty.


๐Ÿงฌ Body Composition

Masscience estimates:

  • Body-fat %
  • Fat mass
  • Lean mass
  • FFMI

Possible inputs include:

  • initial user estimate
  • waist circumference
  • neck circumference
  • height
  • bodyweight

The application can use the U.S. Navy body-fat equation when appropriate.

Important distinction

Lean Mass โ‰  Muscle Mass

Lean mass contains water and other non-fat tissues in addition to skeletal muscle.

Masscience does not pretend that an estimated increase in lean mass is an exact measurement of muscle growth.


๐Ÿ”ฎ Future Projection

Masscience can simulate possible outcomes for the end of a cycle.

Instead of producing:

You WILL weigh 68.4 kg.

it produces an estimated distribution:

Expected weight

      16%       50%       84%
       โ”‚         โ”‚         โ”‚
       โ–ผ         โ–ผ         โ–ผ
     67.2      68.0      68.9 kg

The projection engine uses Monte Carlo simulation to model uncertainty in future trajectories.

Possible outputs include:

  • projected weight
  • projected BF
  • projected lean mass
  • projected fat mass
  • projected FFMI
  • trajectory risk

๐ŸŽ›๏ธ Adaptive Calorie Controller

Masscience uses a conservative feedback-control system.

             TARGET RATE
                  โ”‚
                  โ–ผ
          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ”‚ Compare with  โ”‚
          โ”‚ actual trend  โ”‚
          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚
                  โ–ผ
              RATE ERROR
                  โ”‚
                  โ–ผ
             CONFIDENCE
                  โ”‚
                  โ–ผ
          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ”‚ Controller    โ”‚
          โ”‚ + Deadband    โ”‚
          โ”‚ + Cooldown    โ”‚
          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚
                  โ–ผ
          CALORIE ADJUSTMENT

The controller deliberately avoids making large changes based on a single noisy measurement.

It uses:

  • rate error
  • trajectory error
  • confidence
  • deadband
  • minimum evidence
  • discrete adjustment steps
  • cooldown periods

๐Ÿ“Š Confidence Instead of False Precision

Masscience does not use one giant "accuracy score."

Different parts of the system have different uncertainty.

Therefore it maintains separate confidence concepts:

Metric Meaning
Trend Confidence How reliable the observed weight trend is
TDEE Confidence How much evidence supports the TDEE estimate
BF Confidence Confidence in body-fat estimation
Projection Confidence Confidence in future trajectory

This allows the application to communicate uncertainty honestly.


๐Ÿ”ฌ Algorithm

Current algorithm version:

2.1.0

Masscience's mathematical engine is modular.

js/
โ”œโ”€โ”€ calculations.js
โ”œโ”€โ”€ trend.js
โ”œโ”€โ”€ composition.js
โ”œโ”€โ”€ control.js
โ”œโ”€โ”€ adaptive.js
โ”œโ”€โ”€ projection.js
โ”œโ”€โ”€ confidence.js
โ”œโ”€โ”€ cycle.js
โ””โ”€โ”€ storage.js

Trend

Current approach:

Rolling OLS
+
Outlier downweighting
+
Adaptive observation window

Composition

Current approach:

User BF estimate
+
Navy method
+
BF inertia
+
Uncertainty propagation

Control

Current approach:

Weight trajectory
+
Rate error
+
Trajectory error
+
Confidence
+
Deadband
+
Cooldown

Projection

Current approach:

Monte Carlo
+
Truncated-normal rate distribution
+
Uncertainty propagation

๐Ÿงช Algorithm Development

Masscience treats its mathematical model as a first-class part of the project.

Every major algorithm should be:

  • documented
  • testable
  • benchmarkable
  • replaceable
  • versioned

Algorithm changes are recorded in:

ALGORITHM_CHANGELOG.md

Complete mathematical documentation:

ARCHITECTURE.md

Build architecture:

BUILD_ARCHITECTURE.md

๐Ÿ–ฅ๏ธ Platforms

Platform Technology Output Offline
๐ŸŒ Web HTML/CSS/JS Web App โœ…
๐ŸชŸ Windows Electron .exe โœ…
๐Ÿง Linux Electron .AppImage โœ…
๐Ÿค– Android Capacitor .apk โœ…

The same frontend is reused across all platforms.

                  HTML
                   โ”‚
             CSS + JavaScript
                   โ”‚
       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ”‚           โ”‚           โ”‚
      Web       Electron    Capacitor
       โ”‚           โ”‚           โ”‚
       โ–ผ       โ”Œโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”       โ–ผ
   Browser     Win   Linux    Android

๐Ÿš€ Live Demo

๐ŸŒ Try Masscience

Open the Web App

No account required.

No backend required.

No installation required.


๐Ÿ“ฆ Installation

Web

Simply open the deployed GitHub Pages application.

Or run locally:

git clone https://github.com/wesleyyan-sb/masscience.git
cd masscience
npm ci
npm run dev

Windows / Linux / Android

Masscience includes an automated build system.

On Windows:

build.bat

One command can build:

Windows installer
Linux AppImage
Android APK
Web build

Individual targets can also be built:

build.bat windows
build.bat linux
build.bat android
build.bat web

More information:

BUILD.md

โš™๏ธ Automated Builds

Masscience is designed around reproducible builds.

Developer
    โ”‚
    โ–ผ
build.bat
    โ”‚
    โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ–ผ               โ–ผ
Web Build       Electron
                    โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”
              โ–ผ           โ–ผ
           Windows      Linux
              โ”‚           โ”‚
             .exe     .AppImage
                   

Capacitor
    โ”‚
    โ–ผ
 Android
    โ”‚
   .apk

GitHub Actions can also generate platform artifacts automatically.


๐Ÿ” Privacy First

Masscience is designed to be client-side and privacy-first.

Your data can remain entirely on your device.

There is no required:

  • account
  • backend
  • cloud database
  • telemetry server
  • external AI
  • nutrition API
  • subscription

The application can work offline.

Your:

Weight
BF estimates
Measurements
Calories
Cycle history
Projections

do not need to leave your device.


๐Ÿ“ด Offline-First

Core functionality is designed to work without an internet connection.

Offline functionality includes:

  • weight tracking
  • trend analysis
  • BF estimation
  • TDEE estimation
  • calorie recommendations
  • projections
  • Monte Carlo simulations
  • charts
  • local persistence
  • cycle management

Internet access is primarily useful for things such as downloading the application or accessing the web deployment.


๐Ÿงช Testing

Run the regression suite:

node js/tests/run-tests.js

Trend benchmark:

node js/tests/benchmark-trend.js

Monte Carlo benchmark:

node js/tests/benchmark-mc.js

The test suite covers areas such as:

  • trend calculations
  • outlier detection
  • missing measurements
  • BF inertia
  • controller behavior
  • Monte Carlo convergence
  • cycle transitions
  • projection behavior

๐Ÿ›ฃ๏ธ Roadmap

Core

  • Lean bulk cycle
  • Mini-cut cycle
  • Weight tracking
  • Trend analysis
  • Adaptive calorie control
  • BF estimation
  • FFMI estimation
  • Cycle projections
  • Monte Carlo projections
  • Confidence system
  • Smart weigh-in frequency

Platforms

  • Web
  • Windows
  • Linux
  • Android
  • Automated builds
  • Automated signed releases

Future

  • Progressive overload tracking
  • Training integration
  • Optional food tracking
  • Better water/glycogen event detection
  • Improved uncertainty calibration
  • Additional body-composition models
  • Expanded benchmark datasets
  • iOS support
  • More detailed analytics
  • Import/export improvements

๐Ÿค Contributing

Masscience is open source and contributions are welcome.

You can contribute with:

๐Ÿ’ป Code

  • frontend
  • algorithms
  • performance
  • desktop
  • Android
  • testing
  • build infrastructure

๐Ÿงฎ Mathematics

Particularly valuable contributions include:

  • better trend estimators
  • better TDEE models
  • better body-composition estimation
  • improved uncertainty modeling
  • improved projection distributions
  • real-world benchmark datasets

๐ŸŽจ Design

  • UI/UX
  • accessibility
  • responsive layouts
  • mobile experience
  • visualization

๐Ÿ“š Documentation

  • algorithm explanations
  • examples
  • translations
  • tutorials

โš ๏ธ Limitations

Masscience cannot know with certainty:

  • exact TDEE
  • exact calorie intake without logging
  • exact body-fat percentage
  • exact muscle gain
  • exact nutrient partitioning
  • exact future weight
  • exact metabolic adaptation

Human physiology is noisy and highly individual.

The application's projections are model-based estimates, not guarantees.


๐Ÿฉบ Health Disclaimer

Masscience is an informational and educational tool.

It is not a substitute for individualized advice from a qualified healthcare or nutrition professional.

The application should not be used as the sole basis for medical or nutritional decisions.


๐Ÿ“œ License

Masscience is open source.

See LICENSE for the complete license.


โญ Philosophy

Masscience exists because building muscle shouldn't require turning your life into a spreadsheet.

You shouldn't necessarily have to:

weigh every ingredient
        +
track every meal
        +
panic over daily weight fluctuations

Instead:

Train
  โ†“
Eat
  โ†“
Measure
  โ†“
Observe the trend
  โ†“
Adjust
  โ†“
Repeat

The goal isn't perfect prediction.

The goal is better decisions from imperfect data.


๐Ÿงฌ Masscience

Measure less obsessively. Understand the trend. Build muscle.


GitHub Open Source Privacy


Made for people who want to bulk smarter.

Releases

Sponsor this project

Contributors

Languages