GeoJS gets a 2018 overhaul

2018 was a massive year for GeoJS. The API has grown from getting just 28,000 hits a day to 13,000,00+. Thats over a 400% increase in 12 months! In October alone GeoJS served 164,600,338 requests. I never thought it would get this big.

Last year GeoJS was lucky to be sponsored by two separate companies, DigitalOcean (referral link) and DNS Spy . Suffice to say things wouldn’t be where they are without them! So, a big thanks to DigitalOcean for providing VMs to the project and DNS Spy for continually monitoring the DNS infrastructure.

There is a lot to cover in this post, feel free to skip to the middle if you just want to read about the new release or read on below for some traffic stats and the new website.

Traffic Stats

Everyone loves numbers so we’ll kick off with those. In January GeoJS averaged between 20,000 to 30,000 requests a day. 12 months later on the 31st of December the API served a staggering 11,354,570 requests with the biggest day of the year (also in December) serving 13,022,613. Things really started to heat up towards the end.

Closing off the year GeoJS ran on 4 servers located in Australia, Singapore, Amsterdam and the United States. With the addition of Singapore (Thanks DigitalOcean!) the API now has a global response time of under 500ms.

Timing from the GeoJS status page as of today

Throughout 2018 majority of the traffic was served from the United States server which wasn’t a surprise. Half way through November some big European websites started using GeoJS which resulted in 80% of daily traffic shifting over to Amsterdam. Today Amsterdam alone served over 23,000,000 requests.

Looking through some of the referrer logs as the year went past I was excited to see that AnandTech used the API to handle GDPR compliance. They’ve since moved on to some other method, but it was a nice traffic boost in May/June.

GeoLite2 Upgrade

For those that don’t know GeoJS uses data provided by MaxMind in the form of their GeoLite databases to provide API results. January last year however, these databases were discontinued so to continue providing accurate data I needed to shift to the GeoLite2 format.

I originally opened the issue to migrate in February last year so I was already a month behind on upgrading. Finally on the 17th of October (Yes, I know this blog post is a bit late) I closed it and released GeoJS v1.2.0 with full support of GeoLite2, 9 months after the original databases were discontinued.

Since I built GeoJS on top of Openresty migrating was easier than I expected thanks to this lua library by anjia0532 . I had to redo most of my location blocks to use the new util code I wrote but after that it was smooth sailing.

In this release I also redid the root path of the API (get.geojs.io ) to contain a basic plain text overview of the IP you’re requesting from. The below example is for GitLab’s IP which is hosted on the Google Cloud:

IP: 35.231.145.151
Country: United States (US)
City: Virginia
Timezone: America/New_York
Org: Google LLC (AS15169)

---
Docs and more on our website https://geojs.io/

This new release also splits out several fields for the geo endpoint so ASN and organization are now separate fields for easier parsing.

GeoLite2 should contain a whole bunch more accurate data and lots more results in general, especially for IPv6. As I said above, this release has been in the works for a while so its really nice to finally release it for everyone to see.

New website

It was time for a website redesign along with some content reorganisation. I wanted to remove as much JS, external scripts, fonts and other heavy items as I could to make it light weight and responsive. Having recently redesigned this blog using the Bulma framework it seemed like a natural choice.

Old GeoJS homepage

Above is the old homepage. It was pretty heavy and had a really poor mobile experience. Whilst it did look nice on desktop, I struggled to format content on the docs pages and couldn’t get many of the features it was designed for working with my content.

New GeoJS homepage

Above, the new homepage. It comes in at a tiny 215KB and the only external scripts are for Simple Analytics . The documentation pages have been redone and each endpoint now has its own page . Removing all of the JS ended up being really easy as it was theme specific. The only bit I didn’t think I could remove was getting the latest blog post for GeoJS but thanks to the power of Hugo I now pull it in at build time .

Coupled with the redesign the website has moved from the naked domain (geojs.io) to www after Netlify announced IPv6 support . A pretty harmless change but hopefully something that will make a difference for everyone.

2019 and onward

I’m not sure what 2019 will bring GeoJS. Hopefully more traffic! I’d like to look at moving the service to sit behind Cloudflare bringing it closer to everyone. Maybe I’ll get around to building the Telegram integration . If you use GeoJS or are itching for a new feature please get in touch .