Dogfood calculator


My partner and I got a dog! We’re loving her. It’s been a few weeks of ups and downs as we figure out how to house train it, but it’s getting better every day. As Poppy grows, she also eats a lot - and it increases as the weeks go by. We’ve been feeding her a diet of 50% kibble and 50% raw dog food. The math is straightforward - until she grows into the next category of age or weight.

I got bored one weekend and decided to whip up a simple calculator that, given her current age and weight, would tell us how much food to give her each time we feed her. Some AI-assisted coding and manual data entry for the feeding tables later, and here we have it: https://dogfood.jonniesweb.workers.dev.

The main feature I was looking for was the ability to use linear interpolation to determine the exact amount of food to give her for any weight or age, not just the broad ranges that the food packaging explains. For example, if she’s 7 lbs, then she needs more food than the 5 lb category and less than the 10 lb category - approximately 40% of the way through that 5-10 lb bracket.

Another necessary feature was converting the kibble food amount from cups to grams to make it easy to portion out both kibble and raw food at the same time with a kitchen scale. Hardcoding the equivalent of 1 cup of kibble to grams solved that.

Making the UX look nice and convenient to use is even simpler when the AI is building it. Saving the last values used for age and weight, as well as a cool spinning Poppy head background, makes it fun to use.

Most of the time was spent figuring out how to deploy this thing. Apparently Cloudflare Pages is deprecated and Cloudflare Workers now support deploying static content. Hours later and it should be running forever and for free. Code is here if anyone wants to check it out: https://github.com/jonniesweb/dogfood

This app has already come in handy several times. A few hours over the weekend well spent.