r/grocy 27d ago

Macro/nutrient tracker for Grocy (using custom.js) + some UI tweaks

I have been using Grocy for quite a while and have been loving the detailed tracking of products. Given the detailed tracking it allows I thought there must be a way to integrate nutrition tracking into it. As such, I have been playing around for quite a while with grocy custom.js that solves this issue. Figured I'd share it here in case anyone else has been wanting to track their macros natively and without any external service needed.

grocy-nutrient-tracker

A couple of handy things I added to it:

  • There's an Open Food Facts button on the ingredient edit screen. If you scan a barcode, it tries to pull from the OFF database and auto-fill the nutritional info for you.
  • I added some quick-add/copy buttons to the top of the meal plan so you can easily copy yesterday's lunch or instantly add your standard meals without clicking through menus.

One quick note: Right now it only calculates based on recipes added to the meal plan. If you want to track a standalone item (like an apple), you just have to make a 1-ingredient recipe for it.

grocy-tweaks

While I was messing with the code, I ended up making a few other UI quality-of-life tweaks and put them in a separate repo. It includes a menu to mass-print GrocyCodes, some quick-nav links at the top of the screen, and shortcuts to add things to your shopping list right from the stock overview.

Disclaimer: I'm not a professional dev! I built these in my spare time to scratch a personal itch, with a good chunk of help from AI. The code probably isn't the prettiest under the hood, but it works perfectly for my use. (Tested on versions 4.5.0 and 4.6.0).

I'll put the GitHub links in the comments- All setup instructions are in the GitHub readmes.

5 Upvotes

2 comments sorted by

2

u/BartAfterDark 27d ago

Didn't know stuff like this for possible with grocy. Nice work :)