NutriTrace: self-hosted nutrition and wellness tracker (AGPL, single Docker container)
from TraceApps@lemmy.world to selfhosted@lemmy.world on 27 Apr 22:27
https://lemmy.world/post/46142871

Hey all, sharing what I’ve been working on. NutriTrace is a self-hosted nutrition and wellness tracker that runs entirely on your own server in a single Docker container.

I built it because every commercial nutrition app has the same shape. You hand them years of food data, body measurements, and biometrics, and your data is held hostage when they pivot or paywall. I wanted to track macros and pull in my Fitbit data without participating in that.

Daily food diary with multi-ingredient meals, recipes, body stats, water tracking, day-level notes. Personal food database, barcode scanner, imports from Open Food Facts and USDA, plus optional Mealie integration. Statistics with trend charts, full backup, exports as CSV / JSON / full ZIP.

Optional wellness device sync from Fitbit, Withings, Garmin, and Android Health Connect. Sleep / readiness / stress scores computed from your data.

Optional AI assistant where you bring your own Claude / OpenAI / Gemini key. It queries your real data via tool use so it can answer things like “what was my average protein this month” without making numbers up. There’s a voice food logger too. Both fully optional, off by default.

Tech: Svelte 4 + Express + better-sqlite3, multi-stage Dockerfile, AGPL-3.0. Native Android app is in active development; PWA installs to home screen on any modern browser today.

Repo and docker-compose example: github.com/TraceApps/nutritrace

Happy to answer questions.

#selfhosted

threaded - newest

loanrangerofpeanuts@lemmy.world on 27 Apr 23:10 next collapse

This looks very interesting. I’ll have to load up the container and give it a try at some point in the future. Big fan of the mealie integration since I use that for all my recipes.

ProfessorScience@lemmy.world on 27 Apr 23:57 next collapse

Ooh, I’ll definitely give this a try.

muxika@piefed.muxika.org on 28 Apr 00:29 next collapse

This is perfect, thanks for sharing.

TraceApps@lemmy.world on 28 Apr 00:36 next collapse

Thanks all, really appreciate the kind words. Feedback is welcome on anything: bug reports, missing features, things that feel rough, or just “this works for my setup.” A few features are flagged Experimental right now and I’d like to harden them enough to drop the badge.

Native Android app is in active development. There’s also a sister project in the works called LiftTrace under the same TraceApps umbrella, same self-hosted Docker setup but for workout tracking (sets, reps, programs, PRs). Not public yet but close.

ProfessorScience@lemmy.world on 28 Apr 00:39 next collapse

Is the docker image public? I’m getting an “unauthorized” error when attempting to pull it. I’m not getting that error for other ghcr.io images. But I’m not docker expert, so I may be doing something wrong.

TraceApps@lemmy.world on 28 Apr 01:05 collapse

Is the docker image public? I’m getting an “unauthorized” error when attempting to pull it. I’m not getting that error for other ghcr.io images. But I’m not docker expert, so I may be doing something wrong.

Should be fixed now, package was set to private by default on first push. Just flipped it. docker pull ghcr.io/traceapps/nutritrace:latest works without auth now. Thanks for flagging it.

ProfessorScience@lemmy.world on 28 Apr 01:27 next collapse

Looks good, so I’ve got it up and running now. Thanks!

hoover900@ani.social on 28 Apr 14:42 collapse

What all did you do to get it working? I’m stuck with this issue.

ProfessorScience@lemmy.world on 28 Apr 14:46 collapse

All I had to do was run the pull command again.

ProfessorScience@lemmy.world on 28 Apr 14:28 collapse

I’m seeing “Could not reach server — retry” on the diary page and when going to enter foods. The diagnostics log has

[14:25:38.821] [ERROR] [diary] loadEntry error: _fetch@http://my.server:3000/assets/index-Dl7TTIk7.js:175:24686

[14:25:41.686] [WARN] [settings] direct push failed for startPage: Server responded 401
[14:25:41.689] [WARN] [settings] direct push failed for weightUnit: Server responded 401
[14:25:41.695] [WARN] [settings] direct push failed for heightUnit: Server responded 401
[14:25:41.699] [WARN] [settings] direct push failed for statsGoalLine: Server responded 401
[14:25:41.701] [WARN] [settings] direct push failed for lengthUnit: Server responded 401
[14:25:41.702] [WARN] [settings] direct push failed for distUnit: Server responded 401
[14:25:41.704] [WARN] [settings] direct push failed for statsYZero: Server responded 401
[14:25:41.705] [WARN] [settings] direct push failed for tempUnit: Server responded 401
[14:25:41.705] [WARN] [settings] direct push failed for usdaEnabled: Server responded 401
[14:25:41.706] [WARN] [settings] direct push failed for statsAvgLine: Server responded 401
[14:25:41.708] [WARN] [settings] direct push failed for offSearchCountry: Server responded 401
[14:25:41.708] [WARN] [settings] direct push failed for offUploadCountry: Server responded 401
[14:25:41.709] [WARN] [settings] direct push failed for offSearchLanguage: Server responded 401
[14:25:41.710] [WARN] [settings] direct push failed for statsTrendLine: Server responded 401
[14:25:41.710] [WARN] [settings] direct push failed for statsChartType: Server responded 401
curbstickle@anarchist.nexus on 28 Apr 00:52 next collapse

