https://github.com/sefinek/geoip2-api
πΊ This module allows obtaining the client's geolocation using their IP address, leveraging data retrieved from a fast API.
https://github.com/sefinek/geoip2-api
api geoip geoip-api geoip-data geoip-location geoip-lookup geoip-wrapper ip-api
Last synced: 20 days ago
JSON representation
πΊ This module allows obtaining the client's geolocation using their IP address, leveraging data retrieved from a fast API.
- Host: GitHub
- URL: https://github.com/sefinek/geoip2-api
- Owner: sefinek
- License: mit
- Created: 2023-10-06T09:30:27.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-03T17:06:43.000Z (26 days ago)
- Last Synced: 2025-04-06T03:28:19.573Z (24 days ago)
- Topics: api, geoip, geoip-api, geoip-data, geoip-location, geoip-lookup, geoip-wrapper, ip-api
- Language: JavaScript
- Homepage: https://npmjs.com/package/geoip2-api
- Size: 177 KB
- Stars: 3
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## π Information
This documentation covers a lightweight Node.js module designed for interacting with a geolocation data API.
The module enables efficient retrieval of location details for specific IP addresses, utilizing native modules for optimal performance.> We utilize the [MaxMind database](https://www.maxmind.com) via the [geoip-lite2](https://github.com/sefinek/geoip-lite2) module for [our API](https://api.sefinek.net/docs/v2).
## π» Locally
There is an alternative to this module that allows for local geolocation retrieval based on a specific IP address.
However, this will increase the memory usage because the alternative module stores the MaxMind database in RAM.> [geoip-lite2 on npm](https://www.npmjs.com/package/geoip-lite2)
## π₯ Installation
```bash
npm install geoip2-api
```## π Example
```js
const geoIp = require('geoip2-api');(async () => {
const data = await geoIp.get('185.21.84.216');
console.log(data);
});
```## β¨ Output
> GET https://api.sefinek.net/api/v2/geoip/185.21.84.216```json
{
"success": true,
"status": 200,
"ip": "185.21.84.216",
"data": {
"range": [3105182720, 3105183743],
"country": "PL",
"region": "30",
"eu": "1",
"timezone": "Europe/Warsaw",
"city": "PiΕa",
"ll": [53.1492, 16.7461],
"metro": 0,
"area": 20
},
"type": "unicast"
}
```## π API Tip
If you want to get the client's geolocation, instead of providing an IP, use `/api/v2/geoip/myip`.## π Support
For any questions or issues related to the script, please visit the [GitHub repository](https://github.com/sefinek/geoip2-api) for the latest updates and support.If you like this module, please **star** β the repository.
## π MIT License
This GeoIP API client script is provided under the MIT License. See the [LICENSE](LICENSE) file for more details.Copyright 2023-2024 Β© by [Sefinek](https://sefinek.net). All Rights Reserved.