<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Surya challa</title>
    <description>The latest articles on DEV Community by Surya challa (@thebarbellcrew).</description>
    <link>https://dev.to/thebarbellcrew</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4245536%2F7c894f29-d879-452c-ad53-fd95891d7e4b.jpg</url>
      <title>DEV Community: Surya challa</title>
      <link>https://dev.to/thebarbellcrew</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/thebarbellcrew"/>
    <language>en</language>
    <item>
      <title>How I Built an Offline 5,020+ Indian Foods Nutrition &amp; Macro Engine in TypeScript (Zero API Keys)</title>
      <dc:creator>Surya challa</dc:creator>
      <pubDate>Sun, 15 Nov 2026 07:53:51 +0000</pubDate>
      <link>https://dev.to/thebarbellcrew/how-i-built-an-offline-5020-indian-foods-nutrition-macro-engine-in-typescript-zero-api-keys-3k0n</link>
      <guid>https://dev.to/thebarbellcrew/how-i-built-an-offline-5020-indian-foods-nutrition-macro-engine-in-typescript-zero-api-keys-3k0n</guid>
      <description>&lt;p&gt;If you have ever tried building a fitness tracker, AI diet coach, or calorie counter for Indian users, you run into the same wall on day one: &lt;strong&gt;global nutrition APIs fail miserably on Indian food.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;USDA FoodData Central has almost zero regional Indian dishes. Commercial APIs like Nutritionix or Edamam charge $50–$200/month with strict rate limits, mix raw dry weights with cooked hydrated weights, ignore &lt;em&gt;tadka&lt;/em&gt; (tempering oil/ghee) variations, and have no idea what a &lt;strong&gt;katori&lt;/strong&gt;, &lt;strong&gt;phulka&lt;/strong&gt;, or &lt;strong&gt;masala dosai&lt;/strong&gt; weighs in grams.&lt;/p&gt;

