{"id":15683452,"url":"https://github.com/nestjs-packages/sqs","last_synced_at":"2025-11-16T22:01:47.045Z","repository":{"id":37050620,"uuid":"387423186","full_name":"nestjs-packages/sqs","owner":"nestjs-packages","description":"AWS SQS module for Nest framework (node.js) 👷","archived":false,"fork":false,"pushed_at":"2025-11-10T21:16:37.000Z","size":1526,"stargazers_count":86,"open_issues_count":11,"forks_count":15,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-10T23:24:13.039Z","etag":null,"topics":["nest","nestjs","queue","sqs","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@nestjs-packages/sqs","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nestjs-packages.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-07-19T10:20:00.000Z","updated_at":"2025-08-31T07:43:39.000Z","dependencies_parsed_at":"2023-10-13T11:11:29.767Z","dependency_job_id":"3eefca15-ddb0-4b21-a998-7d8eca3520f1","html_url":"https://github.com/nestjs-packages/sqs","commit_stats":{"total_commits":455,"total_committers":7,"mean_commits":65.0,"dds":0.4505494505494505,"last_synced_commit":"64fad4cbfd0a08080dda8d99a7743960312bbca3"},"previous_names":["dev-mugles/nestjs-sqs"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/nestjs-packages/sqs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nestjs-packages%2Fsqs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nestjs-packages%2Fsqs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nestjs-packages%2Fsqs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nestjs-packages%2Fsqs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nestjs-packages","download_url":"https://codeload.github.com/nestjs-packages/sqs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nestjs-packages%2Fsqs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284783257,"owners_count":27062608,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-16T02:00:05.974Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nest","nestjs","queue","sqs","typescript"],"created_at":"2024-10-03T17:05:37.412Z","updated_at":"2025-11-16T22:01:47.012Z","avatar_url":"https://github.com/nestjs-packages.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://nestjs.com/\" target=\"blank\"\u003e\n    \u003cimg src=\"https://nestjs.com/img/logo-small.svg\" width=\"120\" alt=\"Nest Logo\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/nestjs-packages/sqs\" target=\"blank\"\u003e\n    \u003ch1 align=\"center\"\u003e@nestjs-packages/sqs\u003c/h1\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@nestjs-packages/sqs\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/@nestjs-packages/sqs.svg\" alt=\"NPM Version\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@nestjs-packages/sqs\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/@nestjs-packages/sqs.svg\" alt=\"NPM downloads\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@nestjs-packages/sqs\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/l/@nestjs-packages/sqs.svg\" alt=\"Package License\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/nestjs-packages/sqs\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://codecov.io/gh/nestjs-packages/sqs/branch/master/graph/badge.svg?token=pMLNZOxXiq\" alt=\"codecov coverage\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\n## Description\n\n@nestjs-packages/sqs is a project to make SQS easier to use and control some required flows with NestJS. This module provides decorator-based message handling suited for simple use.\n\nThis library internally uses [bbc/sqs-producer](https://github.com/bbc/sqs-producer) and [bbc/sqs-consumer](https://github.com/bbc/sqs-consumer)\n\n## Installation\n\n```sh\n$ npm i --save @nestjs-packages/sqs\n# or\n$ yarn add @nestjs-packages/sqs\n```\n\n## Quick Start\n\n### SqsModule\n\n#### forRootAsync\n\nFor use SqsModule, You have to set SQS configurations. you can set SQS configurations by forRootAsync method.\nafter forRootAsync method called, every sqs produers and consumers use SQS configurations returned by forRootAsync useFactory method\n\n```ts\n@Module({\n  imports: [\n    SqsModule.forRootAsync({\n      imports: [ConfigModule],\n      useFactory: (configService) =\u003e {\n        const config: SqsConfigOption = {\n          region: configService.region,\n          endpoint: configService.endpoint,\n          accountNumber: configService.accountNumber,\n          credentials: {\n            accessKeyId: configService.accessKeyId,\n            secretAccessKey: configService.secretAccessKey,\n          },\n        };\n        return new SqsConfig(config);\n      },\n      inject: [ConfigService],\n    }),\n  ],\n})\nclass AppModule {}\n```\n\n#### registerQueue\n\nSecond you have to register queues. register queues means create sqs-producer and sqs-consumer by queueOptions that passed into registerQueue parameter\ndefault type of queueOption is 'ALL'\n\n```ts\nSqsModule.registerQueue(\n  {\n    name: 'queueName',\n    type?: SqsQueueType.Consumer // 'ALL'|'CONSUMER'|'PRODUCER'\n    consumerOptions?: {},\n    producerOptions?: {}\n  },\n  ...\n);\n```\n\n### consume message\n\nYou need to decorate providers and methods in your NestJS providers in order to have them be automatically attached as message(event) handlers for incoming SQS messages\n\n```ts\n@SqsProcess(/** name: */ queueName)\nexport class AppMessageHandler {\n  @SqsMessageHandler(/** batch: */ false)\n  public async handleMessage(message: AWS.SQS.Message) {}\n\n  @SqsConsumerEventHandler(/** eventName: */ SqsConsumerEvent.PROCESSING_ERROR)\n  public onProcessingError(error: Error, message: AWS.SQS.Message) {\n    // report errors here\n  }\n}\n```\n\nYou need to pass queueName to SqsProcess decorator. unless SqsModule won't register Consumer.\nOne class can only handle one queue. so if you want to enroll dead letter queue, you have to make new class that handle dead letter queue\n\n### Produce messages\n\nSqsService needs to be injected to produce the message.\n\n```ts\n@Injectable()\nexport class AppService {\n  public constructor(\n    private readonly sqsService: SqsService,\n  ) { }\n\n  public async dispatchSomething() {\n    await this.sqsService.send\u003cBodyType\u003e(/** name: */ 'queueName', {\n      id: 'id',\n      body: { ... },\n      groupId: 'groupId',\n      deduplicationId: 'deduplicationId',\n      messageAttributes: { ... },\n      delaySeconds: 0,\n    });\n  }\n}\n```\n\n### Configuration\n\nSee [here](https://github.com/DEV-MUGLES/nestjs-sqs/blob/master/lib/sqs.types.ts), and note that we have same configuration as [bbc/sqs-consumer's](https://github.com/bbc/sqs-consumer).\nIn most time you just need to specify both `name` and `queueUrl` at the minimum requirements.\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnestjs-packages%2Fsqs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnestjs-packages%2Fsqs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnestjs-packages%2Fsqs/lists"}