open-index/open-npm huggingface dataset:
npm package: @resonatehq/aws
Description: Resonate FaaS handler for AWS Lambda Functions (TypeScript)
Latest version: 0.2.0

# @resonatehq/aws

`@resonatehq/aws` is the official binding to run [Resonate](https://github.com/resonatehq/resonate) durable execution workers on [AWS Lambda](https://aws.amazon.com/pm/lambda). Write long-running, stateful applications on short-lived, stateless serverless infrastructure.

## Installation

```bash
npm install @resonatehq/aws
```

## How it works

When a Durable Function suspends (e.g. on `yield* context.rpc()` or `context.sleep()`), the Lambda function **terminates**. When the Durable Promise completes, the Resonate Server resumes the function by invoking Lambda again — no long-running process required.

![Resonate on Serverless](./public/resonate.svg)

## Usage

Register your functions and export the HTTP handler from your Lambda entry point:

```ts
import { Resonate } from "@resonatehq/aws";
import type { Context } from "@resonatehq/aws";

const resonate = new Resonate();

resonate.register("countdown", function* countdown(ctx: Context, n: number): Generator {
  if (n <= 0) {
    console.log("done");
    return;
  }
  console.log(n);
  yield* ctx.sleep(1000);
  yield* ctx.rpc(countdown, n - 1);
});

// Export as an AWS Lambda Function URL handler
export const handler = resonate.httpHandler();
```

Deploy this as an [AWS Lambda Function URL](https://docs.aws.amazon.com/lambda/latest/dg/lambda-urls.html). The Resonate Server will call your handler to invoke and resume durable functions.

See the [AWS Lambda documentation](https://docs.aws.amazon.com/lambda/latest/dg/welcome.html) to learn how to develop and deploy Lambda functions.

## Examples

- [Durable Countdown on AWS Lambda](https://github.com/resonatehq-examples/example-countdown-ts)
- [Durable Research Agent on AWS Lambda](https://github.com/resonatehq-examples/example-openai-deep-research-agent-ts)

## Documentation

Full documentation: [docs.resonatehq.io](https://docs.resonatehq.io)
npm package: @resonatehq/cloudflare
Description: Resonate FaaS handler for Cloudflare Workers (TypeScript)
Latest version: 0.2.0

# @resonatehq/cloudflare

`@resonatehq/cloudflare` is the official binding to run [Resonate](https://github.com/resonatehq/resonate) durable execution workers on [Cloudflare Workers](https://workers.cloudflare.com). Write long-running, stateful applications on short-lived, stateless serverless infrastructure.

## Installation

```bash
npm install @resonatehq/cloudflare
```

## How it works

When a Durable Function suspends (e.g. on `yield* context.rpc()` or `context.sleep()`), the Cloudflare Worker **terminates**. When the Durable Promise completes, the Resonate Server resumes the function by invoking the Worker again — no long-running process required.

![Resonate on Serverless](./public/resonate.svg)

## Usage

Register your functions and export the HTTP handler from your Worker entry point:

```ts
import { Resonate } from "@resonatehq/cloudflare";
import type { Context } from "@resonatehq/cloudflare";

const resonate = new Resonate();

resonate.register("countdown", function* countdown(ctx: Context, n: number): Generator {
  if (n <= 0) {
    console.log("done");
    return;
  }
  console.log(n);
  yield* ctx.sleep(1000);
  yield* ctx.rpc(countdown, n - 1);
});

// Export as a Cloudflare Workers fetch handler
export default {
  fetch: resonate.httpHandler(),
};
```

Deploy this as a Cloudflare Worker. The Resonate Server will call your Worker to invoke and resume durable functions.

See the [Cloudflare Workers documentation](https://developers.cloudflare.com/workers/) to learn how to develop and deploy Workers.

## Examples

- [Durable Countdown on Cloudflare Workers](https://github.com/resonatehq-examples/example-countdown-cloudflare-ts)
- [Durable Research Agent on Cloudflare Workers](https://github.com/resonatehq-examples/example-openai-deep-research-agent-cloudflare-ts)

## Documentation

Full documentation: [docs.resonatehq.io](https://docs.resonatehq.io)
npm package: @resonatehq/gcp
Description: Resonate FaaS handler for Google Cloud Functions (TypeScript)
Latest version: 0.2.0

# @resonatehq/gcp

`@resonatehq/gcp` is the official binding to run [Resonate](https://github.com/resonatehq/resonate) durable execution workers on [Google Cloud Functions](https://cloud.google.com/functions). Write long-running, stateful applications on short-lived, stateless serverless infrastructure.

## Installation

```bash
npm install @resonatehq/gcp
```

## How it works

When a Durable Function suspends (e.g. on `yield* context.rpc()` or `context.sleep()`), the Cloud Function **terminates**. When the Durable Promise completes, the Resonate Server resumes the function by invoking it again — no long-running process required.

![Resonate on Serverless](./public/resonate.svg)

## Usage

Register your functions and export the HTTP handler from your Cloud Function entry point:

```ts
import { Resonate } from "@resonatehq/gcp";
import type { Context } from "@resonatehq/gcp";

const resonate = new Resonate();

resonate.register("countdown", function* countdown(ctx: Context, n: number): Generator {
  if (n <= 0) {
    console.log("done");
    return;
  }
  console.log(n);
  yield* ctx.sleep(1000);
  yield* ctx.rpc(countdown, n - 1);
});

// Export as a Google Cloud Functions HTTP handler
export const handler = resonate.httpHandler();
```

Deploy this as a Google Cloud Function with an HTTP trigger. The Resonate Server will call your handler to invoke and resume durable functions.

See the [Google Cloud Functions documentation](https://cloud.google.com/functions/docs) to learn how to develop and deploy Cloud Functions.

## Examples

- [Durable Countdown on Google Cloud Functions](https://github.com/resonatehq-examples/example-countdown-gcp-ts)
- [Durable Research Agent on Google Cloud Functions](https://github.com/resonatehq-examples/example-openai-deep-research-agent-gcp-ts)

## Documentation

Full documentation: [docs.resonatehq.io](https://docs.resonatehq.io)
npm package: @resonatehq/kafka
Description: Resonate Kafka Transport
Latest version: 0.1.1

# @resonatehq/kafka

`@resonatehq/kafka` is the official [Kafka](https://kafka.apache.org) transport binding for running Distributed Async Await, Resonate’s durable-execution framework. This package allows Resonate workers to communicate over Apache Kafka, using Kafka as a durable, ordered, and scalable message bus across processes and machines.

## Quick Start

### Installation
```bash
npm install @resonatehq/kafka
```

### Example

```typescript
import { type Context, Resonate } from "@resonatehq/sdk";
import { Kafka } from "@resonatehq/kafka";

async function main() {
  const transport = new Kafka({ brokers: ["localhost:9092"] });
  await transport.start();

  const resonate = new Resonate({ transport });

  resonate.register("foo", foo);
  resonate.register("baz", baz);

  const v = await resonate.run("foo.1", foo);
  console.log(v);

  resonate.stop();
}

function* foo(ctx: Context): Generator {
  const reply = yield* ctx.rpc("baz");
  return reply;
}

function baz(ctx: Context) {
  return `hello world`;
}

main()
```
### Start Resonate with Kafka enabled
Ensure the `resonate` and `default` Kafka topics exist:
```bash
<!-- start resonate with kafka enabled -->
resonate dev --api-kafka-enable --aio-sender-plugin-kafka-enable
```

### Run the Application
```bash
<!-- run the app -->
npx ts-node app.ts
```
npm package: @resonatehq/webserver
Description: Resonate Webserver Transport
Latest version: 0.1.1

# @resonatehq/webserver

`@resonatehq/webserver` enables Resonate workers to expose an in-process web server, allowing developers to rapidly build and test proofs of concept without needing a standalone Resonate server running in a separate process.

## Quick Start

### Installation
```bash
npm install @resonatehq/webserver
```


### Example

```typescript
import { type Context, Resonate } from "@resonatehq/sdk";
import { Webserver } from "@resonatehq/webserver";


async function main() {
  const transport = new Webserver();
  transport.start();
  const resonate = new Resonate({ transport });

  resonate.register(fib, { version: 1 });
}


function* fib(ctx: Context, n: number): Generator {
  if (n <= 1) return n;
  const p1 = yield ctx.beginRpc(fib, n - 1, ctx.options({ id: `fib.${n - 1}` }));
  const p2 = yield ctx.beginRpc(fib, n - 2, ctx.options({ id: `fib.${n - 2}` }));
  return (yield p1) + (yield p2);
}

main();
```

### Run the Application
```bash
npx ts-node app.ts
```

### Invoke your functions
```bash
resonate invoke fib.5 --func fib --arg 5
```

### Check the results
```bash
resonate promises get fib.5
```