Packages
@dudousxd/nestjs-inertia-client
Typed HTTP client, route naming, <Link> components, and SSR hydration.
pnpm add @dudousxd/nestjs-inertia-clientnpm install @dudousxd/nestjs-inertia-clientyarn add @dudousxd/nestjs-inertia-clientEnd-to-end typed HTTP client that consumes the api.ts emitted by codegen, plus typed <Link> components for React, Vue, and Svelte.
Subpath exports
| Subpath | Contents |
|---|---|
@dudousxd/nestjs-inertia-client | @As, createFetcher, invalidate, buildUrl, defineContract, ApplyContract |
@dudousxd/nestjs-inertia-client/react | <Link>, InertiaRouteProvider, useInertiaRoutes(), useForm, useTypedReload, useTypedPoll, prefetchRoute, <Deferred>, <WhenVisible> |
@dudousxd/nestjs-inertia-client/vue | <Link>, provideInertiaRoutes(), useInertiaRoutes(), INERTIA_ROUTES_KEY, useForm, useTypedReload, useTypedPoll, prefetchRoute, <Deferred>, <WhenVisible> |
@dudousxd/nestjs-inertia-client/svelte | <Link>, provideInertiaRoutes(), useInertiaRoutes(), useForm, useTypedReload, useTypedPoll, prefetchRoute, <Deferred>, <WhenVisible> |
@dudousxd/nestjs-inertia-client/ssr | hydrateClientFromInertia(page), seedInitialQueries |
Every framework subpath exposes the same typed surface — only the import specifier changes.
Key exports
| Export | Description |
|---|---|
@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 |
useForm(data) | Typed wrapper over the official useForm; data/errors keyed by TForm (Forms & Validation) |
useTypedReload() | Typed partial reload with prop-name autocomplete |
useTypedPoll(interval, opts?) | Typed interval polling via Inertia's native usePoll |
prefetchRoute(resolve, route, opts?) | Imperatively prefetch a typed route via router.prefetch |
<Deferred> | Typed wrapper over <Deferred>; renders a fallback until a deferred prop arrives |
<WhenVisible> | Typed wrapper over <WhenVisible>; loads props when the element scrolls into view |
hydrateClientFromInertia(page) | SSR: initialize TanStack Query from Inertia initial-page data |
See Typed Client guide for the HTTP client, useTypedPoll, prefetchRoute, <Deferred>, and <WhenVisible>.
See Forms & Validation for useForm and the server-side validation round-trip.
See Typed Link guide for <Link> component usage across React, Vue, and Svelte.