William's Docs

Creatine Simulator

A single-page bioaccumulation and dosing simulator

What it is

A single-page web app that simulates how creatine builds up (and washes out) in muscle tissue over time under a custom dosing schedule. You set body weight/body fat and define one or more "dosing periods" (a loading phase, a maintenance phase, a break, a comeback ramp, sporadic dosing), and it plots estimated muscle creatine saturation day-by-day — useful for seeing, visually, the effect of skipping doses or changing dose size/frequency on how saturated muscles stay relative to the ~120–160 mmol/kg dry-muscle range cited in sports-nutrition literature.

Tech stack

Fully static, single HTML file — no build step, no backend. The only external dependency is Chart.js, loaded from a CDN. No frameworks, no bundler, no local dependencies.

How it works

The model is a simple day-by-day compartment simulation (an explicit Euler-style daily update, not a real differential-equation solver), with a handful of constants — a baseline level, a saturation ceiling, a daily turnover rate, and oral bioavailability. Dry muscle mass is derived from body weight and body fat.

Each simulated day, absorbed creatine is converted to mmol/kg, and the level updates as: level = level - (turnover × level) + (endogenous synthesis) + absorbed, clamped between half the baseline and the saturation ceiling. Dosing periods each have a start/end day, a dose in grams, and a frequency mode (daily, every-other-day, weekdays, X-per-week, or none). The UI reports final mmol/kg, percent of saturation, days-to-90%-saturation, and days-to-return-to-baseline, and renders the daily curve with toggleable units and reference lines.

Status

A finished, polished single-session prototype — fully styled, all interactive pieces (add/remove period, edit fields, run simulation, switch chart units) wired up correctly. It pre-loads a realistic example scenario and auto-runs on load, so it's demo-ready out of the box. The model is intentionally simplified (linear excretion, no absorption delay, no distinction between muscle compartments) — a back-of-envelope simulator, not a validated pharmacokinetic tool.

How to run it

Open index.html directly in any modern browser. It needs an internet connection to fetch the Chart.js CDN script; no local server or install step required.

Notable details

  • All state is in-memory only — refreshing the page resets to the default example scenario; nothing is saved or persisted.
  • The washout metric only triggers if the final level is meaningfully above baseline; otherwise it shows a placeholder.
  • Frequency logic counts from each dosing period's own start day, not from a real calendar week.
  • Overlapping dosing periods on the same day are additive.

On this page