This is wonderful!

Going to set it up tomorrow and give it a go!

Tolookah@discuss.tchncs.de on 28 Apr 01:34 next collapse

On multi user: any thoughts on working with oidc/ldap or the like? I use authentik at home for many other services and it would be great to keep the single login.

List of different types of login types: integrations.goauthentik.io

TraceApps@lemmy.world on 28 Apr 02:45 collapse

Yes indeed! On my future to do!

StrawberryPigtails@discuss.tchncs.de on 28 Apr 02:40 next collapse

That sounds cool! Been looking for something like this for a while!

danielquinn@lemmy.ca on 28 Apr 06:20 next collapse

As this is a new project, have you considered hosting your code somewhere other than GitHub? Codeberg and GitLab are similarly user-friendly platforms without the many downsides of supporting Microsoft.

quick_snail@feddit.nl on 28 Apr 16:21 collapse

At least a mirror. GitHub is authwalled even for GET requests more and more these days

diminou@lemmy.zip on 28 Apr 06:30 next collapse

Is there a place where we could help with translation ?

I know a few people that would want an app like that but English is not their primary language and won’t bother checking it out at all without some kind of translation.

TraceApps@lemmy.world on 28 Apr 11:47 collapse

Is there a place where we could help with translation ?

I know a few people that would want an app like that but English is not their primary language and won’t bother checking it out at all without some kind of translation.

Great question, and not yet. NutriTrace is English-only right now, and the UI strings are hardcoded throughout the Svelte components. To accept translations I’d first need to wire up an i18n layer (svelte-i18n is the obvious pick) and extract strings to per-locale JSON files. Then translation contributions become straightforward via PRs or something like Weblate/Crowdin. I will add this to my roadmap. Any languages in particular we should prioritize?

Lemmert@reddthat.com on 28 Apr 13:15 next collapse

Personally I’m more than happy to cover the Dutch translation if you have the time to get translations working. Thanks for the project!

parson0@startrek.website on 28 Apr 15:19 collapse

Happy to help with German. I used to get the LoseIt premium for free but haven’t used it in many years. I just assume it’s a privacy nightmare so haven’t bothered opening it. But I like the concept, just tracking helped me improve my diet and health.

diminou@lemmy.zip on 28 Apr 14:24 next collapse

I’ll help with French if you go that far :-)

TraceApps@lemmy.world on 28 Apr 20:20 collapse

Thanks for the offers to help with translations. Wanted to share the plan.

I’m wiring up the translation infrastructure now: svelte-i18n with one JSON file per locale in the repo. The workflow once it’s ready is straightforward. There’ll be a single English source file at src/i18n/en.json, contributors copy it to their locale (fr.json, nl.json, de.json, etc.), translate the values, and open a pull request. Keys stay untouched, only values change.

Nothing to do right now. I’ll open a GitHub tracking issue once the source file is stable enough to translate against. A short contributor guide will land with it covering workflow and conventions.

One thing worth flagging early: for nutrition labels specifically, please plan to use the regulatory terms that appear on food packaging in your country rather than the literal English equivalents. So Glucides / Lipides / Protéines for French, Koolhydraten / Vetten / Eiwitten for Dutch, Eiweiß rather than Protein for German, and so on.

More soon.

TraceApps@lemmy.world on 29 Apr 02:57 collapse

Thanks for the offers to help with translations. Wanted to share the plan.

I’m wiring up the translation infrastructure now: svelte-i18n with one JSON file per locale in the repo. The workflow once it’s ready is straightforward. There’ll be a single English source file at src/i18n/en.json, contributors copy it to their locale (fr.json, nl.json, de.json, etc.), translate the values, and open a pull request. Keys stay untouched, only values change.

Nothing to do right now. I’ll open a GitHub tracking issue once the source file is stable enough to translate against. A short contributor guide will land with it covering workflow and conventions.

One thing worth flagging early: for nutrition labels specifically, please plan to use the regulatory terms that appear on food packaging in your country rather than the literal English equivalents. So Glucides / Lipides / Protéines for French, Koolhydraten / Vetten / Eiwitten for Dutch, Eiweiß rather than Protein for German, and so on.

