Skip to main content

One post tagged with "Sockets"

View All Tags

SDK Configuration

· 4 min read
Maciej Pyrc
Creator of Hyper Fetch | @BetterTyped
Tutorial

SDK Configuration

One config. Every endpoint. Fully typed.

sdk.ts×
const sdk = createSdk(client).$configure({
"users.$get": { cache: true, cacheTime: 30000 },
"/admin/*": { auth: true, retry: 0 },
});

Your API schema generates a fully typed SDK, but the generated code only knows about endpoints and types. Real projects still need caching policies, retry rules, auth settings, and response mappers. $configure lets you inject all of that into the SDK in one place, so every request comes pre-configured the moment you access it. It also makes testing easier by letting you swap in mocks without tools like msw or nock.