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

@nlvogel/payload-blurhash

v0.1.0

Published

Payload CMS plugin for automatic blurhash generation on image uploads.

Downloads

56

Readme

payload-blurhash

A Payload CMS plugin that automatically generates a tiny base64 WebP placeholder ("blurhash") for image uploads. Use it to render an instant blurred preview while the full image loads — the same trick Next.js, Medium, and Unsplash use.

The placeholder is stored as a data:image/webp;base64,... string directly on the upload document, so your frontend can render it without an extra request.

Install

pnpm add @nlvogel/payload-blurhash
# or
npm install @nlvogel/payload-blurhash

sharp is a peer dependency. If you're already running Payload, you have it.

Usage

// payload.config.ts
import { buildConfig } from 'payload'
import { blurhashPlugin } from '@nlvogel/payload-blurhash'

export default buildConfig({
  plugins: [
    blurhashPlugin({
      // Optional — limit to specific upload collections.
      // Omit to apply to all upload-enabled collections.
      collections: ['media'],
    }),
  ],
})

The plugin adds the following fields to each targeted upload collection:

| Field | Type | Description | | --- | --- | --- | | blurhash | text (read-only) | The base64-encoded WebP data URL. | | blurhashComponentX | number (1–9) | Horizontal resolution of the placeholder. | | blurhashComponentY | number (1–9) | Vertical resolution of the placeholder. | | blurhashPreview | ui | Sidebar preview with a "Regenerate" button. |

A blurhash is generated on every new image upload, and re-generated whenever blurhashComponentX or blurhashComponentY change.

Options

blurhashPlugin({
  collections?: string[]    // upload collection slugs; omit = all
  componentX?: number       // default X resolution, 1–9 (default: 4)
  componentY?: number       // default Y resolution, 1–9 (default: 3)
  enabled?: boolean         // disable without uninstalling (default: true)
})

Rendering the placeholder

The value is already a base64 WebP data URL, so it drops straight into next/image as blurDataURL:

import Image from 'next/image'

<Image
  src={media.url}
  width={media.width}
  height={media.height}
  alt={media.alt ?? ''}
  placeholder="blur"
  blurDataURL={media.blurhash}
/>

Or use it as a plain <img> for a static blur:

<img
  src={media.blurhash}
  style={{ aspectRatio: `${media.width} / ${media.height}` }}
/>

Regenerate endpoint

The plugin registers POST /api/blurhash/regenerate for the in-admin "Regenerate" button. It requires an authenticated request and accepts:

{
  "id": "<doc id>",
  "collection": "<slug>",
  "componentX": 4,
  "componentY": 3
}

It returns { "blurhash": "data:image/webp;base64,..." } without persisting — saving the document writes the new value.

Compatibility

  • Payload ^3.0.0
  • Node ^18.20.2 || >=20.9.0
  • React ^18 || ^19

License

MIT © Nick Vogel