I sometimes like to write random toy apps just to relax. It’s like a meditation. I rarely finish those apps, but I enjoy the problem-solving aspect without having to worry about deadlines, peers, or stakeholders.
I like to try some silly ideas and I’m happy to accept failure. It’s just experimentation.
I feel too stupid and too old to learn any real stuff. It’s too late, and I probably never had any chance.
But it’s about the journey for me, baby steps, not where I can get.
Recently, I started another one, called “Hero’s Path.”
It’s a location-tracking app where I’d be able to store my location history. Google Maps has this kind of functionality, but they’re moving it out of web-based Google Maps, probably due to privacy concerns.
I had it enabled for many years now, and I sometimes enjoy looking back at my life’s literal path: where I’ve been on a given day, far back in time.
I trust the big G with my location history. I trust they won’t use it for anything bad. On the other hand, it would be nice to self-host this data, as it’s actually a bit sensitive.
There are or were other apps that used to do this, but neither seemed cool enough.
I use Google Takeout to extract my data from G, so it would be nice to be able to import this data into a private system, something I could self-host.
For my toy apps, I always like to try new tech or new approaches. That makes the “success” of every app unlikely, due to slow progress, but I focus here on learning new stuff, not on feature completeness.
The app would show a map with points and lines, so a classic server-side app is a no-go. We have to go with a full client-side browser app that communicates with the server using API calls.
I briefly looked at React, but it seemed too complicated for me. I like the simplicity of JavaScript, but the toolchain and generally tooling around JS are just too difficult. And maybe a bit boring.
So I looked again at Rust and Wasm, and it seems cool. I’ve been able to build a minimal boilerplate skeleton that shows the map in a few hours, which is pretty cool. It seems that Leaflet is a super-cool client-side mapping library; it worked out of the box. Currently, it’s fetched from a CDN, but later I will probably try to bundle the code in the app.
On the server side, I use Clojure. It’s not as functional as Haskell; it’s not referentially transparent or a “pure functional” language, but the Lisp syntax is just so nice to write, so responsive and clear. I recently tried Go, Rust, Haskell, and Clojure on the server side, and Clojure so far wins. It’s very dynamic, so maybe it will become more unstructured over time, but for now, assertions and precondition checks and occasional unit tests work for me.
I use simple Ring with Compojure on the server side, and the project is based on Leiningen. There are new cool alternatives, but for now, I’ll stick with the easy and proven stuff. The hot-reload in Ring works great for me. The JVM under Clojure feels very snappy, not like the “enterprise-class” stuff at work.
On the DB side, I again choose PostgreSQL. It just works and scales pretty well in its own class. In theory, there’s CockroachDB, but I don’t think I’d ever get into the scale class it would need. Even then, my use cases should be easily shardable, so I’d scale by sharding the DB, possibly with some trivial replication for redundancy. No need to roll out heavy stuff.
So far, the progress is: I’m able to call the API from the client, using the Gloo library. I have error handling on the Rust side, which is nice. The requests and responses are (de)serialized using Serde. The .wasm file is not too large yet, so it’s good. DOM manipulation is cumbersome for now, but maybe I’ll look into some macro-based helper library for that.
The next steps would be to implement the basic account management process: account creation, login. Then I’d look into how to import the data taken out from G.
It’s fun, and I’m not bored of it yet.