&lt;p&gt;While building the &lt;strong&gt;&lt;a href="https://www.thebarbellcrew.com/indian-food-calorie-calculator" rel="noopener noreferrer"&gt;Free Indian Food Calorie Calculator &amp;amp; Meal Macro Counter&lt;/a&gt;&lt;/strong&gt; at &lt;strong&gt;[TheBarbellCrew(&lt;a href="https://www.thebarbellcrew.com" rel="noopener noreferrer"&gt;https://www.thebarbellcrew.com&lt;/a&gt;)&lt;/strong&gt;, &lt;/p&gt;

&lt;p&gt;I decided to solve this properly and open-source both the TypeScript calculation engine and the underlying &lt;strong&gt;5,020-item dataset&lt;/strong&gt; under the MIT license.&lt;/p&gt;

&lt;p&gt;Here is how the data normalization, portion scaling, and zero-latency search engine work under the hood.&lt;/p&gt;




&lt;h2&gt;
  
  
  Live Demo, npm Package &amp;amp; Open Datasets
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live Web App (UI Demo):&lt;/strong&gt; &lt;a href="https://www.thebarbellcrew.com/indian-food-calorie-calculator" rel="noopener noreferrer"&gt;thebarbellcrew.com/indian-food-calorie-calculator&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/suryachalla/open-nutrition-engine" rel="noopener noreferrer"&gt;https://github.com/suryachalla/open-nutrition-engine&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;npm Package:&lt;/strong&gt; &lt;a href="https://www.npmjs.com/package/open-nutrition-engine" rel="noopener noreferrer"&gt;&lt;code&gt;npm install open-nutrition-engine&lt;/code&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Raw CSV &amp;amp; JSON Dataset (Kaggle 10.0):&lt;/strong&gt; &lt;a href="https://www.kaggle.com/datasets/thebarbellcrew/5000-indian-foods-nutrition-and-macro-dataset" rel="noopener noreferrer"&gt;5,000+ Indian Foods Nutrition &amp;amp; Macro Dataset&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Engineering Problem #1: Raw vs. Cooked Hydration &amp;amp; Tadka Lipids
&lt;/h2&gt;

&lt;p&gt;Why do two calorie apps show &lt;code&gt;120 kcal&lt;/code&gt; vs &lt;code&gt;340 kcal&lt;/code&gt; for the exact same bowl of &lt;em&gt;Moong Dal&lt;/em&gt;?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Dry vs. Cooked Weight Confusion:&lt;/strong&gt; &lt;code&gt;100g&lt;/code&gt; of dry raw moong dal is ~&lt;code&gt;348 kcal&lt;/code&gt;, whereas &lt;code&gt;100g&lt;/code&gt; of cooked hydrated dal is ~&lt;code&gt;105–115 kcal&lt;/code&gt; because cooked lentils absorb roughly &lt;code&gt;2.5x–3x&lt;/code&gt; their weight in water.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hidden Tempering (&lt;em&gt;Tadka&lt;/em&gt;) Fat:&lt;/strong&gt; Adding &lt;code&gt;1 tbsp&lt;/code&gt; (&lt;code&gt;14g&lt;/code&gt;) of ghee or oil in tempering adds &lt;code&gt;126 kcal&lt;/code&gt; of pure lipids across the pot.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Utensil Ambiguity:&lt;/strong&gt; Real users don't weigh every meal on a kitchen scale—they eat &lt;code&gt;3 steamed idlis&lt;/code&gt;, &lt;code&gt;1 katori sambar&lt;/code&gt;, &lt;code&gt;2 phulkas (no oil)&lt;/code&gt;, or &lt;code&gt;1 plate chicken biryani&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  How We Normalized 5,020 Foods
&lt;/h3&gt;

&lt;p&gt;Every single entry in our corpus was standardized to a strict &lt;strong&gt;per-100g edible portion baseline&lt;/strong&gt; (cross-referenced against ICMR-NIN Indian Food Composition Tables, USDA raw baselines, and Atwater &lt;code&gt;4-4-9&lt;/code&gt; calorie-macro validation), then paired with &lt;strong&gt;&lt;code&gt;13,772&lt;/code&gt; pre-calibrated household serving presets&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```json
{
  "id": "phulka",
  "name": "Phulka (No Oil / No Ghee)",
  "hindiName": "Roti / Phulka",
  "category": "grains",
  "diet": "veg",
  "calories": 260,
  "protein": 9.5,
  "carbs": 52,
  "fat": 1.5,
  "fiber": 7,
  "servings": [
    { "id": "1pc", "label": "1 phulka (30 g)", "amount": 30 },
    { "id": "2pc", "label": "2 phulkas (60 g)", "amount": 60 },
    { "id": "3pc", "label": "3 phulkas (90 g)", "amount": 90 }
  ]
}
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice also the &lt;code&gt;diet&lt;/code&gt; field (&lt;code&gt;2,136 veg&lt;/code&gt; and &lt;code&gt;2,884 non-veg&lt;/code&gt; items): in India, lacto-vegetarians strictly exclude eggs, so egg items (&lt;em&gt;Ubla Anda&lt;/em&gt;, &lt;em&gt;Egg Bhurji&lt;/em&gt;) are explicitly isolated from &lt;code&gt;veg&lt;/code&gt; filters.&lt;/p&gt;




&lt;h2&gt;
  
  
  Engineering Problem #2: Hinglish &amp;amp; Regional Alias Matching
&lt;/h2&gt;

&lt;p&gt;An Indian user searching for boiled eggs or soy protein might type:&lt;br&gt;
    * &lt;code&gt;"boiled egg"&lt;/code&gt; or &lt;code&gt;"ubla anda"&lt;/code&gt;&lt;br&gt;
    * &lt;code&gt;"soya chunks"&lt;/code&gt; or &lt;code&gt;"soya badi"&lt;/code&gt; or &lt;code&gt;"meal maker"&lt;/code&gt;&lt;br&gt;
    * &lt;code&gt;"curd"&lt;/code&gt; or &lt;code&gt;"dahi"&lt;/code&gt;&lt;br&gt;
    * &lt;code&gt;"पनीर टिक्का"&lt;/code&gt; (Devanagari) or &lt;code&gt;"paneer tikka"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To support instant client-side autocomplete without spinning up an external Elasticsearch cluster or paying per-request vector DB costs, &lt;code&gt;open-nutrition-engine&lt;/code&gt; ships with &lt;code&gt;2,311&lt;/code&gt; Hindi/regional names and &lt;code&gt;698&lt;/code&gt; colloquial aliases directly inside the typed bundle.&lt;/p&gt;


&lt;h2&gt;
  
  
  Quickstart: Using &lt;code&gt;open-nutrition-engine&lt;/code&gt; in TypeScript / React
&lt;/h2&gt;

&lt;p&gt;Install via npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install open-nutrition-engine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Search dishes, scale macros to household servings (&lt;code&gt;katori&lt;/code&gt;, &lt;code&gt;piece&lt;/code&gt;, &lt;code&gt;plate&lt;/code&gt;), and compute daily meal totals completely offline with zero API keys or rate limits:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;    &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;searchFoods&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;createFoodEntry&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;computeFoodTotals&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'open-nutrition-engine'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// 1. Search vegetarian high-protein staples (supports English &amp;amp; Hinglish)&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;searchFoods&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Paneer Tikka'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'all'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;diet&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'veg'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;dish&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`${dish.name}: ${dish.calories} kcal, ${dish.protein}g protein per 100g`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// 2. Log 2 servings into a meal slot ('breakfast' | 'lunch' | 'dinner' | 'snack')&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;lunchEntry&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createFoodEntry&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="n"&gt;dish&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;dish&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;servings&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// e.g., 100g or 1 piece/katori preset&lt;/span&gt;
      &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                &lt;span class="c1"&gt;// quantity&lt;/span&gt;
      &lt;span class="s1"&gt;'lunch'&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// 3. Aggregate full daily macros (kcal, protein, carbs, fat, fiber)&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;dailyTotals&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;computeFoodTotals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;lunchEntry&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Meal Totals:'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dailyTotals&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because the entire computation runs locally in memory:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Latency:&lt;/strong&gt; &lt;code&gt;&amp;lt; 2ms&lt;/code&gt; per search keystroke&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API Cost:&lt;/strong&gt; &lt;code&gt;$0.00&lt;/code&gt; whether you have 100 users or 1,000,000 users&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Offline-First:&lt;/strong&gt; Works natively inside PWAs, React Native apps, Electron tools, and LLM tool-calling / RAG agents&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Using the Raw Dataset for Python, RAG &amp;amp; Computer Vision
&lt;/h2&gt;

&lt;p&gt;If you are working in Python, Pandas, or building a WhatsApp/Telegram AI dietitian bot, we also published the flat UTF-8 table (&lt;code&gt;indian_foods_5000.csv&lt;/code&gt; with &lt;code&gt;0&lt;/code&gt; null nutrient rows) and the nested serving schema (&lt;code&gt;indian_foods_5000.json&lt;/code&gt;) on &lt;strong&gt;&lt;a href="https://www.kaggle.com/datasets/thebarbellcrew/5000-indian-foods-nutrition-and-macro-dataset" rel="noopener noreferrer"&gt;Kaggle&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You can combine this dataset with:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Vision-to-Macro Pipelines:&lt;/strong&gt; Pair a Food-101 / Indian dish classifier with &lt;code&gt;indian_foods_5000.json&lt;/code&gt; to convert plate photos into &lt;code&gt;katori&lt;/code&gt;/&lt;code&gt;piece&lt;/code&gt; gram macros.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linear Programming Diet Generators (&lt;code&gt;SciPy&lt;/code&gt; / &lt;code&gt;PuLP&lt;/code&gt;):&lt;/strong&gt; Generate &lt;code&gt;140g+&lt;/code&gt; daily protein Indian vegetarian meal plans constrained by a user's &lt;strong&gt;&lt;a href="https://www.thebarbellcrew.com/tdee-calculator" rel="noopener noreferrer"&gt;TDEE / Maintenance Calories&lt;/a&gt;&lt;/strong&gt; and fiber targets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Training &amp;amp; Strength Integration:&lt;/strong&gt; Pair daily nutrition logs with progressive overload tools like our &lt;strong&gt;&lt;a href="https://www.thebarbellcrew.com/exercise-101" rel="noopener noreferrer"&gt;3D Biomechanics &amp;amp; Exercise 101 Hub&lt;/a&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Try It Live &amp;amp; Feedback Welcome!
&lt;/h2&gt;

&lt;p&gt;If you want to test the search speed and portion scaling right in your browser, check out the live &lt;strong&gt;&lt;a href="https://www.thebarbellcrew.com/indian-food-calorie-calculator" rel="noopener noreferrer"&gt;Indian Food Calorie Calculator&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If there are regional dishes from your state (Kerala, Bengali, Maharashtrian, Northeast, Gujarati, Punjabi, Andhra/Tamil) that you want added or refined in the next release, drop a comment below or open a PR on &lt;a href="https://github.com/suryachalla/open-nutrition-engine" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>typescript</category>
      <category>javascript</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
