Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Workout Tracker – self-hosted, single binary web application (github.com/jovandeginste)
263 points by jovdg on Feb 29, 2024 | hide | past | favorite | 97 comments
I tried some web tools to track my workouts (specifically, running); some (like FitTrackee) came close, but I always found annoyances. So I decided to build my own. Specifically geared towards distance-based workouts, such as walking, running or cycling.



I came into the github not expecting to like this, but you've done a great job so far! I currently use a combination of Garmin Connect (track on watch & head unit), Intervals.icu (for fitness/freshness and more obvious tracking of performance improvement over time via various power & HR metrics), Strava (for segment and route performance change over time, and of course the social aspect... and routing), Komoot (only for cycling routing), and Elevate for Strava (just testing now, but it looks like a crappier version of intervals.icu so far), and Smashrun for running-only tracking. Oh, and Veloviewer for cycling-only performance/history and route visualizations.

It's a lot.

The problem is that there isn't a single place where you can get both the holistic metrics and the plan in a way that most users will want (which almost mandates a Strava interface). Apps like Veloviewer or Elevate already have this, but both either fall very short functionally or specifically only target a subset of features.

When I complete a run or ride, the first thing is to check Garmin to see how it related to, or impacted, my physiological health metrics, since I rely on Garmin for things like sleep quality, training readiness, and load tracking. Then to Strava to see how it went compared the previous times on the route and look at segments, or perhaps to give kudos to someone I was with. Then to intervals.icu to dig into the performance metrics (power, HR).

Intervals.icu is great because it handles workout planning, too, but the one big thing it's missing is routes & segments for IRL activities. Veloviewer has this, but it is missing all of the training/planning/fitness features. Imho, the killer app in the space is going to be whoever is able to augment the planning/tracking pieces, which are largely grunt work to develop, with the social bits that Strava has. The existential risk for indy devs is that your product is just a feature for Strava, and you could easily become disintermediated (or they shut down or charge exorbitant rates for API access -- it's already highly rate limited).

You're doing great work, but I'll keep paying for intervals.icu, Strava & Veloviewer for now because they all do slightly different things, even if there's significant overlap.


Piggybacking on the top comment to mention Gadgetbridge[1] A FOSS, cloudless replacement for the proprietary android apps of the fitness trackers. It can export the data as .gpx files which seems to be format used by Workout Tracker as well.

Those who want to use fitness trackers but are put off by trade off with privacy, Gadgetbridge and self-hosted applications like Workout Tracker are great alternatives.

[1] https://codeberg.org/Freeyourgadget/Gadgetbridge


I just can't get past the Intervals design. Wanted to like it but it's an absolute cluster for me.


I use a similar mix but with runanalyze.com


I exercises like a fiend yet your slavish adherence to logging and scrutinizing these numbers sounds exhausting in comparison. Are you a world class athlete trying to shave .02 seconds off a 10K? If not, try just going outside for a jog or mountain bike with some friends and go home and relax once. I bet your biometrics end up the same, if not better, and you don't even need to check.


I wonder how the accurate the biometrics even are on things like smarth watches ?


Many (even recreational) athletes use accurate measurements (heart rate chest bands, power meters integrated into bike cranks, ... continuous glucose monitors).


Sure they use them, but almost definitely for infinitely small marginal benefit... Despite what the manufacturers of those products want you to believe.


They are used to measure performance, not to enhance it, so there is no performance benefit. But if the athletes want to have that information, who are we to judge them? I just use Strava with GPS (no HR monitor, no powermeter or anything else) and I am pretty sure the stats keep me engaged and I would be doing less physical activities without them. If it works like this for someone using their powermeter, why not?


It's fun to watch numbers go up. No-one thinks that watching numbers go up makes them go up faster. (It probably makes them go up slower in the long run (lol), by encouraging short-term thinking and planning.)


That's pretty condescending. For some people the data is not just a means to an end. Its an end itself.


Sweet! Would love to host this myself and get rid of my Strava subscription.

I wrote a Python script that iterates through all of my activities there and downloads the `.gpx` for each - I could share the code if interested! Not sure how you'd integrate it into your app - maybe a "import from Strava" page could handle the Strava API auth?

