Wappler SC Extension: GeoIP-Lite

This is a second quick extension I have made for use in my ongoing project. This extension implements the GeoIP-Lite NPM package, which allows you to lookup an IP address in the Maxmind database and get back an output with information on said IP. The MaxMind database is free to use for the data displayed in this extension.

Example Output:

range: [ 3479298048, 3479300095 ] // [ <low bound of IP block>, <high bound of IP block> ]
country: 'US' // // Up to 3 alphanumeric variable length characters as ISO 3166-2 code
region: 'TX' // For US states this is the 2 letter state, for the United Kingdom this could be ENG as a country like “England". FIPS 10-4 subcountry code.
eu: '0 '// 1 if the country is a member state of the European Union, 0 otherwise.
timezone: 'America/Chicago' // Timezone from IANA Time Zone Database
city: 'San Antonio' // This is the full city name
ll: [ 29.4969, -98.4032 ] // The latitude and longitude of the city
metro: 641 // Metro code
area: 1000 // The approximate accuracy radius (km), around the latitude and longitude


Step 1. Install the extension

This extension can be installed via NPM. You can follow the steps here.

Step 2: update the Maxmind datafiles

This extension uses GeoIP-Lite, which does not include the latest database from MaxMind due to the MaxMind license. This is easy, and a license key is free.

Step 1. Click here, and click "Sig up for GeoLite2". Create an account. Once logged in, click "Manage License Keys" from the sidebar (alternatively, click here to go directly to the page). Click the big Generate new license key button, and you'll get a license key.

Step 2. Open up the terminal on your system in your Wappler projects root directory. Then run cd node_modules/geoip-lite && npm run-script updatedb license_key=YOUR_LICENSE_KEY to update the data files. (Replace YOUR_LICENSE_KEY with your license key obtained from maxmind.com)

NOTE that this requires a lot of RAM. It is known to fail on on a Digital Ocean or AWS micro instance. There are no plans to change this. geoip-lite stores all data in RAM in order to be fast.


Depending on your setup will depend how you can get a users IP. In most cases, $_SERVER.REMOTE_ADDR will return it, but that could change depending on if you are using Cloudflare or a loadbalancer.

Keep in mind this extension isn't going to return anything when you run it locally, because you'll just be looking up "localhost" or "::1". If you want to test the extension, you can do so by just inserting your own IP statically in the IP box.

You should update the database files every so often. IP's move around.

Github repo if you wish to either submit a PR or install it manually can be found here.