SoulCache

SoulCache

v1.1.1

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
~16KBCore gzip bundle

Everything you need

A complete toolkit for efficient data management.

Smart Cache

TTL caching with automatic garbage collection and LRU eviction.

Request Dedup

Identical in-flight requests are automatically merged into one.

Mutations

Optimistic updates with rollback and cache invalidation.

Infinite Queries

Cursor-based pagination with automatic page management.

SSR & Hydration

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

Cache Invalidation

Invalidate and refetch queries with dependency tracking.

Persistence

Pluggable storage adapters with automatic persistence.

DevTools

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

Type Safe

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

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 cache invalidation 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();
  },
});
 
// Subscribe to real-time updates
const unsub = client.subscribe(['users'], (snapshot) => {
  console.log('Updated:', snapshot.data);
});
 
// Invalidate and refetch
await client.invalidateQueries(['users']);

Start building with SoulCache

Open source. MIT licensed. Built for production.