Repository navigation
Description
I'm opening this here because it affects multiple packages, including mainly body-parser and Express, and I'd like to consolidate the discussion around qs instead of continuing it across multiple issues, discussions, and PRs.
- Should URLSearchParams be used in node.js 8 instead of querystring? body-parser#252
- Replacing
qswithqs-esmorpicoquerybody-parser#566 - Implement a __proto__ check option body-parser#347
- use non blocking json parser body-parser#132
- build-your-own-parser body-parser#22
- Add multipart/form-data support body-parser#88
- fix: keep repeated extended query params as arrays beyond 20 values express#7151
- Fix query parameter truncation with configurable limit (fixes #5878) express#7117
- Remove direct
qsdependency express#6865 - Query Param Silently Remove param query value if it is over 1000 express#5878
- Investigate replacing `qs` express#5783
- Dependency graph improvements (via npmgraph.js.org) express#6647
Currently, the extended option brings in qs. That's not really a major problem, since we could simply make it an optional peer dependency and let users install it if they need it while continuing to provide the option.
The more important point is that, recently, we've been moving away from being opinionated about these kinds of things. For example, we've made the query parser customizable, and we're also working toward non-blocking JSON parsing by allowing custom parsers in body-parser (expressjs/body-parser#696). Similarly, raw-body no longer depends on iconv-lite; it now uses TextDecoder by default while still allowing users to provide their own decoder if needed stream-utils/raw-body#145.
Express already allows customizing the URL query parser, so for Express 6 I think we should remove the extended option entirely. That way, Express no longer has an opinion about which parser should be used. If the platform default isn't what you want, you can simply plug in your own parser, just as you already can today.
I'm marking this for discussion in a future meeting so we can get feedback from the rest of the team, especially the captains, and use it to help plan Express 6.
This isn't about the dependency tree or any of that. It's about reducing the maintenance burden and staying true to our philosophy of being unopinionated: use what the platform provides. 🙂
Activity
ljharb commentedon Jul 24, 2026
I'm not sure "moving away from being opinionated" is actually a good thing. Users are, quite frankly, not informed enough to make the best choices in aggregate, and being opinionated is how we can improve the ecosystem.
Presented with a ton of choices, humans empirically make poor ones and experience analysis paralysis.
bjohansebas commentedon Jul 25, 2026
It also doesn't seem like many people switched to the extended mode during the Express v5 migration—they mostly stuck with the default. On top of that, there's now the HTTP Query API, which in practice would replace the query parser, so its usage will likely decline. That said, it's still new, so we'll have to wait and see how things evolve over the coming months or years.
https://sourcegraph.com/search?q=context:global+count:1100000+%22set%28%27query+parser%27%2C+%27extended%27%22+-file:node_modules&patternType=keyword&sm=0
ljharb commentedon Jul 25, 2026
In order to communicate with rails, php, and other common backends, or with frontends designed for those, qs would still be needed - querystring and USP can't fully support them. I suggest considering defaults that offer maximal support instead of prioritizing maximum configurability or minimal initial size.
Webpack didn't win over browserify because it was small and composable - it won because it was stuffed full of functionality out of the box. The ecosystem consistently prefers that experience and empirically does not care about vanity metrics.
bjohansebas commentedon Jul 25, 2026
I think we need to go a step further here and run a broader survey. Right now, the issues are scattered across different repositories, so we don't really have a clear picture of what features people actually use, what they depend on, and what they don't. Most other frameworks tend to rely on what the platform provides by default, only deviating when they have a compelling optimization or specific use case. That's a good data point to consider, but I think we should gather actual usage data before making decisions.
43081j commentedon Sep 27, 2026
was any progress made on this?
today, express is misconfigured in that
qsis an optional peer effectively but defined as a required dependency. step 1 would be to fix that, by settingqsas an optional peer. We're installing dead code every day until that happens, so it would be very nice to resolve.as for being opinionated, it gives nice DX having good defaults, but that doesn't mean express needs to choose a library here.
really i'd expect express has a
parser?: (str) => unknownto bring your own. then just have good enough docs that show how to useURLSearchParamswith it, and possibly how to useqswith it. none of that needsqsto be in express at all.krzysdz commentedon Sep 27, 2026
Even if
qswas changed to a peer dependency in Express, it would still be installed as a dependency ofbody-parser, because it usesqsin both simple and extended modes of theurlencodedparser.43081j commentedon Sep 27, 2026
the state of one package isn't justification to leave another one broken, though.
today, express is misconfigured.
qscertainly is meant to be an optional peer and was left as a required dependency by mistake. it should be fixed.meanwhile, sure let's improve
body-parserby also decoupling it!