# nivaldodasilva/ua-parser-js architecture

> Architecture diagram of the GitHub repository nivaldodasilva/ua-parser-js, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nivaldodasilva/ua-parser-js
- Repository: https://github.com/nivaldodasilva/ua-parser-js

## Overview

UAParser.js is a small, dependency-free library that turns a user-agent string into browser, engine, operating-system, CPU, and device details. The principal workflow is to supply a string (or use the browser’s current user agent), parse it, and read the structured result. The README documents these distinct detection outputs and a combined result; sampled source shows regex-based matching and browser integration. Unsampled implementation details are not expanded into separate components.

Main entry points: [`src/ua-parser.js`](https://github.com/nivaldodasilva/ua-parser-js/blob/master/src/ua-parser.js) (UAParser)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_consumer(("Library consumer"))
node_parser["UAParser<br/>[ua-parser.js]"]
node_browser["Browser details<br/>[ua-parser.js]"]
node_engine["Engine details<br/>[ua-parser.js]"]
node_os["OS details<br/>[ua-parser.js]"]
node_cpu["CPU architecture<br/>[ua-parser.js]"]
node_device["Device details<br/>[ua-parser.js]"]
node_result["Combined result<br/>[ua-parser.js]"]

node_consumer -->|"supplies user agent"| node_parser
node_parser -->|"extracts"| node_browser
node_parser -->|"extracts"| node_engine
node_parser -->|"extracts"| node_os
node_parser -->|"extracts"| node_cpu
node_parser -->|"extracts"| node_device
node_parser -->|"returns result"| node_result

click node_parser "https://github.com/nivaldodasilva/ua-parser-js/blob/master/src/ua-parser.js"
click node_browser "https://github.com/nivaldodasilva/ua-parser-js/blob/master/src/ua-parser.js"
click node_engine "https://github.com/nivaldodasilva/ua-parser-js/blob/master/src/ua-parser.js"
click node_os "https://github.com/nivaldodasilva/ua-parser-js/blob/master/src/ua-parser.js"
click node_cpu "https://github.com/nivaldodasilva/ua-parser-js/blob/master/src/ua-parser.js"
click node_device "https://github.com/nivaldodasilva/ua-parser-js/blob/master/src/ua-parser.js"
click node_result "https://github.com/nivaldodasilva/ua-parser-js/blob/master/src/ua-parser.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_consumer toneIndigo
class node_parser,node_engine,node_os,node_cpu,node_device,node_result toneTeal
class node_browser toneBlue
```

## Components

### Other components

- **Library consumer**
- [UAParser](https://github.com/nivaldodasilva/ua-parser-js/blob/master/src/ua-parser.js): `src/ua-parser.js`
- [Browser details](https://github.com/nivaldodasilva/ua-parser-js/blob/master/src/ua-parser.js): `src/ua-parser.js`
- [Engine details](https://github.com/nivaldodasilva/ua-parser-js/blob/master/src/ua-parser.js): `src/ua-parser.js`
- [OS details](https://github.com/nivaldodasilva/ua-parser-js/blob/master/src/ua-parser.js): `src/ua-parser.js`
- [CPU architecture](https://github.com/nivaldodasilva/ua-parser-js/blob/master/src/ua-parser.js): `src/ua-parser.js`
- [Device details](https://github.com/nivaldodasilva/ua-parser-js/blob/master/src/ua-parser.js): `src/ua-parser.js`
- [Combined result](https://github.com/nivaldodasilva/ua-parser-js/blob/master/src/ua-parser.js): `src/ua-parser.js`

## Connections

- Library consumer → UAParser: supplies user agent
- UAParser → Browser details: extracts
- UAParser → Engine details: extracts
- UAParser → OS details: extracts
- UAParser → CPU architecture: extracts
- UAParser → Device details: extracts
- UAParser → Combined result: returns result
