aws-tanstack-query

github · npm

Generate type-safe TanStack Query options from any Smithy-generated TypeScript client.

// smithy client
@aws-sdk/client-s3
@myorg/api-client
// generated
getObjectQueryOptions()
putObjectMutationOptions()
clientKeys.getObject(...)

Problem

Using Smithy clients in React with TanStack Query means writing boilerplate for every operation: query keys, client wrappers, types. This library generates it all by reading the Smithy model embedded in the client package.

Solution

Point it at any Smithy-generated TypeScript client—AWS SDKs or your own—and get typed queryOptions, mutationOptions, and a query key factory.


back to work