I also love this idea of self-hosting some web apps (especially if they're containerized). I setup a `util.` subdomain and have started putting a few things there at different root directories. It's fun!


Would you mind cleaning up your script and open-sourcing it? It could be a sort of external component to many such projects...


I'm interested in your Python script!


I love the minor movement toward self-hosted web apps. I wish they were easy enough to setup as installing an app on Android or iPhone.


While not as easy as an appstore, the modern Docker ecosystem IMO has made self hosting web apps at home super cheap/easy.

Use your old PC, a Raspberry Pi, an EC2 instance, whatever you like, a single small Docker Compose file with Watchtower for auto-updating the container image when new one published etc. I've got self-hosted services that have ran untouched for years this way at home from a handful of lines of YML. Docker Compose will also take care of restarting the service on reboot/powercut if thats a concern.

Given the ubiquity of container images, you can run largely any web application this way and the container image likely already exists - this project also has a Dockerfile and would run fine this way too.


Why would you use Docker at all? Just run the application behind a reverse proxy. Docker doesn't get you anything except an extra management headache and an abstraction that happily punches holes in your firewall.


App A requires a version 2 of whatever which conflicts with version 3 of whatever required by app B, and uses same port as app C and doesn’t like the smell of app D. Meanwhile app Z has to be compiled from source with a specific version of python and only installs on Tuesdays, buts it’s Wednesday if mercury is retrograde


It may help to view it primarily as a packaging system.


I mean...the entire reason docker exists? So that I don't have to understand and manage everyone else's (sometimes insane) build and deploy processes?


Easier to upgrade, no extra system deps to mess up, security because you're shelled into a private environment, isolated storage, network routing.


Because "installing" an "app" becomes as easy as

    docker run coolapp:latest


That was the promise of Sandstorm. "Easy to install" is important but sandboxing and data protection _even of the data you give the app itself_ is just as important. I really hope it or something like it succeeds someday.

Edit: this app would probably make for a great Sandstorm app.


Cloudron and YunoHost are Sandstorm alternatives that seem to have more traction.


Hole in the market? Maybe a NAS-type system for self host? Something a bit stronger than a raspberry


I do think there's a niche hole in the market for a cloud host that's as easy to use as the major app stores. Fiddling with hardware and network routing is way too technical.


Does PikaPods do what you're talking about? I use it for Actual and for Paperless and it's awesome.


This is basically what HOOBS markets. They've really fallen to the movement of open source though.

I think there's still a world in which you can buy an rPi with software preinstalled and updaters packaged without much effort though.

If that could take off, you could easily have this type of service. However, I think it falls apart because you need to govern the app store and that is expensive and difficult.


Synology NASes are a popular choice.


But their CPU is potato. They still sell versions with 512 mb ram


There's Umbrel which sells a device like that, or YunoHost + your own device

Umbrel is just plug-and-play with an app store, haven't personally tried it but looks very cool.


They tried this with a device called Helm Personal Server. No, not the Kubernetes manager.


Not surprised it failed, $250-400 + $100/year and the only thing it could do was host email, calendar and file sharing?


Some kind of an app store concept on a VPS that le's you just plug in these self hosted projects, like installing an Android app, is really interesting. I think docker is the closest thing we have but I could be wrong, and it's much too technical for any average person.

I've been slowly moving everything to self hosted to reduce the pain if/when I'm ever randomly banned from Google or some other huge network and can't get it re-enabled.

The downside is that I'm now my own IT department and need to perpetually monitor these things.


I think a good question to ask is, what is gained here by being a web app? Couldn't this just be an Android or iPhone (or even desktop!) app?


Web app = Always on. No interruption from power outages or wifi problems. Higher bandwidth and more anonymous (if it's going to make requests).

Virtual android device in the cloud might be a great model for it since Android has good built-in security and process isolation.


> Web app = Always on. No interruption from power outages or wifi problems

Web apps don't magically produce their own compute, power and networking. They still need to be run on something.

(Web app does not automatically equal SaaS, especially in this case that is explicitly billed as self-hosted.)


Unless you're self-hosting on the same computer you're using, a web app is, by definition, software as a service. But then, either you're just... running a program, or your self-hosted application lives somewhere else that still requires power and network connectivity.

I promise, everyone, it is very legal and very cool to just write applications that run without TCP roundtrips. I promise.


"Unless you're self-hosting on the same computer you're using, a web app is, by definition, software as a service"

This sentence makes no sense to me. "Self-hosting" and "software as a service" are diametrically opposed things.


> Unless you're self-hosting on the same computer you're using, a web app is, by definition, software as a service.

This seems extremely arbitrary and seems to assume some implicit definitions that are not common, and in fact are the opposite of what I've heard used.

IME software as a service generally speaking means somebody else is doing all the hosting and you as an end user just point your browser to it or in some cases install a local app (and often you put in your credit card and pay a monthly subscription). Self-hosting means you do all that hosting yourself. I've never seen something marketed as SaaS that expected you to host the server-side yourself, but I'd be happy to hear of an example.

> I promise, everyone, it is very legal and very cool to just write applications that run without TCP roundtrips. I promise.

That's a hell of a strawman against an argument I see nobody making.


Exactly. I want the reliability of professional hosting, the ease of a phone app install, and the ownership/control of open source.


Web apps are absolutely not always on, and they are absolutely not more anonymous...


I think it's pretty obvious from the context that GP is talking about a self-hosted web app on a VPS or cloud provider. It's a lot more "always on" than your smartphone, and the anonymity is the same.


AWS uptime is better than any server I've run at home, and an AWS IP is less personally identifiable than my home IP.


I still can't use it if my power or internet are out though, even if the server still has both.

(Rephrased to be less mean.)


My little tangent here is about trying to combine the benefits of open source apps that are fully under the users control with the benefits of cloud hosting while trying to avoid the configuration and administration headache of a raw AWS/Azure/Hetzner/Heroku/Digital Ocean/etc. setup.


I think this comment is unnecessarily rude


You're right. Thanks for calling me out on it. I've toned down the snark.


I can access it from any of my devices (laptops, desktop, phone), and my family can use it too.


Well that question implies that there is some intrinsic reason not to build it as a web app. That may be the case for you if you prefer Kotlin or Swift or something, but it wouldn't be the case for me.


There is a quote that informs my thinking on this.

"The most amazing achievement of the computer software industry is the continuing cancellation of the steady and staggering gains made by the computer hardware industry" -Henry Petroski

Efficiency is very important to me. (And in the era of climate change, it should be important to everyone.) I consider web apps to be about the least efficient form of software yet discovered. We suddenly need two relatively beefy computers with multi-GHz multi-core processors and GB of RAM, one of which must be powered on 24/7, to do something that could have been done on the hardware of the mid-80s.


This is a great looking project. The combo of single binary Go-lang and the ability to package assets like css, js and html makes this a killed multi platform distributable one click run.

It might be an interesting experiment to have the UI be installable as PWA and thereby not need the electron stack to achieve the common functionality offered by these apps.


This would a great candidate for https://wails.io/. I've been building a lot of utility desktop apps and the static binary is around 9mb (uses the system webview).


I'm also eyeing wails for a couple of personal desktop apps that I want to build soon. I built toy app first towards the end of last year to try it out and I was impressed. It felt like a nice middle ground between Electron and Tauri for desktop apps using a web front-end. Looking forward to the release of v3!


By "Workout" do mean only exercise that can be tracked via GPS (walking, running, cycling)?

It doesn't seem to track any indoor activities like weight lifting.


Yeah. I was also gleefully looking cause lifting trackers are universally garbage.

Diet trackers (Calorie Counters) are also almost universally a pain in the ass, but at least they’re tolerable.

There is not a single combined lifestyle experience that is any “good” IMO.


For lifting, check out Gymstro. Free and very good. I recently switched over from FitNotes (also free and good, but quirky).


I was about to recommend fitnotes but if you've swapped then I've got something to check out...


I've only been using it since I saw it recommended a few weeks ago, but for Hacker's Diet[RIP, 0]-style diet tracking MacroFactor has been unbeatable. Nothing dumb or meaninglessly social, just weight+nutrition tracking. In recognition that humans are imperfect and that both sides of CI/CO are more complicated than is apparent, they have built the system around a "best effort" vibe; systematic bias gets filtered out through feedback (if you regularly underestimate the calories you actually eat, the system will feed back by lowering your limits).

[0] https://www.fourmilab.ch/hackdiet/


CI/CO is what I used to lose weight (back to normal BMI as of today, actually).

I won’t lie and say it was “easy”. I had to make real changes, and some were not easy for me (cheese. Peanuts…). But after I bought a scale and weighed my portions, it was readily apparent what was wrong for me.

The other things most “experts” (who are trying to sell you their brand of dieting) will sell you about CICO not being “everything” is that some food are awkward. Like celery, which has 5 calories uncooked, 30 cooked.

Ultimately, as long as you are weighing your portions, those oddities should generally not be “breaking” a CICO diet.

I appreciate this other suggestion, for the app. I will check it out.


Congrats on your loss! I used the aforementioned Hacker's Diet (CI/CO with some habit-forming structure) a decade ago to get my BMI from ~33 to ~23 (at which point people started telling me I looked sick, so I backed off).

CI/CO definitely works, but both sides of the equation need to track a feedback loop in order to function correctly. On the one hand, your body will reduce its base metabolic rate as you start depriving it of nutrition; on the other, the nutrition labels on food aren't necessarily representative of what your body can get out of them.

The other issue is that often the foods people with weight issues eat aren't the same foods that are conducive to weight loss... it's psychologically very difficult to maintain a calorie deficit when many of those calories are taken up by sugar water, for example, where it's much easier when the calories come from nutritionally complete, fresh foods.

As usual, proactive lifestyle change is rarely about the facts of what should be done (literally everyone knows they should be eating vegetables and exercising) as much as the psychology (it's difficult to consistently make decisions that add stress to your life).


Very curious about what you dislike about lifting trackers.

I built a weightlifting tracker primarily for myself a little while ago and also published it. I tried to keep the UX as simple as possible. If you're ever looking to try out another app, give it a shot! https://titangymapp.com.


Titan looks similar to the workout app that I'm developing: EverBeat! I'm also developing it for myself right now, that's why it is Android only atm. My goal is to employ subtle gamification to get the user/me to the gym more often.

I was wondering where you got the data from to know what muscle group is used in each exercise?


Checkout Fitbod for lifting. It's pretty good!


Yes, GPX based workouts. Did you look at FitoTrack?



Yes; could have sworn they had weight lifting by default, but apparently not. They have other indoor activities, however. But elsewhere in the thread, people have suggested many options...


This is great! Am a fan of this kind of focused, self hosted application.

Clean UI, too. Interested to hear your thoughts on HTMX when you get around to eval-ing it


I did some evaluation of HTMX a few weeks ago; while I understand the appeal, it does not yet ... vibe with me. Also, the use for HTMX is still very limited in this project. I don't think this will really change, because the project is fairly focused and will remain so for the time being. Maybe there is an opportunity with the statistics and graphs? Like switch the buckets between km, miles, and number of those (1 km, 5 km, etc), of zoom to more years.


This looks truly excellent, nice work! I've been using RideWithGPS, which is a great tool, but doesn't scratch my "self-host everything, own my own data" itch, so I'll definitely be checking this out. I've built (and use daily) my own barebones workout tracker [1], but it's for non-distance-based workouts (i.e. rep-based stuff/lifts), so this compliments that nicely.

[1] https://github.com/bcspragu/stronk


How many things do you self host and how do you manage them all?


  $ kubectl get deployments.apps | wc -l
  25
Minus the header, looks like ~24. I use a single-node Kubernetes cluster running Talos [1]. Running a single-node cluster is kinda dumb architecturally, but adding a new service takes <10 minutes most of the time, which is nice. I've standardized on Cuelang [2] for my configs, so adding a new service is some DNS/Caddy config fiddling, then:

  deployment: <service>: spec: template: spec: {
   containers: [{
    ports: [...]
    command: [...]
    volumeMounts: [...]
   }]
   volumes: [...]
  }
And then running:

  cue export \
    --out yaml \
    --expression 'deployment.<service>' \
    --expression 'service.<service>' \
    kube.cue <service>/<service>.cue | kubectl apply -f -
Where `kube.cue` sets reasonable defaults (e.g. image is <local registry>/<service>). The "cluster" runs on a mini PC in my basement, and I have a small Digital Ocean VM with a static IP acting as an ingress (networking via Tailscale). Backups to cloud storage with restic, alerting/monitoring with Prometheus/Grafana, Caddy/Tailscale for local ingress.

[1] https://www.talos.dev/

[2] https://cuelang.org/


Interested in how you're using DO as an ingress. I currently run a droplet that's reaching its capacity because I'm running all the services directly on that underpowered machine. I would much rather run them from a local computer. Is it pretty straightforward to set that kind of thing up with tailscale?


Indeed! I use Headscale (though hosted Tailscale will work just fine), DO hosts the controlplane, and is also on the tailnet itself. My Caddy config has something like:

  <list of public hosts> {
    reverse_proxy 100.64.0.<mini PC>
  }
The mini PC IP is a Tailscale container in a pod with a second Caddy instance that routes within the cluster. For sensitive/personal services, they're only configured in the cluster-internal Caddy config, and thus only accessible over the tailnet.

One can optionally add other "hardening" at the DO layer, like Crowdsec, to minimize automated/malicious/bot traffic into your home.



This looks super neat and would be very useful. What apps/devices do people use to collec the GPX information? I found a few in the Play Store but they don't look very privacy respecting...

Edit: Currently eyeing GPSLogger: https://gpslogger.app/


If you have a Galaxy Watch you can export workout as GPX file through the Samsung Health app


Check out FitoTrack


Heck yeah, this is awesome.

Any chance of some kind of social features? I want to control my data, but I also do want to be able to share my fitness stats & journey with a specific self-selected group of people: friends, running club mates, etc

Thank you for making this!


Do you mean some kind of "share with Social" button? Or do you mean anonymous access to your recent activities?


I mean an integrated social feed for just your couple dozen hand-picked fitness friends, and ability to see each other's stats etc.


Anyone has good resources on importing such data from apple - I’m using Apple Watch but would love to visualize raw data myself with grafana


Sibling mentions HealthFit, and there's RunGap as well. I use RunGap simply because HealthFit doesn't do Garmin. With the exception of Garmin, either could be a good choice.


HealthFit can export Workouts as .gpx or .fit files.


Well done and congratulations on the launch! Looks incredible mate!


Looks great!

Any chance you plan for it to work with .fit files?

Thanks for making this!


Yes, as stated in the README... I would love to. There seem to be some libraries to parse the .fit file, so when I have more time, I'll take a look at that.



Looks good!! On time for the coming spring!


nice. How do you track teh distance (walked or running?)


Not sure exactly what you are asking about, so I'll be verbose :-)

I use an app called FitoTrack (also FOSS), which records my location while running. It stores my GPS position every few seconds. When I'm done, it auto-exports a GPX file to a folder on my phone, which is synced via syncthing. Then I (manually, for now) upload the file to my self-hosted workout tracker.

The GPX file contains some data per measurement point; this is the second point in some random GPX file:

      <trkpt lat="x" lon="y">
        <ele>56.72105575919558</ele>
        <extensions>
          <speed>1.8200000524520874</speed>
          <wstxns2:TrackPointExtension xmlns:wstxns2="gpxtxp"/>
        </extensions>
        <time>2024-02-28T09:28:26Z</time>
      </trkpt>
So it contains speed (average since previous point), elevation, location and time (offtopic: it took me a while to understand that this elevation is not the actual elevation above sea level; only yesterday I figured that out and fixed it in the code!).

The Go GPX library some of this information, and some extras (like max and min elevation, max speed, total up and down, etc. over the whole track). Then I perform some more calculations (like putting the points in buckets per km and per minute), and calculate the estimated location using a geocoder library.

Then, finally, to estimate the difference between walking, running, or cycling, I take the average speed and guesstimate from there. This may be wrong some times for some people, and could be improved on. Or maybe I should include an AI here? (just kidding)


Without diving in too deeply, it looks like they use a package called `gpxgo` [1], which has some code for calculating the moving distance of a given GPX file [2].

[1] https://github.com/tkrajina/gpxgo

[2] https://github.com/tkrajina/gpxgo/blob/5e7c336e94dac3583a07c...


Slightly off topic, but I got tired of looking for a good weight training tracker, so instead I bought a notebook and a pencil and I've been using it for nearly two years. If I want to change up how I long my workouts, I just write them in a different way. I've changed how I log number of sets/reps, weight per set, etc, a few times and I've never had to re-program how the info is displayed. I log how I feel after the workout and use that and the weight from last session to guide what I'll be doing in the current session. I don't need a graph as I can clearly see the values going up or stagnating. I honestly feel like the analog process has helped me keep consistent. It's motivated me to get more notebooks to track stuff like household chores. Sometimes the best app is a piece of paper.


I have a Google Keep note where I record the results from the last workout. I figured out I really only need that. I don't need history, I just need to know how long ago was the last workout, how much did I lift / time under tension, so I can make a decision about today's program.

I love fancy graphs for my endurance work but for lifting, I feel like this is pretty much all I really need.


In a similar vain but with history and progression, I have a Google Sheet where I track all my lifts. Its easy to spot when I should increase my lift. Maybe every 5-6 weeks I need to make a new sheet so it doesn't get too unruly.

eg. Exercise | SetsReps | Feb 26 | Mar 1

----------------------------------------------------------

Dumbbell Chest Press | 3 x 8 | 65, 8 8 8 | 70, 8 8 5

Dumbbell Chest Fly | 3 x 8 | 16, 8 8 8 | 20, 8 8 6

Exercise | Sets x Reps | Feb 28 | Mar 3

----------------------------------------------------------

Knee Jumps | 3 x 8 | BW, 8 8 8 | BW, 8 8 8

Pull-ups. | 3 x AMRAP | 4, 3, 2. | 3, 3, 2

KB Swings | 10M EMOM | (216) 10M | (2*16) F@7M

Bent DB Row | 3x8. | (swap cable row) 60, 8 8 8 | 40, 8 8 8


I bought the starting strength app, no subscription and has a couple of quality of life improvements like a timer, plate calculator, graphs etc and some actually helpful no nonsense videos and book excerpts. very little distractions.

Agree with you though, pen and paper is hard to beat and cheaper.


Can I see your paper template?

What if you want to graph tonnage?




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: