SoulCache

SoulCache

v1.0.0

High-performance data fetching and caching runtime for TypeScript. Zero dependencies. Full type safety.

$npm install @soulcache/core
O(1)Cache Hit
0Dependencies
100%TypeScript
<5KBBundle Size

Everything you need

A complete toolkit for efficient data management.

Smart Cache

Stale-while-revalidate with configurable TTL and automatic LRU eviction.

Request Dedup

Identical in-flight requests are automatically merged into one.

Background Refetch

Refetch on window focus, network reconnect, and custom intervals.

Retry Logic

Exponential, linear, or constant backoff with error classification.

Infinite Queries

Cursor-based pagination with automatic page management.

SSR & Hydration

Server-side prefetch with dehydrate/hydrate. Next.js, Remix, and more.

DevTools

Real-time inspection panel with query timeline and cache state.

Type Safe

Full TypeScript strict mode. Inferred types. Zero `any`.

Plugin System

Extend with lifecycle hooks for queries, mutations, and cache.

Framework Agnostic

React, Vue, Svelte, Solid, or plain JavaScript. No lock-in.

Simple API, powerful features

Start fetching data in seconds. SoulCache handles caching, deduplication, and background updates automatically.

01
Install
npm install @soulcache/core
02
Configure
const client = new QueryClient()
03
Fetch
await client.fetchQuery({ queryKey, queryFn })
Read the quick start guide
example.ts
import { QueryClient } from '@soulcache/core';
 
const client = new QueryClient();
 
// Fetch with automatic caching & deduplication
const { data } = await client.fetchQuery({
  queryKey: ['users'],
  queryFn: async () => {
    const res = await fetch('/api/users');
    return res.json();
  },
  staleTime: 5 * 60 * 1000, // 5 minutes
});
 
// Subscribe to real-time updates
const unsub = client.subscribe(['users'], (snapshot) => {
  console.log('Updated:', snapshot.data);
});
 
// Invalidate and refetch
await client.invalidateQueries({ queryKey: ['users'] });

Start building with SoulCache

Open source. MIT licensed. Built for production.