npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@devxcommerce/strapi-middlewares

v2.2.0

Published

Reusable Strapi 5 middlewares as an auto-discovered plugin (concurrency limiter with bounded-queue load-shedding, …)

Readme

@devxcommerce/strapi-middlewares

Reusable Strapi 5 app middlewares.

Install

bun add @devxcommerce/strapi-middlewares
# or: npm install @devxcommerce/strapi-middlewares

concurrency

Per-instance inbound concurrency gate with bounded-queue load-shedding. Processes at most limit requests concurrently on the gated paths; the rest queue FIFO. Once more than maxQueue are waiting, new requests get a fast 503 Retry-After instead of growing an unbounded queue — bounding memory and giving clients a quick, honest failure rather than a slow upstream timeout.

Built on p-limit (which owns the queue mechanics); this adds the shedding guard on top.

Usage

This package is an auto-discovered Strapi plugin (via its strapi.kind marker) — installing it is enough, no config/plugins.ts entry needed. Reference the middleware by name in config/middlewares.ts to place it in the chain and pass config (bind env vars here — the package never reads process.env). No shim file, no resolve path.

export default ({ env }) => [
  'strapi::logger',
  {
    name: 'plugin::devx-middlewares.concurrency',
    config: {
      limit: env.int('STRAPI_MAX_CONCURRENCY', 15),
      // maxQueue defaults to limit * 10; override or set 0 to disable shedding
      maxQueue: env.int('STRAPI_MAX_QUEUE', 150),
    },
  },
  'strapi::errors',
  // …rest of the default stack
];

Config

| Option | Type | Default | Description | |---|---|---|---| | limit | number | 15 | Max requests processed at once, per instance. | | paths | string[] | ['/api', '/graphql'] | Path prefixes to gate (health/admin/plugin routes bypass). | | maxQueue | number | limit * 10 | Max requests allowed to wait before shedding with 503. 0 = unbounded (disable shedding). | | retryAfter | number | 1 | Retry-After header (seconds) sent with the 503. |

Total capacity across a fleet = instances × limit. Set maxQueue in production so a spike/retry storm can't grow the queue (and heap) without bound.

Uses p-limit@3 (the last CommonJS release) so it require()s cleanly in Strapi's CJS runtime on Node 20+. Do not bump to v4+ (ESM-only).

Config is validated at construction (limit integer ≥ 1, maxQueue ≥ 0, retryAfter ≥ 0) — a bad value fails the boot with a clear message instead of crashing inside p-limit. Shed events are logged at most once per 10s with an aggregated count, so a retry storm can't turn the gate into a log-flood.

Requirements

  • Strapi ^5
  • Node >=20 <=24

Links

License

MIT