Use Cases
Next.js
Use blurkit output as blurDataURL in Next.js Image workflows.
When to use
Section titled “When to use”Use this pattern when image URLs are known in build-time or server-side code.
Example
Section titled “Example”import Image from 'next/image'import { encode } from 'blurkit/node'
const result = await encode('./public/hero.jpg')
<Image src="/hero.jpg" placeholder="blur" blurDataURL={result.dataURL} alt="Product hero image"/>Inputs / Options / Behavior
Section titled “Inputs / Options / Behavior”- Placeholder work runs before render.
blurDataURLreceivesresult.dataURLdirectly.- Runtime entrypoint should be
blurkit/nodefor this flow. - Node
BufferandUint8Arrayinputs are supported directly, soreadFile()output can be passed toencode()without conversion.
Limits / Caveats
Section titled “Limits / Caveats”- Requires
sharpin Node environment. - Do not use browser runtime for server-only placeholder generation.
Known integration caveat: Turbopack and native Sharp resolution
Section titled “Known integration caveat: Turbopack and native Sharp resolution”Blurkit’s Node runtime needs Sharp, and Blurkit itself lazy-loads it behind await import('sharp') — importing blurkit/node never executes Sharp eagerly.
A production Next.js 16 + Turbopack + Vercel deployment was observed to break Sharp/libvips native resolution when Sharp was explicitly forced into serverExternalPackages. Allowing Next/Turbopack to handle Sharp normally (the default) resolved that deployment.
Therefore:
- Do not add Sharp to
serverExternalPackagesby default. - If you customize native package externalization, test your target deployment runtime before shipping.
This is a known integration caveat for Blurkit + Next.js + Turbopack, not a universal Next.js rule.