Aviary
Packages

@dudousxd/nestjs-inertia-client

Typed HTTP client, route naming, <Link> components, and SSR hydration.

pnpm add @dudousxd/nestjs-inertia-client
npm install @dudousxd/nestjs-inertia-client
yarn add @dudousxd/nestjs-inertia-client

End-to-end typed HTTP client that consumes the api.ts emitted by codegen, plus typed <Link> components for React, Vue, and Svelte.

Subpath exports

SubpathContents
@dudousxd/nestjs-inertia-client@As, createFetcher, invalidate, buildUrl, defineContract, ApplyContract
@dudousxd/nestjs-inertia-client/react<Link>, InertiaRouteProvider, useInertiaRoutes()
@dudousxd/nestjs-inertia-client/vue<Link>, provideInertiaRoutes(), useInertiaRoutes(), INERTIA_ROUTES_KEY
@dudousxd/nestjs-inertia-client/svelte<Link>, provideInertiaRoutes(), useInertiaRoutes()
@dudousxd/nestjs-inertia-client/ssrhydrateClientFromInertia(page), seedInitialQueries

Key exports

ExportDescription
@As(name)Decorator; sets route name for a controller class or method (read by codegen)
createFetcher(options)Create a typed fetch client from generated api.ts
invalidate(queryClient, name, args?)Invalidate TanStack Query cache by route name
buildUrl(path, opts, baseUrl?)Resolve parameterized URLs
InertiaRouteProvider (React)Context provider; enables <Link> route resolution
provideInertiaRoutes() (Vue/Svelte)Provide the route resolver to child <Link> components
useInertiaRoutes()Hook to access the route resolver in any component
hydrateClientFromInertia(page)SSR: initialize TanStack Query from Inertia initial-page data

See Typed Client guide for HTTP client usage.

See Typed Link guide for <Link> component usage across React, Vue, and Svelte.

On this page