[HN Gopher] Show HN: Workout Tracker - self-hosted, single binar...
       ___________________________________________________________________
        
       Show HN: Workout Tracker - self-hosted, single binary web
       application
        
       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.
        
       Author : jovdg
       Score  : 125 points
       Date   : 2024-02-29 13:45 UTC (9 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | shantnutiwari wrote:
       | nice. How do you track teh distance (walked or running?)
        
         | abound wrote:
         | 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...
        
         | jovdg wrote:
         | 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)
        
       | abound wrote:
       | 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
        
         | juiiiced wrote:
         | How many things do you self host and how do you manage them
         | all?
        
       | vimeh wrote:
       | 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
        
         | jovdg wrote:
         | 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.
        
       | xnx wrote:
       | 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.
        
         | ramon156 wrote:
         | Hole in the market? Maybe a NAS-type system for self host?
         | Something a bit stronger than a raspberry
        
           | panzagl wrote:
           | Synology NASes are a popular choice.
        
           | xnx wrote:
           | 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.
        
           | jollyllama wrote:
           | They tried this with a device called Helm Personal Server.
           | No, not the Kubernetes manager.
        
             | KomoD wrote:
             | Not surprised it failed, $250-400 + $100/year and the only
             | thing it could do was host email, calendar and file
             | sharing?
        
           | KomoD wrote:
           | 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.
        
         | giobox wrote:
         | 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.
        
         | VyseofArcadia wrote:
         | 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?
        
           | jovdg wrote:
           | I can access it from any of my devices (laptops, desktop,
           | phone), and my family can use it too.
        
           | xnx wrote:
           | 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.
        
             | filleduchaos wrote:
             | > 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.)
        
         | mnutt wrote:
         | 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.
        
       | agilob wrote:
       | Alternative https://github.com/aceberg/ExerciseDiary
        
       | abusaidm wrote:
       | 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.
        
         | turtlebits wrote:
         | 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).
        
           | ggpsv wrote:
           | 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!
        
       | tamimio wrote:
       | Looks good!! On time for the coming spring!
        
       | mattegan wrote:
       | 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!
        
         | doakes wrote:
         | I'm interested in your Python script!
        
         | jovdg wrote:
         | Would you mind cleaning up your script and open-sourcing it? It
         | could be a sort of external component to many such projects...
        
       | lapetitejort wrote:
       | 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.
        
         | salad-tycoon wrote:
         | 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.
        
         | drBonkers wrote:
         | Can I see your paper template?
         | 
         | What if you want to graph tonnage?
        
         | zhivota wrote:
         | 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.
        
       | nose-wuzzy-pad wrote:
       | Looks great!
       | 
       | Any chance you plan for it to work with .fit files?
       | 
       | Thanks for making this!
        
         | jovdg wrote:
         | 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.
        
           | jovdg wrote:
           | https://github.com/jovandeginste/workout-tracker/pull/5
        
       | Osiris wrote:
       | 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.
        
         | wredue wrote:
         | 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.
        
           | dominick-cc wrote:
           | For lifting, check out Gymstro. Free and very good. I
           | recently switched over from FitNotes (also free and good, but
           | quirky).
        
             | switchers wrote:
             | I was about to recommend fitnotes but if you've swapped
             | then I've got something to check out...
        
           | InitialLastName wrote:
           | 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/
        
             | wredue wrote:
             | 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.
        
         | jovdg wrote:
         | Yes, GPX based workouts. Did you look at FitoTrack?
        
       | wly_cdgr wrote:
       | 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!
        
       | freedomben wrote:
       | 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/
        
         | jovdg wrote:
         | Check out FitoTrack
        
       | Otek wrote:
       | 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
        
         | klaushardt wrote:
         | HealthFit can export Workouts as .gpx or .fit files.
        
       | eitally wrote:
       | 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.
        
       ___________________________________________________________________
       (page generated 2024-02-29 23:00 UTC)