Getting Started
Installation
Install Spoosh packages for your project
Core Packages
Install the core packages to get started:
npm install @spoosh/core @spoosh/reactPlugins
Install only the plugins you need. See the Plugins section for details on each plugin.
Recommended Setup
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-retryThis 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/honoThis lets you automatically infer your API schema from Hono routes.
OpenAPI
To generate OpenAPI specs from your schema:
npm install @spoosh/openapiTypeScript Configuration
Spoosh requires TypeScript 5.0 or later. Ensure your tsconfig.json has strict mode enabled for the best type inference:
{
"compilerOptions": {
"strict": true,
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "bundler"
}
}