From local storage To-do list to Fractal, Peer-to-Peer Habit Tracker (refrain)
Part 4: Building for a target that… doesn’t exist
(Start with part 1 , part 2 or part 3 for the earlier development story)
A lot has happened in the Holochain ecosystem since my last writings on this project. It has become less of a moving target for development since the initial Beta release candidate dropped in December 2022, leading us all the way to today’s most stable release (0.3.2).
That isn’t to say we’re without growing pains, but development (even… deployment!) on the platform is becoming much less fraught with blockages. Even the possibility of a mobile peer-to-peer version of my habit tracker has now started to appear on the horizon. Which is great, because I have spent most of the last year designing a new version of the app to run primarily on that target.
Tips for Holochain front-end devs who value sanity
I’d like to think I have learnt something about software in the last few years (wouldn’t we all…) so, in order to avoid ever rebuilding the UI from the scratch, I’ve made the front-end almost entirely Holochain agnostic. If you can mock out all of your zome calls in this way, you don’t even need a back-end and you can go home early (maybe?).
Here’s the new stack:
- GraphQL layer for fetching data, which resolves queries and mutations to my Holochain zome functions (p2p network calls) and delivers the payload back, all via a nicely typed/validated schema.
- React, GraphQL Codegen & Apollo Client for developer tools/ergonomics out the wazoo (I get automatic typed React hook generation whenever the schema is updated - meaning I actually forget I am using Holochain data types so long as I keep my schema in line).
- Jotai and a bit of React context for state-management. I just couldn’t justify Redux any more, especially given there is so much boiler-plate from the GraphQL layer already.
- Apollo Client and jotai-minidb are used to cache responses and create an indexed data store to rapidly retrieve extra details on my interactive data visualisations. Later I will use Apollo Client to add pagination of the JSON data such that the habit hierarchy can pre-load along multiple dimensions (key for a seamless experience).
- React Testing Library. I decided never again to try to make something this complex without some front-end testing. Ever!
- Deployment via Tauri: p2p Shipyard are bringing the Android mobile target into view via Tauri 2.0. Great! Although it’s not the easiest trying to target all the different Webview versions at once.
- Github Actions to automatically build for MacOS, Windows and Linux with every release, and to run my test suite with every push to my
develop
branch.
It still just a To-do list?
No, of course not. It’s a hierarchical data-viz you can tick o… yes - OK for the moment it’s still a To-do list.
But! The heavy lifting (dynamically generating JSON to power the visualizations from a load of Holochain entries) has largely been done. The next minor release will be adding back in the temporal dimension — the daily calendar — that I first got working in the proof of concept, so that it is actually a habit tracker again.
But it’s peer-to-peer?
It’s the personal version of the app (solo), but we have the *potential* for peers! By persisting all data by default on the local encrypted ledger (not the DHT) we allow a more local-first, privacy-first approach to your behavioral data.
The social dimension will be added, via a lobby, at a later date. In the lobby you’ll be able to share templates, share subsets of your personal data, import data shared by others into your own personal app (to mimic!), and create private accountability channels.
For now, we have reached what I call minimum viable dog-food.
Sounds… disgusting!
Sure, but it ought to be useful. I wanted to start dog-fooding as soon as I could in order to (a) get the delivery pipeline flowing and (b) help me iron out bugs, and test out the foundations that all the exciting p2p stuff will rely on for a good user experience.
Habit/Fract (that’s right, this project even has a name by this point) has a new home on the web, and I will be planning out a roadmap of the app’s future using the first early releases of the app on Holochain.
Now that I’ve suitably lowered your expectations, please feel free to join me! You can currently download a MacOS, Windows or Debian version to play around with here.