Skip to main content

@ductape/nestjs

TypeScript only

@ductape/nestjs is a TypeScript/NestJS package. All code samples in this section are TypeScript — there are no Java, Go, or .NET tabs.

The @ductape/nestjs package wraps @ductape/sdk with NestJS modules, injectable handles, and decorators so you can call Ductape from controllers and services without manual SDK wiring.

What it provides

CapabilityNestJS surface
App actions@Api, @ApiDispatch, @ApiConfig
Databases & storage@Database, @Storage + feature modules
Webhooks@Webhook.Register, @Webhook.Consumer, @Webhook.List
Messaging, workflows, jobs@Messaging.*, @Workflow.*, @Job.Run, …
Agents, warehouse, sessions@Agent.*, @Warehouse.Query, @Session.*, …
Resilience@Health.*, @Quota.*, @Fallback.*
Workspace builders@WebhookBuilder.Define, @ModelBuilder.Define, @AgentBuilder.Define
Context@Product, @Env, @AccessTag, @InjectContext

Install

npm install @ductape/nestjs @ductape/sdk @nestjs/common @nestjs/core reflect-metadata rxjs

Peer dependency: @ductape/sdk ≥ 0.1.12, NestJS 10 or 11.

Package status

@ductape/nestjs is at 0.1.0 in the monorepo. Install from the published package when available, or link locally from sdk/nestjs during development.

Architecture

  • Decorators with runtime behavior (@Api, @Webhook.Register, messaging, agents, sessions, and related decorators) are executed by DuctapeMethodInterceptor (or DuctapeBuilderInterceptor in workspace mode).
  • Injectable handles (@Database('orders-db')) resolve through DuctapeContextService, which respects @Product / @Env on the current HTTP request when set.
  • Use ctx.sdk from @InjectContext() for SDK namespaces not yet wrapped (logs, cloud, …).

Auth modes

ModeModule helperSDK authTypical use
IntegrationDuctapeModule.forIntegration()accessKey + default product / envCustomer apps, product integrators
WorkspaceDuctapeModule.forWorkspace()accessKey (workspace user context resolved by the SDK)Admin tools, app/model/agent builders

Integration mode covers @Api, @Database, @Storage, and @Webhook.Register.

Workspace mode is required for builder APIs (ductape.webhooks.create, ductape.app.*, model/agent admin).

Next steps