SDK Reference
Ductape provides server SDKs for TypeScript, Java, Go, and .NET. Code examples in this site use tabs for each language where applicable.
Install
- TypeScript
- Java
- Go
- .NET
npm install @ductape/sdk@0.1.8
<dependency>
<groupId>app.ductape</groupId>
<artifactId>sdk</artifactId>
<version>0.1.8</version>
</dependency>
go get github.com/ductape/ductape/sdk/go@v0.1.8
dotnet add package Ductape.Sdk --version 0.1.8
Current versions
| Language | Package / module | Version |
|---|---|---|
| TypeScript | @ductape/sdk | 0.1.8 |
| NestJS | @ductape/nestjs | 0.1.0 (requires @ductape/sdk ≥ 0.1.12) |
| Java | app.ductape:sdk | 0.1.8 |
| Go | github.com/ductape/ductape/sdk/go | v0.1.8 (git tag sdk/go/v0.1.8) |
| .NET | Ductape.Sdk | 0.1.8 |
Changelogs: TypeScript, Java, Go, .NET.
Documentation by language
| Language | Package / module | Repo docs |
|---|---|---|
| TypeScript | @ductape/sdk | This site (Backend sections) |
| NestJS | @ductape/nestjs | NestJS integration on this site |
| Java | app.ductape:sdk | sdk/java/README.md, migration |
| Go | github.com/ductape/ductape/sdk/go | sdk/go/README.md, migration |
| .NET | Ductape.Sdk | sdk/dotnet/README.md, migration |
Readiness
See SDK readiness for production comparison across Java, Go, and .NET.
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
- Java
- Go
- .NET
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' },
});
Map<String, Object> ductape = new Ductape(Map.of(
accessKey: System.getenv("DUCTAPE_ACCESS_KEY")!,
"product", "my-product",
"env", "dev"
));
ductape.databases().connect(Map<String, Object>.of(
"database", "users-db" ));
ductape.api().run(Map<String, Object>.of(
"app", "stripe",
"action", "create-charge",
input: Map.of( "amount", 1000, "currency", "usd" )
));
import "context"
auth := core.NewRequestContext("", "", "", "", os.Getenv("DUCTAPE_ACCESS_KEY")!)
client, err := ductapesdk.New(core.EnvProduction, auth)
if err != nil {
return err
}
client.Databases.Connect(ctx, map[string]any{
"database": "users-db" });
client.Api.Run(ctx, map[string]any{
"app": "stripe",
"action": "create-charge",
input: { "amount": 1000, "currency": "usd" },
});
var ductape = new Ductape({
accessKey: Environment.GetEnvironmentVariable("DUCTAPE_ACCESS_KEY")!,
["product"] = "my-product",
["env"] = "dev",
});
await ductape.Database.Connect(new Dictionary<string, object?>
{
["database"] = "users-db" });
await await ductape.Api.RunAsync(new Dictionary<string, object?>
{
["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 @ductape/sdk