bowser

A small, fast browser, platform, and rendering-engine detector for browser and Node environments

Library
npm
v2.14.1
5,764 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
66 /100 Good
Development Activity 52
Maintenance 40
Community 72
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
67 /100 Good
Architecture 65
Code Quality 68
Innovation 55
Learning Curve 80

Bowser parses a user-agent string and returns structured information about the browser, its rendering engine, the operating system, and the device platform — all without touching the DOM, so it works identically in the browser and in Node.js. It’s built around composable parsers (browser, engine, OS, platform) so consumers can pull in only the detection logic they actually need.

What You Get

  • Bowser.parse(userAgentString) returning structured {browser, os, platform, engine} info
  • Bowser.getParser(ua) for an instance-based API with helpers like .satisfies() for version-range checks against a support matrix
  • Separate, composable parser modules for browsers, rendering engines, operating systems, and platform types
  • Works identically in browser and Node.js since it operates purely on a user-agent string, with no DOM dependency
  • Bundled TypeScript type declarations (index.d.ts)

Common Use Cases

  • Showing browser-specific upgrade prompts or compatibility warnings based on parsed browser name and version
  • Gating a feature or applying a workaround only for specific browser/engine combinations (e.g. Safari-only CSS bugs)
  • Server-side analytics or logging pipelines parsing the User-Agent header from incoming requests in Node.js
  • Using .satisfies() to declare a minimum supported browser version matrix and warn users below it

Under The Hood

Architecture The library is organized as a pipeline of independent parser modules — parser-browsers.js (1,231 lines of browser-detection rules), parser-engines.js, parser-os.js, and parser-platforms.js — each holding a table of regex-based detection rules, orchestrated by the top-level parser.js which runs a user-agent string through all four and assembles the combined result; bowser.js exposes the public static/instance API on top of that. Tech Stack Plain JavaScript (ES5-compatible output plus a modern src/) bundled via Webpack, published with hand-written TypeScript declarations; the library has no runtime dependencies, keeping its ~4.8kB gzipped footprint. Code Quality Tests are split into test/unit (parser-level unit tests) and test/acceptance (broader end-to-end UA-string fixtures), giving reasonable coverage of the detection tables, though as a regex/rule-table-driven library the main quality risk is keeping pace with new browser UA string formats rather than logic bugs. API Design Two API styles are offered side by side: the static one-shot Bowser.parse(ua) for a quick structured read, and Bowser.getParser(ua) for a reusable instance exposing convenience methods like .satisfies() for declarative version-range support checks — this covers both quick one-off checks and more elaborate browser-support-matrix logic without extra boilerplate.

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