A cacheHandlers implementation for Next.js 16 cacheComponents and use cache.
The library is in packages/next-cache-s3 (see its README for usage) and a demo app in examples/basic.
pnpm install- Copy
examples/basic/.env.exampletoexamples/basic/.env pnpm build && pnpm start- Play around at http://localhost:3000
Note: Next doesn't compile cache handlers, so the library is pre-built (on install and before pnpm build). As the docs say, the Next config points to plain JS files with require.resolve, which here import the library:
// examples/basic/cache-handlers/default.mjs
import { createHandler } from 'next-cache-s3'
import { storage } from './storage.mjs'
export default createHandler({ name: 'default', storage })- LRU cache in addition to S3, to reduce network overhead
- Tags manifest syncing with LRU and stale-while-revalidate
- Sticky handlers (for caching across builds)
- Optimizations:
- Brotli compression
- base64 encoding
See ROADMAP.md.