Skip to content

cup113/BMI-Calculator

Repository files navigation

BMI Calculator

GitHub last commit Version Svelte TypeScript Tailwind CSS Netlify Status

A privacy-first, client-side BMI calculator that classifies a person's Body Mass Index against multiple authoritative standards (WHO, China Ministry of Health/Education), adapting to the person's life stage and locale.

BMI 计算器 —— 分龄分性别、多标准评估的健康体重指数计算器,纯前端无数据上传。

Features

  • Multi-standard classification — 5 authoritative standards across 3 life stages (Student / Adult / Senior)
  • Age- and gender-specific — gender-differentiated thresholds for student & child standards; grade-aware for Chinese students
  • Visual gauge — semicircle gauge with animated needle, color-coded segments, and zoom-to-level for precision reading
  • Healthy weight range — derived normal weight range for your height, displayed in your chosen unit
  • Dual-unit weight input — kg / 斤 (jin) for zh locale, kg / lb for en locale, with real-time conversion
  • i18n — English and Chinese (Simplified) with inlang/paraglide
  • Privacy-first — all computation is client-side; no data is collected, stored, or transmitted

Standards

Category Locale Standard Levels Authority
Student zh China Student 4 (underweight / normal / overweight / obese) Ministry of Education, 2014 Revision
Student en WHO Child (5–19y) 5 (severe thinness / thinness / normal / overweight / obese) WHO Growth Reference
Adult zh China Adult 4 (underweight / normal / overweight / obese) WS/T 428-2013
Adult en WHO Adult 6 (underweight / normal / pre-obesity / obese class I / II / III) WHO BMI Classification
Senior both China Elderly 3 (underweight / normal / overweight–obese) WS/T 428-2013

Each standard faithfully reflects its source document — level counts and thresholds are not normalized across standards.

Tech Stack

Layer Choice
Framework Svelte 5 (Runes — $state, $derived, $effect)
Styling Tailwind CSS v4
Language TypeScript 5
Testing Vitest + Testing Library
i18n inlang/paraglide-js
Adapter @sveltejs/adapter-static
Package manager pnpm

Getting Started

git clone https://github.com/cup113/BMI-Calculator.git
cd BMI-Calculator
pnpm install
pnpm dev          # start dev server at http://localhost:5173
pnpm build        # production build → build/
pnpm test         # run tests
pnpm check        # type-check with svelte-check

Test

pnpm test          # vitest run
pnpm test:watch    # vitest watch mode
pnpm coverage      # run with coverage report

Data Sources

  • China Student StandardNational Student Physical Fitness Standard (2014 Revision), Ministry of Education
  • China Adult & Elderly StandardsWS/T 428-2013: Criteria of Weight for Adults, National Health Commission
  • WHO Adult StandardWHO BMI Classification, World Health Organization
  • WHO Child StandardWHO Growth Reference (5–19 years), World Health Organization

Privacy

This website does not collect, store, or transmit any personal information. All BMI calculations are performed locally in your browser.

Deployment

pnpm build

Static files are output to the build/ directory, ready for deployment to GitHub Pages, Vercel, Netlify, or any static host.

License

Apache-2.0

About

基于 Svelte 5 的分龄 BMI 计算器,支持男女差异化评估与体重阈值可视化

Topics

Resources

License

Stars

Watchers

Forks

Contributors