offline

Serendipity Drive or Autopilot? Whatever, I made an app.

AI

Of course this was made with Cursor and Claude Code (or better Codex 5.3 when the model came out). Like every aging web dev I wanted that feeling again - to actually finish something in the thin slice of time between the day job, where decision fatigue kicks in earlier and earlier, and whenever I finally revive from it.

So love online maps, I love location data and I already built myself an app similar to Atlas Obscura and Roadside America.

Of course I have no clue about the complicated mathematics that makes the world go round so to speak. But much smarter people figured that out already, so I could use the many libraries for PHP and JavaScript that deal with geo spatial data. Also there is the wonderful and superior OpenStreetMap that I contribute to here and there and that runs so many other apps and businesses, as well as Leaflet to create the infinite canvas to add the map tiles and plot POIs.

Discovery is the thing that drives me. The ghost in the machine that sends you somewhere you didn't plan to go, ideally not to a corpse like Randonautica managedto do once. Geocaching was fun for a while too, until they decided penny-pinchers like me weren't worth the bandwidth.

What's that app?

I always wanted a navigation app for the car, that sends me onto side streets I usually would not take. It's one thing to select POIs and set the GPS to avoid highways, but getting rerouted just in time before you've already passed the turn is the actual idea.

So as a preface: there is no sane commercial product for "surprise my commute a little", since even boring navigation occasionally sends people into lakes. I will never publish this thing. It's dangerous enough with one user.

With that in mind I prompted a greenfield navigation app. As a working title I had Autopilot in my mind, the AI called the concept “Serendipity Drive” and praised me for this really cool idea. 🤨

It made a plan and within 30 minutes I had an installable PWA with vector maps and routing as Proof of Concept.

I couldn't believe how something I would need two weeks for — read the docs for Overpass and Valhalla, learn how to query these services, and wire it all to the cartographic bits (aka "all the JavaScript") — was generated in half an hour.

Of course I pretended to check the code, but seriously, it worked! What more do I want from a one shot app? Yeah what more do I want?

I wanted

Quick detour (literally and figuratively)

This is a cool short docu about mapping a private run town in the US.

I mapped Google's only secret City
I mapped Google's only secret City

What it runs on

For the map I used MapLibre, which was new to me. My usual choice is Leaflet, but for something that redraws constantly while you're moving, vector tiles are smoother and MapLibre handles them well. Not too bad.

The interesting part is Overpass, which is the query interface for OpenStreetMap. You ask it for viewpoints, roadside attractions, or whatever odd category of place within a radius, and it returns what it has. The syntax is its own thing and the queries can be slow, but it's the right tool here since OpenStreetMap has the kind of location data that makes discovery worthwhile — the stuff that doesn't show up in Google Maps because nobody paid to add it.

Routing goes through Valhalla, an open-source routing engine. I needed something that recalculates on the fly without calling a corporate API every time the app decides to reroute me toward an abandoned warehouse. The discovery loop runs periodically while driving slow enough, grabs what's nearby from Overpass, picks something based on a weighted score, and asks Valhalla to build a route through it. The serendipity slider just adjusts those weights — left and it routes normally, right and you end up somewhere you did not plan.

Debugging without driving

Driving is a bad debugger. How do you check that the recommendation/routing is working as expected? So there is a simulation mode — fake GPS moving along a route, adjustable speed, the whole thing runs in the browser without going anywhere. I let that built earlier than I should have, but it saved me a lot of time later.

The session logs ended up being more work than expected. You can export them as JSON and open them in a separate log viewer to replay what the discovery pipeline decided and why. Honestly I enjoyed seeing that part built more than the routing.

One more technical detail

Overpass and Valhalla are external services, and browsers care about where requests come from. So there are two small PHP relays handling that, with some rate limiting thrown in. No build step, no bundler — just JavaScript files and a web server. I don't want to come back to this in a year and find something broken because a package changed.

So, the tool is entertaining, rough around the edges, and unfit for strangers. Wrong turn geometry + distracted human: not good. So I'll keep it offline.

And as always, the last 20% takes as long as the initial 80%.

Marcus Obst
Güterweg 89b
09474 Crottendorf
Germany

+49 37344 133407
info@marcus-obst.de