SDK Reference
Ductape provides server SDKs for TypeScript and NestJS.
Install
- TypeScript
- NestJS
npm install @ductape/sdk@latest
npm install @ductape/nestjs@latest @ductape/sdk@latest
Current versions
| Language | Package / module | Version |
|---|---|---|
| TypeScript | @ductape/sdk | Install with the latest dist-tag |
| NestJS | @ductape/nestjs | Install with the latest dist-tag |
Changelog: TypeScript.
Check the registry rather than copying a stale pinned version:
- TypeScript
- NestJS
npm install @ductape/sdk@latest
npm install @ductape/nestjs@latest @ductape/sdk@latest
Node module interoperability
The current package is compiled as CommonJS. Native Node ESM may expose the CommonJS namespace as the default value, so normalize it explicitly:
// Native Node ESM
import DuctapeModule from '@ductape/sdk';
const Ductape = DuctapeModule.default ?? DuctapeModule;
// CommonJS
const Ductape = require('@ductape/sdk').default;
Both forms are covered by the package interoperability regression check. Do not use an unnormalized default import in native ESM until the package publishes a dedicated ESM export.
Documentation by language
| Language | Package / module | Repo docs |
|---|---|---|
| TypeScript | @ductape/sdk | This site (Backend sections) |
| NestJS | @ductape/nestjs | NestJS integration on this site |
Runtime defaults (TypeScript)
Set product and env on the Ductape constructor only (not via configure(), env vars, or product.init). Omitted fields on connect() and queries inherit from the constructor or active connection.
- TypeScript
const ductape = new Ductape({
accessKey: process.env.DUCTAPE_ACCESS_KEY!,
product: 'my-product',
env: 'dev',
});
await ductape.databases.connect({ database: 'users-db' });
await ductape.api.run({
app: 'stripe',
action: 'create-charge',
input: { amount: 1000, currency: 'usd' },
});
NestJS
For NestJS apps, use @ductape/nestjs — modules, injectable handles, and decorators such as @Api, @Database, @Storage, and @Webhook. See the NestJS integration guide. NestJS examples are TypeScript only (not included in the multi-language SDK tabs above).
npm install @ductape/nestjs@latest @ductape/sdk@latest