More soon.

Quick update on this. Translation infrastructure is live as of v1.0.0-rc.6 (released today). The source file is src/i18n/en.json — about 210 keys covering navigation, page titles, the full auth flow, the onboarding wizard, primary actions in Diary / Foods / Goals / Profile, the AI assistant FAB, and common toasts. Server-side strings (email subjects, push notification bodies) are out of scope for now.

Full workflow is documented in CONTRIBUTING.md → Translations.

About 30% of the client-side surface is extracted in this batch — the screens every user touches every session. Wellness sync messages, deep Settings sub-section labels, and Statistics chart internals are the main gaps. If you hit a screen you use heavily that’s still English while translating, open an issue listing the screen and I’ll pull it forward in the next extraction batch.

Tag me on the PR when you’re ready.

pmtriste@lemmy.world on 28 Apr 07:32 next collapse

This sounds great. How does the device support work? What do you think of GadgetBridge support?

CosmicGiraffe@lemmy.world on 28 Apr 10:09 next collapse

What does the mealie integration enable? I assume it’s providing foods that can be logged, but can you also pull stuff from mealies meal planning section & populate it into the diary?

TraceApps@lemmy.world on 28 Apr 11:16 collapse

Mealie integration allows you to pull in your Meal/Recipe from your self hosted instance of Mealie via api. If you have nutrition facts set there by the recipes total weight, it will pull in that data and then you can set your serving size accordingly so it calculates properly. It also pulls in the recipe pic if set in Mealie.

Squizzy@lemmy.world on 28 Apr 10:27 next collapse

How well would this work internationally? More a question on the resources but does open food facts log international barcodes? I knowour stuff is way different to the same product stocked in the US.

TraceApps@lemmy.world on 28 Apr 11:14 collapse

Barcodes work internationally. i can confirm because i have used in both europe (italy) and africa (south africa). Only difference between nutrition facts i see is that the US uses Sodium and i want to say that at least Europe uses Salt. I have a built in conversion where when one is used the other is automatically calculated.

Squizzy@lemmy.world on 28 Apr 11:54 collapse

Brilliant, I could have worded that better. I assume a mars bar in europe and a mars bar in the US has different barcodes because they are made differently and I wasnt sure if the OpenFoodFacts was a US library but it appears to log barcodes and info globally.

Great idea, love it tackling the subscription creep of trackers

imetators@lemmy.dbzer0.com on 28 Apr 13:27 next collapse

Vibe coded, innit?

Dumhuvud@programming.dev on 28 Apr 14:45 collapse

Yeah, the first commit is 47k SLoC, and Claude is mentioned as a “co-author”.

TraceApps@lemmy.world on 28 Apr 18:30 collapse

Yes, vibe coded and proud of it. This is a labor of love that I genuinely don’t think I could have completed without Claude Code. The first commit is large because I was working out of a private dev repo and synced everything to the public repo just before the 1.0 RC release. Hope you give it a chance and that it suits your needs. Thanks!

USSEthernet@startrek.website on 28 Apr 13:33 next collapse

Just deployed the container. I’ll check it out.

irmadlad@lemmy.world on 28 Apr 14:25 next collapse

Great project. Looks like a lot of time went into it. I may give it a spin later on this evening. You included screenshots. Thank you for that.

clifmo@programming.dev on 28 Apr 14:31 next collapse

Sqlite only? Edit: confirmed. And it’s written in a way that it will likely only support sqlite in the near future

HumbleBragger@piefed.social on 28 Apr 15:03 next collapse

This seems awesome! Thanks for sharing

clifmo@programming.dev on 28 Apr 15:32 next collapse

Hey OP, I opened a PR to add an entry point supporting _FILE secret environment variables

TraceApps@lemmy.world on 28 Apr 18:27 collapse

PR tested and merged! Thank you!

quick_snail@feddit.nl on 28 Apr 16:20 next collapse

Hey, can you make a much simpler version of this? Just a static site of the USDA data?

The USDA nutrition site went down at some point during Trump’s term. and I was afraid that information was lost forever.

I wish we just had a simple way for folks to clone this website. Literally just that. It would be much simpler than what you’ve already done, and extremely useful.

Chaser@lemmy.zip on 29 Apr 00:52 collapse

Thanks for sharing! I’m so annoyed of Yazio, that I was close to start developing a simple calories tracker myself. Glad I can just use this instead.

You asked for feature ideas in a comment. How about OIDC support? My wife is good at forgetting (to add) her passwords (to a password manager). So instead of resetting password xyz each week, i installed pocketid and integrated it to every app I host, that supports OIDC.