tldts

tldts: Fast Domain, Subdomain, and TLD Parsing for JS

Library
npm
v7.4.10
761stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
81/100Excellent
Development Activity96
Maintenance96
Community44
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture80
Code Quality82
Innovation76
Learning Curve78

tldts is a JavaScript/TypeScript library that extracts hostnames, domains, public suffixes, top-level domains, and subdomains from URLs or raw hostnames. It’s built specifically for performance — the project benchmarks itself against competing libraries like psl, tldjs, parse-domain, and tld-extract, and consistently leads on operations-per-second for getDomain-style parsing on real-world URL corpora.

Unlike naive suffix-splitting approaches, tldts uses a continuously updated copy of the public suffix list compiled into an efficient suffix trie, giving spec-correct results for tricky cases like multi-part suffixes (co.uk), private domains, IDNA/Unicode hostnames, IP address detection, and email address parsing. The monorepo splits functionality across tldts-core (shared parsing logic), tldts-icann/tldts (different public-suffix-list scopes), and tldts-experimental, so consumers can pick a bundle sized to their needs.

What You Get

  • parse() function returning domain, domainWithoutSuffix, hostname, subdomain, publicSuffix, isIcann, isPrivate, and isIp fields for any URL or hostname
  • A CLI (npx tldts <url>) for one-off or batched (stdin) domain parsing without writing any code
  • IPv4/IPv6 address detection built into the same parsing path as domain extraction
  • Full Unicode/IDNA support for internationalized domain names
  • Email address parsing support, extracting the domain portion of an email address the same way as a URL

Common Use Cases

  • Grouping or deduplicating analytics/log data by registrable domain instead of full hostname (e.g. mail.google.com and www.google.com both resolving to google.com)
  • Validating and normalizing user-submitted URLs or email addresses in a signup or content-moderation pipeline
  • Cookie and security tooling that needs correct public-suffix-aware domain boundaries (e.g. determining if a cookie can be set across co.uk subdomains)
  • Ad-tech and privacy tools (its author’s browser extension work) that need fast, spec-correct domain classification at scale

Under The Hood

Architecture The monorepo splits concerns cleanly: tldts-core/src/factory.ts builds a configurable parser factory that other packages instantiate with a specific public-suffix dataset, extract-hostname.ts/is-ip.ts/is-valid.ts handle input normalization and validation, and the top-level tldts package’s src/suffix-trie.ts (207 lines) compiles the public suffix list into a trie structure for O(suffix-length) lookups rather than linear list scanning. tldts-icann and tldts-experimental reuse the same tldts-core engine with different suffix datasets (ICANN-only vs. experimental/private suffixes). Tech Stack Pure TypeScript across all six packages, built with Rollup to ESM/CJS/UMD bundles per package, with a bin/ CLI entry point in the tldts package wrapping the same parse() function used programmatically; the project maintains its own benchmark harness (comparison/bench2) comparing throughput against competing libraries on every release. Code Quality tldts-tests is a dedicated package solely for cross-package test fixtures, and packages/tldts/test/ runs dedicated suites (tld.test.ts, publicsuffix.test.ts, special-use.test.ts) covering ICANN rules, private suffixes, and RFC 6761 special-use names (localhost, .test, .invalid, .onion, etc.); the repo’s active commit cadence and consistent dependency updates (via dependabot) reflect ongoing maintenance discipline. API Design The single parse() function with a flat result object (domain, subdomain, publicSuffix, isIcann, isPrivate, isIp) is easy to start with, and the bundled CLI mirrors the same shape for shell use without writing code; choosing between the tldts, tldts-icann, and tldts-experimental variants does require reading the docs to understand suffix-list scope trade-offs, but the default tldts package covers the common case out of the box.

Used by 20 apps in this directory

TypeScript
88%
Other

AFFiNE

Productivity · Project Management · Note Taking

71,668

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
68
Dependency
Built with
TypeScript88%
Updated today
TypeScript
75%
GPL 3.0

Bramble

Password Manager · Security · Authentication

315

Local-first, end-to-end encrypted password manager that syncs your vault directly between your own devices over a private peer-to-peer mesh — no server, no account, no cloud in the middle.

View details
73
Repo Health
84
Technical
72
Dependency
Built with
TypeScript75%
Updated today
TypeScript
55%
Other

Cap

Team Chat · Video Conferencing

20,986

Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.

View details
89
Repo Health
81
Technical
65
Dependency
Built with
TypeScript55%
Rust40%
Updated yesterday
TypeScript
50%
Other

Dify

No Code Platforms · AI Development · Developer Tools

152,883

Visual LLM workflow platform with RAG pipelines, agent capabilities, and model management for building production AI applications.

View details
92
Repo Health
85
Technical
71
Dependency
Built with
TypeScript50%
Python47%
Updated today
TypeScript
72%
AGPL 3.0

Firecrawl

AI Development · Developer Tools

169,311

Turn any website into clean, LLM-ready data with a single API call — no proxy headaches, no scraping complexity.

View details
89
Repo Health
83
Technical
66
Dependency
Built with
TypeScript72%
Python14%
Updated today
JavaScript
51%
MIT

Ghost

CMS · Blogging

54,795

Open source headless Node.js CMS for professional publishing, paid memberships, and newsletters with a fully owned audience.

View details
96
Repo Health
85
Technical
69
Dependency
Built with
JavaScript51%
TypeScript43%
Updated today
TypeScript
98%
Other

Novu

Developer Tools

39,615

Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.

View details
93
Repo Health
80
Technical
65
Dependency
Built with
TypeScript98%
Updated today
TypeScript
99%
Apache 2.0

Onlook

Design Tools · AI Design Tools

26,512

An open-source, AI-first visual editor that lets designers and developers build, style, and deploy React apps directly in code — no handoff required.

View details
66
Repo Health
80
Technical
68
Dependency
Built with
TypeScript99%
Updated 4 weeks ago
TypeScript
96%
MIT

open-seo

Marketing · Developer Tools

12,596

Pay-as-you-go open source SEO platform with MCP integration — keyword research, rank tracking, backlinks, site audits, and AI brand visibility in one self-hosted tool.

View details
83
Repo Health
79
Technical
78
Dependency
Built with
TypeScript96%
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