DEV Community

Cover image for I Built a Bowl Builder Tool for Nawtch, and the Save Button Was Harder Than It Sounds
Dallas
Dallas

Posted on

I Built a Bowl Builder Tool for Nawtch, and the Save Button Was Harder Than It Sounds

Wanted a tool anyone could use to build a meal-prep style bowl or plate and get real calorie and macro numbers back, with weight adjustments in ounces or grams depending on what you actually use. If you're a Nawtch user, cool, you can add the finished bowl straight into your foods. But if you just landed on the page because you wanted to test out a few combinations, you don't need to be a Nawtch user at all. You can still save bowls locally and come back later to edit them or build more. It's meant to be useful to anybody, not just people already tracking in Nawtch.

So, I created a Bowl Builder in Nawtch a while back and wanted to write about a decision that took longer to get right than I expected.

Two ways to save, and why they had to be different

When you finish a bowl you've got two options. You can hit "Add to Foods," which flattens everything into a single food entry with combined totals, same as any manually added food. Or you can hit "Save Bowl," which keeps every individual component intact so you can come back later and actually edit it.

At first I figured one save path would cover it. Then I actually thought about what happens if someone builds a bowl, logs it a few times over a couple weeks, then decides they want less rice in it going forward.

If a saved bowl and a food entry are the same underlying thing, editing the bowl to use less rice would retroactively change every day you already logged that meal. That's wrong. If I logged 520 calories on Tuesday, it needs to still say 520 calories next month even if I change the recipe today.

So a saved Bowl and a Food entry created from it had to be two genuinely separate things in the data model, not two views of the same object. Once you hit "Add to Foods," that's a permanent snapshot. Editing the original bowl afterward, or resaving it, never touches food entries you already created from it. If you edit a bowl and hit "Add to Foods" again, you get a brand new entry, not an update to the old one.

This isn't a new idea for the app either. Nawtch already does this same thing with daily calorie targets. If you log a day and hit your range, and then later change your target range in settings, that historical day still shows whether you hit the range that was active back then, not your current one. Bowl Builder just needed the same principle applied to a new feature.

Where does this thing even live

Small thing but it took real back and forth to settle. Nawtch has a Tools section and a first draft of the Bowl Builder spec argued it should be its own top level page instead, mostly because it connects back into the food tracking data and the existing Tools page was described as "stuff with no connection to your tracking data."

I went with Tools anyway. Tools is whatever I decide it means, and "standalone thing you can use on its own, that also happens to plug into the rest of the app if you want it to" is a perfectly fine definition. Scorekeeper (a simple tool for tracking players' scores for most types of games) set the precedent of Tools being a real category, not a junk drawer, and Bowl Builder fits there fine.

Keeping it local, same as everything else

Same deal as the rest of Nawtch. No account, nothing sent anywhere. Bowls live in your browser's IndexedDB same as your food logs and weight history. If you clear your browser data it's gone, same tradeoff as everything else in the app.

What's next

Probably a similar pattern for a grocery cost planning tool I'm working on now. Different problem (planning what you'll spend on groceries this week versus what you'd spend if you just bought everything fresh), but the same core question of what needs to be a permanent snapshot versus what stays editable.

If you want to actually mess with it: Bowl Builder, no signup needed.

Top comments (0)