بنقرة واحدة
nestjs-codegen
يحتوي nestjs-codegen على 4 من skills المجمعة من DavideCarvalho، مع تغطية مهنية على مستوى المستودع وصفحات skill داخل الموقع.
Skills في هذا المستودع
Use @dudousxd/nestjs-client, the framework-neutral runtime the generated api.ts imports from. Build the client with createApi(createFetcher(opts)); configure FetcherOptions (baseUrl, headers, transport, transformer, deserialize, onError). Swap the network layer with axiosTransport(instance) or a custom Transport (returns normalized { ok,status,statusText,text() }, NOT a parsed body). Round-trip rich types with a transformer ({ stringify, parse }) or an array pipeline via composeTransformers. Opt individual clients into superjson with the @dudousxd/nestjs-client/superjson subpath: superjsonFetcherOptions, withSuperjson, and the server SuperjsonInterceptor. Handles errors via ApiHttpError. Use for fetcher wiring, axios, superjson, auth headers.
Understand what @dudousxd/nestjs-codegen emits and how the serialization seam shapes response types. Covers the generated routes.ts (ROUTES, RouteName, RouteParams, the route() helper, @As name overrides), api.ts (createApi factory), and forms.ts (validation schemas), plus the serialization:'json'|'superjson' config. In 'json' (default) every response type is wrapped in Jsonify<...> (Date->string, bigint->never, methods dropped); 'superjson' emits the raw controller return type and MUST be paired with the /superjson runtime. Use when a Date arrives as a string, when choosing json vs superjson, or when wiring route() and the generated outputs.
Set up @dudousxd/nestjs-codegen in a NestJS app. Wire NestjsCodegenModule.forRoot from @dudousxd/nestjs-codegen/nest with contracts.glob + codegen.outDir + a validation ADAPTER INSTANCE (zodAdapter from @dudousxd/nestjs-codegen-zod, or valibotAdapter/arktypeAdapter). Author one defineConfig nestjs-codegen.config.ts as the single source of truth and import it into forRoot(); run the nestjs-codegen codegen / init / doctor CLI as a CI drift gate. Covers the boot-time watcher (skipped when NODE_ENV=production), the enabled/cwd module fields, and why a bare validation:'zod' string throws ConfigError. Use for install, wiring, config, CI generation.
Add the optional TanStack Query layer to @dudousxd/nestjs-codegen with tanstackQuery() from @dudousxd/nestjs-codegen-tanstack. Register it in NestjsCodegenModule.forRoot({ extensions: [tanstackQuery()] }) (or defineConfig). Point TanstackQueryOptions.import at your framework adapter (@tanstack/react-query default, or @tanstack/vue-query/-svelte-query/-solid-query); pageParamName names the infinite-query page field. Each api.ts leaf then exposes .queryOptions() (GET routes) / .mutationOptions() (writes) / .infiniteQueryOptions() (GET) / .queryKey(), while still being a plain awaitable request. Use when wiring TanStack Query, picking the framework import, or invalidating with queryKey().