Skip to content

@dudousxd/nestjs-inertia-client

Terminal window
pnpm 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.

SubpathContents
@dudousxd/nestjs-inertia-clientCore: Contract, @ApplyContract, createFetcher, invalidate, etc.
@dudousxd/nestjs-inertia-client/reactTyped <Link>, <InertiaRouteProvider>, useInertiaRoutes() for React + @inertiajs/react
@dudousxd/nestjs-inertia-client/vueTyped <Link>, provideInertiaRoutes(), useInertiaRoutes(), INERTIA_ROUTES_KEY for Vue 3 + @inertiajs/vue3
@dudousxd/nestjs-inertia-client/svelteTyped <Link>, provideInertiaRoutes(), useInertiaRoutes() for Svelte 5 + @inertiajs/svelte
@dudousxd/nestjs-inertia-client/ssrSSR hydration helpers (hydrateClientFromInertia, seedInitialQueries)
ExportDescription
Contract.get/post/put/patch/deleteDeclare a typed REST contract with Zod schemas
@ApplyContract(contract)Attach a contract to a controller method (read by codegen)
createFetcher<Api>(options)Create a typed fetch client from api.ts
InertiaRouteProvider (React)Context provider — wrap your app root to enable <Link> route resolution
provideInertiaRoutes() (Vue/Svelte)Provide the route resolver to all child <Link> components
useInertiaRoutes() (React/Vue/Svelte)Hook/function to access the route resolver in any component
Route.Response<K> / Route.Body<K> / Route.Query<K>Extract request/response types by contract name
hydrateClientFromInertia(page)SSR: initialise TanStack Query from Inertia initial-page data

See Typed Client guide for full HTTP client usage.

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