DEV Community

Sambhav Tawar
Sambhav Tawar

Posted on

Why I Built Nutrition-Calculator.net: From a Single Subway Tool to a Multi-Restaurant Platform

A year ago, I built a Subway nutrition calculator as a side project. It started as a personal itch: Subway’s PDF nutrition charts were fine for looking up one item, but useless for building a custom sandwich and seeing how it fit into a daily calorie.

So, I collected the data, structured it into a JSON-like object, and wrote a single-page tool that let people add bread, proteins, cheeses, vegetables, sauces, and sides, and watch the numbers update in real time.

That little tool worked. Perhaps too well.

Within months, the messages started arriving. Not bug reports, not feature requests for the Subway tool itself, but a steady stream of variations on the same question:

“Can you do this for Chipotle?”
“What about McDonald’s?”
“I use your Subway calculator every day please add Taco Bell.”

Users were not just asking for more restaurants. They were telling me that the problem I had solved for Subway the friction of manually adding up nutrition across a customizable order was universal.

Every chain with a build-your-own menu, every franchise with a PDF buried somewhere on their site, presented the same obstacle. People wanted one place where they could build their actual meal, not just look up a static item.

I resisted for a while. Each restaurant is its own data project: different menu categories, different customization rules, different sources of truth.

But the messages kept coming, and the pattern became impossible to ignore. The Subway tool was never the product. The product was the calculator pattern itself, and users were asking me to apply it everywhere.

What Nutrition-Calculator.net Actually Does

The site is a hub of restaurant-specific nutrition calculators built around a single interaction model. You pick a restaurant, then build your meal item by item.

The interface lets you choose items and quantities from each menu category, including sauces and extras, and the nutrition totals update as you go.

You see the full label calories, fats, cholesterol, sodium, carbs, fiber, sugars, protein, with % Daily Values not just a calorie number. And you can set a daily calorie target to see how much of it your meal uses up.

Behind that simple flow is a data architecture that has to handle the same complexity I first encountered with Subway: a menu is not a flat list of items.

It is a set of categories, each with its own rules about quantities, sizes, and combinations. A footlong doubles the bread and the protein but not necessarily the veggies. A sauce has a “normal” and a “light” version.

A salad has a base but different toppings than a sandwich. The calculator has to respect all of that without making the user think about it.

How I Built It (and What I Reused from the Subway Project)

The Subway tool taught me three lessons that became the foundation of the multi-restaurant site.

First, data is the hard part, not the code. For Subway alone, I ended up with over 200+ items across breads, proteins, cheeses, vegetables, condiments, sides, salads, wraps, and desserts, each with 15+ nutrition fields.

Every restaurant requires the same treatment: pull the official nutrition documentation, cross-reference it against the live menu and third-party sources, and standardize everything into a consistent schema. There is no shortcut. The calculator is only as trustworthy as the numbers underneath it.

Second, state management is where the real engineering lives

A restaurant order is a multi-dimensional selection: bread, size, proteins with quantities, cheeses, vegetables, sauces, seasonings, sides.

The Subway version used a quantity-based selection object, and the multi-restaurant version generalizes that pattern. Each restaurant gets its own menu data and its own selection schema, but the core calculation engines the part that walks the selection, applies quantity multipliers, handles size differences, and sums the nutrition—is shared.

Third, the UI has to stay out of the way

The Subway calculator was deliberately a single HTML file with inline JavaScript and scoped CSS, designed to avoid conflicts and load fast.

That philosophy carried over. The restaurant calculators on Nutrition-Calculator.net are built to be quick to use and easy to read, not to show off. People are often standing in line or deciding what to order on their phone. The tool has to work in that moment.

The Challenges Nobody Warns You About

Building one calculator is a project. Building a platform of calculators is a maintenance commitment.

Menus change, seasonal items appear and disappear, a protein gets reformulated, a sauce is discontinued, a new bread launches. Every restaurant is a living dataset, and the calculators have to be updated when the source data changes. I learned to treat data freshness as a first-class feature, not an afterthought.

Customization rules are inconsistent across brands. One chain might let you add extra cheese in half-ounce increments; another treats cheese as a binary yes/no. One menu might have “six-inch” and “footlong” as size modifiers; another uses “regular” and “large.” The calculation engine has to be flexible enough to encode these differences without becoming a pile of special cases.

And then there is the trust problem. Nutrition data is not always clean, and some values are estimated. The Subway project taught me to be transparent about data provenance to show where the numbers come from and to cross-reference rather than relying on a single PDF. That principle applies across every restaurant on the site.

What’s Next

The site currently covers a growing list of restaurants, and the roadmap is driven by the same force that started it: user requests. Every message asking for a new chain is a signal about where the calculator pattern is most needed. The long-term goal is not to build every restaurant calculator in existence, but to make the platform extensible enough that adding a new restaurant is a data task, not a rewrite.

The Subway tool was never meant to become a platform. It became one because users saw the same problem everywhere they ate. Nutrition-Calculator.net is my attempt to answer that demand one restaurant, one menu category, one customized order at a time.

Top comments (0)