# ljharb/qs architecture

> Architecture diagram of the GitHub repository ljharb/qs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ljharb/qs
- Repository: https://github.com/ljharb/qs

## Overview

qs is a small JavaScript query-string library. Callers use its public API to parse strings into nested values or stringify values into query strings. Shared utilities support both directions, while formatters provide encoding-format choices. The graph focuses on runtime code; it does not imply that parsing and stringifying call each other.

Main entry points: [`lib/index.js`](https://github.com/ljharb/qs/blob/main/lib/index.js) (Public API), [`lib/stringify.js`](https://github.com/ljharb/qs/blob/main/lib/stringify.js) (Stringify values), [`lib/utils.js`](https://github.com/ljharb/qs/blob/main/lib/utils.js) (Shared utilities), [`lib/formats.js`](https://github.com/ljharb/qs/blob/main/lib/formats.js) (Query formats)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_caller(("Library caller"))
node_api["Public API<br/>[index.js]"]
node_parse["Parse strings<br/>[parse.js]"]
node_stringify["Stringify values<br/>[stringify.js]"]
node_utils["Shared utilities<br/>[utils.js]"]
node_formats["Query formats<br/>[formats.js]"]

node_caller -->|"uses"| node_api
node_api -->|"exports"| node_parse
node_api -->|"exports"| node_stringify
node_api -->|"exports"| node_formats
node_parse -->|"uses"| node_utils
node_stringify -->|"uses"| node_utils
node_stringify -->|"uses"| node_formats
node_utils -->|"uses"| node_formats

click node_api "https://github.com/ljharb/qs/blob/main/lib/index.js"
click node_parse "https://github.com/ljharb/qs/blob/main/lib/parse.js"
click node_stringify "https://github.com/ljharb/qs/blob/main/lib/stringify.js"
click node_utils "https://github.com/ljharb/qs/blob/main/lib/utils.js"
click node_formats "https://github.com/ljharb/qs/blob/main/lib/formats.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_caller toneIndigo
class node_api toneMint
class node_parse,node_stringify,node_utils,node_formats toneTeal
```

## Components

### Other components

- **Library caller**
- [Public API](https://github.com/ljharb/qs/blob/main/lib/index.js): `lib/index.js`
- [Parse strings](https://github.com/ljharb/qs/blob/main/lib/parse.js): `lib/parse.js`
- [Stringify values](https://github.com/ljharb/qs/blob/main/lib/stringify.js): `lib/stringify.js`
- [Shared utilities](https://github.com/ljharb/qs/blob/main/lib/utils.js): `lib/utils.js`
- [Query formats](https://github.com/ljharb/qs/blob/main/lib/formats.js): `lib/formats.js`

## Connections

- Library caller → Public API: uses (evidence: `README.md`)
- Public API → Parse strings: exports (evidence: `lib/index.js`)
- Public API → Stringify values: exports (evidence: `lib/index.js`)
- Public API → Query formats: exports (evidence: `lib/index.js`)
- Parse strings → Shared utilities: uses (evidence: `lib/parse.js`)
- Stringify values → Shared utilities: uses (evidence: `lib/stringify.js`)
- Stringify values → Query formats: uses (evidence: `lib/stringify.js`)
- Shared utilities → Query formats: uses (evidence: `lib/utils.js`)
