New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@pixel-pulse/next-cache-brain-core

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixel-pulse/next-cache-brain-core

Universal caching engine for Next.js with React 18 hook support.

latest
npmnpm
Version
0.5.1
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source
Next Cache Brain - Smart Caching Engine

npm version License: MIT

Next-Generation Caching Engine for Next.js

Documentation • Server Lab • Client Lab • GitHub

✨ Features

  • Atomic Pulse Engine: Unified API supporting SWR, Cache-First, and Network-First strategies with a single function call.
  • Visual Diagnostics: Real-time DevTools to track TTL, Registry Hits, and Deduplication events as they happen.
  • Event Bridge: Reactive synchronization ensuring that when data updates in one component, the entire UI stays in sync.
  • App Router Native: Deeply optimized for Next.js Server Components, Actions, and high-performance client hydration.

⚠️ Beta Version Notice

This project is currently in v0.5.1-beta. We are actively refining the Registry Pulse logic and synchronization performance.

  • Please report any bugs via GitHub Issues.
  • Expect breaking changes until version 1.0.0.

📦 Installation

Install the core engine and the visual diagnostic suite:

npm install @pixel-pulse/next-cache-brain-core @pixel-pulse/next-cache-brain-devtools

Quick Start Guide

1. Global Registry Setup

To enable real-time synchronization and the Visual Debugger, wrap your application in the CacheBrainProvider within your layout.tsx.

// app/layout.tsx
import {
  CacheBrainProvider,
  CacheBrainDevtools,
} from "@pixel-pulse/next-cache-brain-devtools";

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body>
        <CacheBrainProvider>
          {children}

          {/* Diagnostic overlay active in development */}
          <CacheBrainDevtools
            enabled={process.env.NODE_ENV === "development"}
          />
        </CacheBrainProvider>
      </body>
    </html>
  );
}

2. Server-Side Implementation

Use smartCache in your Server Components for high-performance data fetching with automatic deduplication.

// app/layout.tsx
import { smartCache } from "@pixel-pulse/next-cache-brain-core";

async function Profile({ id }) {
  const user = await smartCache(
    ["user-profile", id], // Unique Cache Key
    () => fetch(`https://api.pulse.tech/users/${id}`).then((res) => res.json()),
    {
      strategy: "cache-first",
      ttl: 60000, // 60 seconds
    },
  );

  return <div>{user.name}</div>;
}

3. Client-Side Reactivity

Use the useSmartCache hook to create reactive UIs that stay synchronized across your entire application via the Event Bridge.

// app/layout.tsx
import { smartCache } from "@pixel-pulse/next-cache-brain-core";

async function Profile({ id }) {
  const user = await smartCache(
    ["user-profile", id], // Unique Cache Key
    () => fetch(`https://api.pulse.tech/users/${id}`).then((res) => res.json()),
    {
      strategy: "cache-first",
      ttl: 60000, // 60 seconds
    },
  );

  return <div>{user.name}</div>;
}

Caching Strategies

StrategyBehaviorBest For
cache-firstReturns cached data if valid; fetches only on miss.Static content, settings.
swrReturns cached data immediately; revalidates in background.Dashboards, Social feeds.
network-firstAttempts fresh fetch; falls back to cache on failure.Critical real-time data.
no-cacheBypasses registry but tracks request in DevTools.Testing, Non-cacheable hits.

Resources & Navigation

Explore the ecosystem and learn how to optimize your application's data pulse:

Built with ⚡ by Pixel Pulse Tech MM

Keywords

nextjs

FAQs

Package last updated on 04 Apr 2026

Related posts