npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@werken/nestjs-google-pubsub

v0.5.0

Published

NestJS custom transport for Google Cloud Pub/Sub speaking CloudEvents 1.0. Write an event consumer as an ordinary Nest controller.

Readme

@werken/nestjs-google-pubsub

A NestJS custom transport for Google Cloud Pub/Sub that speaks CloudEvents 1.0. Write an event consumer as an ordinary Nest controller.

Part of Werkensee the root README for the full documentation: configuration reference, idempotency store adapters, schema handling, resource prefixing, observability and the migration guide.

npm install @werken/nestjs-google-pubsub @google-cloud/pubsub

Peer dependencies: @nestjs/common, @nestjs/microservices, @google-cloud/pubsub. @opentelemetry/api and @nestjs/testing are optional — without them, telemetry degrades to a no-op and the test harness is simply unavailable.

Quick start

A handler is a controller method. Routing is on ce-type, not on the topic or subscription:

@Controller()
export class OrderConsumer {
  constructor(private readonly orders: OrderService) {}

  @EventPattern("com.example.order.placed.v1")
  async onOrderPlaced(@Payload() data: OrderPlaced, @Ctx() ctx: CloudEventContext) {
    await this.orders.place(data, ctx.id);
  }
}

Return to ack, throw to nack and be retried, or throw TerminalEventError to dead-letter immediately — for a message that is well-formed but will never be processable, so it does not burn its retry budget or block an ordering key.

const app = await NestFactory.createMicroservice(WorkerModule, {
  strategy: new WerkenPubSubTransport({
    projectId: process.env.GCP_PROJECT_ID!,
    subscription: process.env.PUBSUB_SUBSCRIPTION!,
    deadLetterTopic: process.env.PUBSUB_DEAD_LETTER_TOPIC,
    idempotency: { consumer: "order-processing" },
  }),
});

// Do not skip: without it Nest never calls close(), so scale-down kills in-flight handlers.
app.enableShutdownHooks();
await app.listen();

What it handles for you

Envelope parsing and validation, routing on ce-type with wildcard patterns, Avro decode against the writer's schema revision, duplicate suppression, dead-lettering, graceful drain on SIGTERM, and OpenTelemetry spans continuing the producer's trace.

Testing

@werken/nestjs-google-pubsub/testing runs your real Nest module against an in-memory broker — no emulator, credentials or network:

const harness = await createWerkenTestHarness({ module: WorkerModule });
await harness.emit("com.example.order.placed.v1", { orderId: "abc" });
expect(harness.acked).toHaveLength(1);

License

MIT