Spoosh
Getting Started

Installation

Install Spoosh packages for your project

Core Packages

Install the core packages to get started:

npm install @spoosh/core @spoosh/react

Plugins

Install only the plugins you need. See the Plugins section for details on each plugin.

For most projects, we recommend starting with these plugins:

npm install @spoosh/core @spoosh/react @spoosh/plugin-cache @spoosh/plugin-deduplication @spoosh/plugin-invalidation @spoosh/plugin-retry

This gives you:

  • Caching - Avoid redundant network requests
  • Deduplication - Prevent duplicate requests when multiple queries invalidate
  • Invalidation - Auto-refresh related queries after mutations
  • Retry - Automatically retry failed requests

Framework Adapters

Hono

If you're using Hono on the server, install the type adapter:

npm install @spoosh/hono

This lets you automatically infer your API schema from Hono routes.

OpenAPI

To generate OpenAPI specs from your schema:

npm install @spoosh/openapi

TypeScript Configuration

Spoosh requires TypeScript 5.0 or later. Ensure your tsconfig.json has strict mode enabled for the best type inference:

tsconfig.json
{
  "compilerOptions": {
    "strict": true,
    "target": "ES2020",
    "module": "ESNext",
    "moduleResolution": "bundler"
  }
}

On this page