ipaddr.js

A dependency-free JavaScript library for parsing, validating, and manipulating IPv4 and IPv6 addresses.

Library
npm
v2.5.0
662 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
57 /100 Fair
Development Activity 52
Maintenance 20
Community 76
Maturity 60
Momentum 20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
80 /100 Excellent
Architecture 80
Code Quality 82
Innovation 74
Learning Curve 85

ipaddr.js is a small, dependency-free library for working with IPv4 and IPv6 addresses in JavaScript, running equally well in Node.js and the browser. It parses and validates addresses, matches them against CIDR ranges, classifies them into named ranges such as loopback, private, and reserved, and converts freely between string, byte-array, and IPv4/IPv6 representations.

With over 100 million weekly downloads it is one of the most widely relied-upon networking primitives in the JavaScript ecosystem, used under the hood by Express, proxies, and countless server frameworks to interpret client addresses and enforce trusted-network rules.

What You Get

  • Safe validation helpers (isValid, isValidCIDR) that never throw, plus strict parse functions for both IPv4 and IPv6
  • CIDR-aware parsing and matching via parseCIDR and match, including network and broadcast address derivation
  • Built-in range classification (loopback, private, linkLocal, multicast, reserved, carrierGradeNat, and more) through range() and subnetMatch
  • Conversion between string, byte-array, and normalized/RFC 5952 forms, plus IPv4-mapped IPv6 handling via process()
  • Bundled TypeScript declarations and zero runtime dependencies for use in Node.js or the browser

Common Use Cases

  • Validating and normalizing user- or client-supplied IP addresses in web servers and APIs
  • Enforcing allow/deny lists by matching request addresses against trusted CIDR ranges
  • Resolving real client IPv4 addresses from IPv4-mapped IPv6 connections on dual-stack sockets
  • Classifying addresses as private, loopback, or public to drive security and routing decisions

Under The Hood

Architecture - The entire library lives in a single UMD module, lib/ipaddr.js (~1,100 lines), wrapped in an IIFE that exports to CommonJS, AMD, or a browser global. It defines two peer classes, IPv4 and IPv6, each carrying static factory/validation methods (parse, isValid, parseCIDR, broadcastAddressFromCIDR) and instance methods (match, range, toByteArray, toString). A shared matchCIDR helper drives all subnet comparisons at the byte level, while regular expressions precompiled at module load (fourOctet, native, transitional) recognise the many legal notations before parsing normalizes them into fixed octet or part arrays.

Tech Stack - Pure JavaScript targeting Node.js 10+ with no runtime dependencies. It ships CommonJS (“type”: “commonjs”) with a hand-written TypeScript declaration file (lib/ipaddr.d.ts). Tooling is minimal: ESLint 10 for linting and the built-in node —test runner with experimental coverage for tests; there is no build step, bundler, or transpiler since the source is published as-is.

Code Quality - The code is disciplined and well-factored: strict mode throughout, const/let, small single-purpose functions, and named range tables kept as declarative data rather than branching logic. Errors are surfaced by throwing on invalid parse input while validation entry points stay non-throwing. Test coverage is thorough - test/ipaddr.test.js is roughly 41 KB, comparable in size to the source itself, exercising parsing edge cases, CIDR math, range classification, and the exotic inet_aton notations.

API Design - The public surface is small, symmetric, and highly ergonomic: the same verbs (parse, isValid, match, range, toString) appear on the global namespace and on both address classes, so knowledge transfers directly between IPv4 and IPv6. parseCIDR returns a tuple that plugs straight into match, minimising boilerplate. The README is extensive with per-method examples, and bundled type declarations give first-class editor support, keeping the learning curve gentle for anyone who has worked with IP addresses before.

Used by 35 apps in this directory

TypeScript
96%
MIT

Payload CMS

Blogging · CMS · Developer Tools

45,458

The open-source, Next.js-native headless CMS that lives inside your /app folder and gives you a full TypeScript backend instantly.

View details
92
Repo Health
88
Technical
65
Dependency
Built with
TypeScript 96%
Updated 6 days ago
TypeScript
91%
AGPL 3.0

PeerTube

Social Media

15,362

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
96
Repo Health
75
Technical
66
Dependency
Built with
TypeScript 91%
Updated 2 weeks ago
TypeScript
50%
Other

Phase Console

Devops · Security

931

End-to-end encrypted secrets management for engineering teams — from local dev to Kubernetes production.

View details
85
Repo Health
73
Technical
63
Dependency
Built with
TypeScript 50%
Python 48%
Updated 1 weeks ago
Python
55%
Other

PostHog

Ab Testing Experimentation · Analytics · Developer Tools

40,397

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
65
Dependency
Built with
Python 55%
TypeScript 36%
Updated 6 days ago
JavaScript
86%
AGPL 3.0

SillyTavern

AI Assistants

34,869

The power-user LLM frontend that unifies dozens of AI backends with a rich scripting engine, immersive Visual Novel mode, and a thriving extension ecosystem.

View details
88
Repo Health
71
Technical
63
Dependency
Built with
JavaScript 86%
Updated 4 weeks ago
TypeScript
54%
MIT

Superagent

AI Agents · Security

6,771

An open-source SDK that blocks prompt injections, redacts PII and secrets, scans repositories for AI-targeted attacks, and red-teams production agents.

View details
66
Repo Health
66
Technical
74
Dependency
Built with
TypeScript 54%
Python 43%
Updated 2 months ago
Python
68%
AGPL 3.0

Tracecat

AI Agents · Automation · Security

3,860

Open-source agentic security automation platform that runs AI agents and durable workflows at scale with sandboxed execution.

View details
89
Repo Health
88
Technical
66
Dependency
Built with
Python 68%
TypeScript 30%
Updated 6 days ago
TypeScript
99%
MIT

Umami

Analytics

39,609

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
67
Dependency
Built with
TypeScript 99%
Updated 1 weeks ago

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