query-string

Parse and stringify URL query strings in JavaScript with flexible array, number, and boolean handling.

Library
npm
v9.5.0
6,904stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
71/100Good
Development Activity64
Maintenance56
Community64
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
85/100Excellent
Architecture82
Code Quality88
Innovation86
Learning Curve85

query-string is a small, dependency-light JavaScript library for parsing and stringifying URL query strings. It turns a ?foo=bar&baz=1 string into a plain object and back again, handling the messy edge cases that the raw URLSearchParams API leaves to you: multiple array-encoding conventions, optional number and boolean coercion, custom per-key type schemas, sorted output, and helpers that operate on full URLs including the hash fragment.

Widely used across the front-end ecosystem with tens of millions of weekly downloads, it works identically in modern browsers and Node.js, ships first-class TypeScript types, and exposes a tiny, predictable API surface centered on parse and stringify.

What You Get

  • parse and stringify functions that convert between query strings and plain objects
  • Six array-encoding formats (bracket, index, comma, separator, bracket-separator, colon-list-separator) plus the default duplicate-key style
  • Optional coercion of values to numbers and booleans, or explicit per-key type schemas including custom transform functions
  • URL-aware helpers parseUrl and stringifyUrl that preserve the path and hash fragment
  • pick and exclude helpers for filtering parameters, and bundled TypeScript type definitions

Common Use Cases

  • Reading and updating filter, sort, and pagination state stored in the URL of a single-page app
  • Serializing request parameters into query strings for HTTP calls
  • Normalizing array parameters between a frontend and an API that uses a specific bracket or comma convention
  • Parsing OAuth or token data passed back in a URL hash fragment

Under The Hood

Architecture The entire library lives in base.js (~600 lines), re-exported through a tiny index.js that presents a default namespace object. Seven public functions — extract, parse, stringify, parseUrl, stringifyUrl, pick, and exclude — are built around internal encoderForArrayFormat and parserForArrayFormat factories that return the right encode/decode reducer for the chosen arrayFormat. parse splits pairs on &, uses split-on-first to divide each on its first =, decodes with decode-uri-component, folds results through the array reducer, and returns a prototype-less object via Object.create(null); stringify runs the inverse, and the URL helpers wrap these while carrying the path and hash fragment.

Tech Stack Written in modern ESM JavaScript targeting Node.js >=18 ("type": "module"), with three tiny single-purpose runtime dependencies: decode-uri-component, filter-obj, and split-on-first. Types ship as hand-written .d.ts files (base.d.ts, index.d.ts). Tooling is xo for linting, ava for tests, tsd for type tests, and a benchmark script.

Code Quality The code is clean and consistent, favoring small pure helpers and switch-based strategy selection over branching sprawl. Test coverage is thorough: a dedicated test/ directory holds separate suites for parse, stringify, parse-url, stringify-url, extract, pick, exclude, and property-based tests via fast-check, alongside index.test-d.ts type assertions. Edge cases around null, undefined, empty strings, and encoding are handled explicitly throughout.

API Design The developer experience is a strong point: the surface is minimal and memorable (parse/stringify mirror JSON), options are plain objects with sensible defaults, and the README documents every array format and type option with runnable examples. Full TypeScript definitions and isomorphic browser/Node behavior mean almost no boilerplate to get started, though the many arrayFormat variants require reading the docs to pick the right convention.

Used by 27 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
96%
Other

Amplication

Developer Tools · AI Code Assistants · Automation

16,010

Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.

View details
61
Repo Health
84
Technical
60
Dependency
Built with
TypeScript96%
Updated 1 months ago
TypeScript
100%
MIT

Botpress

AI Assistants · AI Development · Customer Support

14,872

The open-source hub for building and deploying LLM-powered AI agents with TypeScript-first tooling, 40+ integrations, and a revolutionary code-execution agent framework.

View details
95
Repo Health
82
Technical
66
Dependency
Built with
TypeScript100%
Updated yesterday
TypeScript
53%
Other

Chaskiq

CRM · Customer Support

3,560

Self-hosted live chat, video calls, help center, and marketing automation — a full-stack Intercom alternative you run on your own infrastructure.

View details
60
Repo Health
66
Technical
68
Dependency
Built with
TypeScript53%
Ruby36%
Updated 1 months ago
Java
48%
Apache 2.0

ClearFlask

Product Management · Community

448

Open-source feedback management and roadmap tool that lets product teams collect, prioritize, and respond to user input — with AI-powered summarization and full self-hosting control.

View details
83
Repo Health
73
Technical
63
Dependency
Built with
Java48%
TypeScript47%
Updated 2 weeks ago
TypeScript
97%
Other

GrowthBook

Developer Tools · Analytics · Monitoring

8,138

Open source feature flags, A/B testing, and warehouse-native experimentation that queries your existing data infrastructure—no data movement required.

View details
92
Repo Health
85
Technical
66
Dependency
Built with
TypeScript97%
Updated today
PHP
57%
Other

Hi.Events

Ecommerce · Scheduling

3,985

Self-hosted event ticketing platform that keeps your attendee data, brand, and revenue completely under your control.

View details
88
Repo Health
84
Technical
67
Dependency
Built with
PHP57%
TypeScript37%
Updated 6 days ago
TypeScript
71%
Other

highlight.io

Developer Tools · Analytics · Monitoring

9,367

Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.

View details
69
Repo Health
78
Technical
66
Dependency
Built with
TypeScript71%
Go16%
Updated yesterday
TypeScript
98%
MIT

GraphQL Hive

Developer Tools · Devops · Monitoring

485

Open-source GraphQL schema registry and observability platform with breaking change detection, federation support, and CI/CD integration for teams of any size.

View details
90
Repo Health
81
Technical
70
Dependency
Built with
TypeScript98%
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