Type-safe cache tag management for Next.js 16+. Version 0.3.1. Next-cool-cache wraps Next.js 16's cacheTag, revalidateTag, and updateTag primitives with a typed schema, preventing silent typos and scope mismatches. It enforces consistent tag naming via autocomplete and compile-time checks. Unlike manual string tags, it supports multi-scope caching (admin vs public) and generates hierarchical tag arrays for granular invalidation. Requires Next.js >=16.0.0. Ships TypeScript types. Lightweight with zero runtime dependencies beyond Next.js.
npm install next-cool-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
How to define a typed cache schema with scopes and use cacheTag in a Next.js server component.
Upgrade Next.js to v16; ensure 'use cache: remote' is used in cached functions.
Add 'as const' after the schema definition.
Ensure parameters are listed in the same order as they are passed to cacheTag/revalidateTag.
Stay updated with changelog; no immediate action required.
Change 'import createCache from "next-cool-cache"' to 'import { createCache } from "next-cool-cache"'.Check the scopes array in createCache call. Ensure the scope name used matches exactly.
Remove the argument or add _params to the schema node.
Ensure TypeScript config has 'moduleResolution: "bundler"' or 'node16'; the package is ESM-only.