maxmind

A blazing-fast Node.js library for IP geolocation lookups against MaxMind's binary GeoIP2/GeoLite2 (MMDB) databases.

Library
npm
v5.0.7
649stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
75/100Good
Development Activity72
Maintenance72
Community76
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
81/100Excellent
Architecture78
Code Quality80
Innovation85
Learning Curve80

maxmind is a TypeScript-first Node.js library for performing IP geolocation lookups against MaxMind’s binary MMDB database format (GeoIP2 and GeoLite2). It reads the .mmdb file directly rather than converting it to CSV or another intermediate format, which keeps lookups fast and memory-efficient — the project claims lookups up to 17,000% faster than comparable libraries that rely on format conversions.

The library exposes both an async open() API for loading databases from disk and a synchronous Reader class for cases where the database buffer is already available (e.g. fetched over the network or read manually). It fully supports IPv4 and IPv6 lookups through the same API, ships with an in-memory LRU cache for repeated lookups, and can optionally watch the database file on disk and hot-reload it when MaxMind publishes updates — useful for long-running services that need fresh geolocation data without a restart.

What You Get

  • Async open() and sync Reader APIs for loading MMDB databases from disk or a buffer
  • Typed response interfaces for CityResponse, CountryResponse, AsnResponse, IspResponse, ConnectionTypeResponse, DomainResponse, and AnonymousIPResponse
  • Built-in IPv4/IPv6 validation helpers via maxmind.validate()
  • An in-memory LRU cache (via tiny-lru) to speed up repeated lookups
  • Optional watchForUpdates support to hot-reload the database file when it changes on disk

Common Use Cases

  • Geo-targeting or content localization based on a visitor’s IP address
  • Fraud detection and risk scoring using ASN/ISP/anonymous-IP data
  • Analytics pipelines that enrich request logs with country/city-level location data
  • Access control or compliance systems that need to restrict or flag requests by geography

Under The Hood

Architecture — The library is thin by design: src/index.ts orchestrates file reads (src/fs.ts, a promisified wrapper around Node’s fs), gzip-file detection (src/is-gzip.ts) to reject mis-supplied files, and IP parsing/validation (src/ip.ts, with manual IPv4/IPv6 octet parsing), while delegating the actual MMDB binary decoding to the companion mmdb-lib package (re-exported as Reader/Response). For files over 512MB it switches from fs.readFile to a manual streaming buffer-fill (readLargeFile) to work around Node’s ~2GB readFileSync limit. The optional watchForUpdates mode uses fs.watchFile polling plus an existence-retry loop to survive atomic file swaps, then calls reader.load() to hot-swap the in-memory database and clears the LRU cache.

Tech Stack — Written almost entirely in TypeScript (95% of the codebase), with just two runtime dependencies: mmdb-lib (an environment-agnostic MMDB binary decoder by the same maintainer) and tiny-lru (the LRU cache). Dev tooling includes Jest with @swc/jest for fast TS test transpilation, Prettier for formatting, and semantic-release for automated npm publishing; a leftover tslint.json sits alongside the modern tsconfig.json as a dual-tooling relic. Targets Node >=12.

Code Quality — The test suite spans four files (614 lines total): unit tests for index (open/watch/cache behavior), ip (IPv4/IPv6 parsing and validation), is-gzip (magic-byte detection), plus an integration test that runs real lookups against a bundled GeoIP2-City-Test.mmdb.gz fixture, alongside deliberately broken and legacy-format fixtures for error-path coverage. The README claims 100% test coverage. Code is small and mostly pure functions with clear naming, though the hand-rolled IPv6 parser in ip.ts duplicates functionality Node’s built-in net module partially covers, which is a modest maintenance/edge-case risk.

API Design — The public surface is minimal and idiomatic: a single open() async factory, a Reader class for synchronous use, and typed generics (Reader<T extends Response>) so consumers get compile-time-typed lookup results per MaxMind response type. Getting started takes one line (const lookup = await maxmind.open(...)), and the README clearly documents sync vs. async usage, IPv6 support, and the browser-incompatibility caveat (pointing to the companion mmdb-lib for browser use). A dedicated legacy-API error message helps v1/v2 users migrate safely across breaking changes.

Used by 8 apps in this directory

TypeScript
61%
EPL-2.0

Huly Platform

Project Management · Team Chat · Collaboration

27,384

Open-source all-in-one workspace that replaces Linear, Jira, Slack, and Notion for product and engineering teams.

View details
90
Repo Health
86
Technical
64
Dependency
Built with
TypeScript61%
Svelte34%
Updated 1 weeks ago
TypeScript
93%
Apache 2.0

Openship

Devops · Hosting Control Panel

11,078

Openship is an open-source, self-hostable deployment platform that points at a repo and builds, ships, routes, and TLS-terminates the app — driven from a desktop app, web dashboard, or CLI.

View details
82
Repo Health
85
Technical
65
Dependency
Built with
TypeScript93%
Updated today
TypeScript
99%
AGPL 3.0

Pangolin

Networking

22,378

An open-source, identity-based zero-trust remote access platform built on WireGuard — a self-hostable alternative to Cloudflare Tunnel and Twingate with SSO, OIDC, and tunneled reverse proxying.

View details
87
Repo Health
68
Technical
72
Dependency
Built with
TypeScript99%
Updated today
TypeScript
90%
AGPL 3.0

PeerTube

Social Media

15,270

A federated, ActivityPub-based video hosting platform built by Framasoft — self-hostable instances interconnect into a network with no vendor lock-in, P2P-assisted streaming, and no ads.

View details
97
Repo Health
75
Technical
71
Dependency
Built with
TypeScript90%
Updated yesterday
TypeScript
97%
AGPL 3.0

Swetrix

Analytics

1,123

Privacy-first, cookieless web analytics with error tracking, session replays, and performance monitoring — self-host or use Cloud.

View details
87
Repo Health
71
Technical
71
Dependency
Built with
TypeScript97%
Updated yesterday
TypeScript
98%
Apache 2.0

Tianji

Analytics · Monitoring

3,080

Replace Google Analytics, UptimeKuma, and Prometheus with one self-hosted platform that tracks websites, monitors uptime, and reports server health.

View details
84
Repo Health
76
Technical
66
Dependency
Built with
TypeScript98%
Updated 2 days ago
TypeScript
97%
MIT

Umami

Analytics

38,246

Privacy-first web analytics that respects your users — self-hosted, cookieless, and GDPR compliant out of the box.

View details
95
Repo Health
83
Technical
73
Dependency
Built with
TypeScript97%
Updated yesterday
TypeScript
95%
GPL 3.0

Wire

Team Chat · Video Conferencing · Collaboration

1,190

Open source end-to-end encrypted messaging for teams and enterprises — self-host for complete control over your communications and data.

View details
93
Repo Health
8
Technical
74
Dependency
Built with
TypeScript95%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search