Geolocation, Geolocation, Geolocation

July 23, 2026

My initial plans for this blog were to describe the technical details on setting up this site itself but I discovered that I am actually more interested in the process of building the site than actually building it. The why, rather than the how. An artist’s journal of ideas perhaps? Not that I would go so far as to call myself an artist. That said, I think it is useful to describe some of the “technical how”, even if it is simply for looking back afterwards when I have forgotten how I led myself into some alley of thought late at night and want to explore that again.

At a time when I probably should have been in bed I was looking around various sites for some inspiration or ideas I could follow and came across Bureau Cool’s site and quite liked their geolocation visualisation of where recent visitors to the site were from. Thinking, this looks like a quick project I can play around with and get something interesting working.

So I wrote an API endpoint that for now just grabs the IP address of a visitor and returns it inside a JSON object. This worked OK on my dev setup but not when I pushed the code to the server. This was because my current Astro/Nginx setup is set to be static only meaning that the site is very fast but nothing processes server-side code and you would get a 404 error if you tried the endpoint.

To fix this I created a Node service on my server that runs persistently (although I haven’t tried rebooting yet) and handles requests that match the path of the endpoint. Nginx is clever in that you can set up different paths to be handled by different processes without anyone noticing any difference.

Doing this was quite a dry task of editing config files and restarting services only to realise that I had been pointing things to the wrong place and needed to do it again only to find I had broken something else. I spent a fair bit of time on it and the end result looks something like this:

{
    "ip": "123.45.6.78"
}

Inspiring stuff, maybe not, but something to work with and it meant I could head off to bed safely without wondering why this that and the other wasn’t working.

As I posted this I realised that I had broken more links last night…