Skip to content
client-parser

v0.2.0 · zero runtime dependencies

Know the client.
Keep the uncertainty.

A tiny, type-safe classifier for User-Agent strings, Client Hints, and HTTP headers. Get browser, OS, device, engine, and bot signals—with confidence built in.

$ npm install client-parser
classification.tracelive
01
INPUT · USER-AGENT

Mozilla/5.0 (iPhone; CPU iPhone OS 17_5…

CLASSIFYING EVIDENCE
DEVICEMobileApple iPhone
Browser
Chrome 126
System
iOS 17.5
Engine
WebKit
Bot
● No
Evidenceuser-agent
Confidence● high
ESM + CJSTypeScript nativeBrowser + Node + EdgePrivacy-first

Interactive playground

Inspect the signal,
not just the string.

Paste a User-Agent or use your browser’s available evidence. The result comes directly from client-parser 0.2.0, including source and confidence.

01 / Evidence
Samples
02 / Typed result0.08 ms
{
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
  "device": {
    "type": "desktop",
    "name": "Desktop"
  },
  "browser": {
    "name": "Chrome",
    "version": "126.0.0.0",
    "major": "126"
  },
  "os": {
    "name": "Windows",
    "version": "10.0"
  },
  "engine": {
    "name": "Blink"
  },
  "bot": {
    "isBot": false
  },
  "isMobile": false,
  "isTablet": false,
  "source": [
    "user-agent"
  ],
  "confidence": "medium"
}

Designed for honest answers

Classification without false certainty.

CH

Structured when possible

Client Hints take priority when available, with User-Agent fallback everywhere else.

Client Hints
{}

Types at every edge

A stable result shape covers device, browser, OS, engine, bots, evidence, and confidence.

Result shape

Nothing phones home

No runtime dependencies, no network requests, no stored data, and an 8 KiB input cap.

Privacy notes

One function to begin

From string to useful signal.

Use a direct User-Agent string in any runtime, or pass headers and Client Hints when your platform exposes them.

See every input form →
quick-start.ts
import { parseClient } from 'client-parser'

const client = parseClient(
  request.headers.get('user-agent'),
)

client.device.type   // "mobile"
client.browser.name  // "Chrome"
client.confidence    // "high"

Small package. Clear answers.

Ship the signal,
not the guesswork.