← ClaudeAtlas

nfs-add-cachelisted

Retrofit Redis-backed cache handling into an existing project scaffolded with nextjs-fullstack-starter. Use when the user wants to add Redis, share Next.js cache across processes / deploys, speed up frequent reads, or any 'add caching to this project' request. Adds ioredis, a docker-compose redis service, wires Next.js's experimental cacheHandler to use Redis, adds a typed cache helper at src/server/lib/cache.ts, and REDIS_URL env. Refuses to run on projects that don't have the scaffolded structure.
juncoding/nextjs-fullstack-starter · ★ 0 · API & Backend · score 70
Install: claude install-skill juncoding/nextjs-fullstack-starter
# Retrofit Redis-backed cache Use when a project from `nextjs-fullstack-starter` (which uses Next.js's in-process cache by default) outgrows that. Typical triggers: - The user is deploying multiple Next.js processes / containers and wants a shared cache. - A blue-green deploy throws away the warm cache every release and that's becoming painful. - The user wants to use `src/server/lib/cache.ts` as a general-purpose Redis helper for non-Next.js caches too (rate limits, queues, etc.). If the project ISN'T at one of those tipping points, push back gently — Next.js's default cache is fine until measurably not. ## Pre-flight checks Refuse if any of these is true: 1. `src/server/modules/` doesn't exist — the project wasn't scaffolded with this plugin. 2. `src/server/lib/cache.ts` already exists — Redis is already wired. Suggest `/nfs-review-project` for an audit instead. ## Plan 1. Add `ioredis` to dependencies. Add `@neshca/cache-handler` if the user wants the Next.js cache itself to go through Redis. 2. Add `redis` service to `docker-compose.yml` (under the `cache` profile so it doesn't always run). 3. Add `REDIS_URL` to `src/env.ts` and `.env.example`. 4. Write `src/server/lib/cache.ts` — a typed wrapper exposing `get`, `set`, `del`, and a `cached(fn, key, ttl)` helper. 5. (Optional) Configure `next.config.ts`'s `cacheHandler` to use `@neshca/cache-handler` against Redis. 6. Update `CLAUDE.md` with the new pattern. ## The cache helper ```ts // src/server/lib/cache.ts im