# strapi-random-sort

> Randomly sort the content of a collection

Latest version **1.1.0** (published 2026-07-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install strapi-random-sort
pnpm add strapi-random-sort
yarn add strapi-random-sort
bun add strapi-random-sort
```

## Health

**Score 60/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2026-07-17 |
| First published | 2023-04-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=18.x.x |
| Dependencies | 0 |
| Unpacked size | 11.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Muhammad Bilal |
| Maintainers | mgulraize |

## Links

- npm: https://www.npmjs.com/package/strapi-random-sort
- npm.io page: https://npm.io/package/strapi-random-sort

## Recent versions

- 1.1.0 (latest) — 2026-07-17
- 1.0.0 — 2026-01-05
- 0.0.7 — 2025-06-12
- 0.0.6 — 2025-06-12
- 0.0.5 — 2025-06-12
- 0.0.4 — 2025-06-12
- 0.0.3 — 2025-06-12
- 0.0.2 — 2023-04-25
- 0.0.1 — 2023-04-24

## README

# Strapi plugin Random Sort

A Strapi plugin to randomly sort the data of a request.

## Features

- Randomly sort incoming data without the need of complex middleware
- Simple configuration and works with any endpoint

## Installation

To install this plugin, you need to add an NPM dependency to your Strapi application.

```sh
# Using Yarn
yarn add strapi-random-sort

# Or using NPM
npm install strapi-random-sort
```

## Configuration

Add configuration to your `config/plugins.js` file.

```js

module.exports = ({ env }) => ({
   // ...
  "random-sort": {
    enabled: true,
  },
  // ...

});
```

## Usage

You can access the new random query parameter on any of your API calls.

Add a `?random=true` as a query parameter

## Example

`http://localhost:1337/api/blogs?random=true`

## GraphQL

The `random=true` flag also works on the GraphQL endpoint - add it as a URL
query param on the request itself (GraphQL clients can usually set this
alongside the endpoint URL):

`http://localhost:1337/graphql?random=true`

This shuffles the order of whatever page GraphQL returns for each array
field in the response (both the default flattened Strapi v5 format and the
Relay-style `_connection` variant are supported). Note that GraphQL resolves
its own pagination from the query/variables, so unlike the REST endpoint
this can't force a "fetch everything, then repaginate" pass - request a
larger `pageSize` in your GraphQL query if you want randomness across the
full dataset rather than just the returned page.

---
_Source: https://npm.io/package/strapi-random-sort · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
