Menu

1 / 2

How I Built a Free TDEE Calculator with Astro: Formulas, Performance, and SEO

DEV Community: astro·Free-TDEE-Calculator·5 days ago
#397dNFxC
#devtoastro#devto#dev#calculator#astro
Reading 0:00
15s threshold

I recently built Free TDEE Calculator , a set of fitness calculators (TDEE, BMR, macros, calorie deficit) with Astro, hosted on Cloudflare. Here is what actually mattered in the build.

Why Astro for a Calculator Site

Calculator pages are mostly static content with small islands of interactivity. Astro ships zero JavaScript by default, so the pages load fast and Google reads clean HTML. The interactive calculator inputs are tiny client-side scripts, not a framework runtime.

The Formula Layer

Every calculator on the site shares one formula module. The foundation is Mifflin-St Jeor for BMR:

function calculateBMR ( weightKg , heightCm , age , isMale ) { let bmr = ( 10 * weightKg ) + ( 6.25 * heightCm ) - ( 5 * age ); return isMale ? bmr + 5 : bmr - 161 ; }

const ACTIVITY = { sedentary : 1.2 , light : 1.375 , moderate : 1.55 , active : 1.725 , veryActive : 1.9 };

function calculateTDEE ( bmr , activityLevel ) { return Math . round ( bmr * ( ACTIVITY [ activityLevel ] ??…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.