{"id":30459651,"url":"https://github.com/defra/forms-notify-listener","last_synced_at":"2026-04-16T12:01:37.496Z","repository":{"id":310040065,"uuid":"1038483770","full_name":"DEFRA/forms-notify-listener","owner":"DEFRA","description":"Git repository for service forms-notify-listener","archived":false,"fork":false,"pushed_at":"2026-04-08T15:23:03.000Z","size":818,"stargazers_count":0,"open_issues_count":21,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-08T16:18:49.561Z","etag":null,"topics":["backend","cdp","node","service"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DEFRA.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-08-15T09:31:14.000Z","updated_at":"2026-04-08T14:19:47.000Z","dependencies_parsed_at":"2025-08-15T11:26:00.683Z","dependency_job_id":"1b1c9a76-b5a1-4456-abe3-d23bf7ca2627","html_url":"https://github.com/DEFRA/forms-notify-listener","commit_stats":null,"previous_names":["defra/forms-notify-listener"],"tags_count":61,"template":false,"template_full_name":null,"purl":"pkg:github/DEFRA/forms-notify-listener","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fforms-notify-listener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fforms-notify-listener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fforms-notify-listener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fforms-notify-listener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DEFRA","download_url":"https://codeload.github.com/DEFRA/forms-notify-listener/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fforms-notify-listener/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31884929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T11:36:10.202Z","status":"ssl_error","status_checked_at":"2026-04-16T11:36:09.652Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["backend","cdp","node","service"],"created_at":"2025-08-23T18:48:51.016Z","updated_at":"2026-04-16T12:01:37.490Z","avatar_url":"https://github.com/DEFRA.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# forms-notify-listener\n\nCore delivery platform Node.js Backend Template.\n\n- [forms-notify-listener](#forms-notify-listener)\n  - [Requirements](#requirements)\n    - [Node.js](#nodejs)\n  - [Local development](#local-development)\n    - [Setup](#setup)\n    - [Development](#development)\n    - [Development](#development-1)\n    - [Testing](#testing)\n    - [Production](#production)\n    - [Notes on SQS queue configuration](#notes-on-sqs-queue-configuration)\n      - [Queue configuration in forms-audit-api](#queue-configuration-in-forms-audit-api)\n    - [Npm scripts](#npm-scripts)\n    - [Update dependencies](#update-dependencies)\n    - [Formatting](#formatting)\n      - [Windows prettier issue](#windows-prettier-issue)\n  - [API endpoints](#api-endpoints)\n  - [Development helpers](#development-helpers)\n    - [Proxy](#proxy)\n  - [Docker](#docker)\n    - [Development image](#development-image)\n    - [Production image](#production-image)\n    - [Docker Compose](#docker-compose)\n    - [Dependabot](#dependabot)\n    - [SonarCloud](#sonarcloud)\n  - [Licence](#licence)\n    - [About the licence](#about-the-licence)\n\n## Requirements\n\n### Node.js\n\nPlease install [Node.js](http://nodejs.org/) `\u003e= v22` and [npm](https://nodejs.org/) `\u003e= v11`. You will find it\neasier to use the Node Version Manager [nvm](https://github.com/creationix/nvm)\n\nTo use the correct version of Node.js for this application, via nvm:\n\n```bash\ncd forms-notify-listener\nnvm use\n```\n\n## Local development\n\n### Setup\n\n1. Install Docker\n\n2. Bring up runtime dependencies\n\n```bash\ndocker compose up\n```\n\n3. Create a `.env` file with the following mandatory environment variables populated at root level:\n\n```text\nFORMS_AUDIT_QUEUE='forms_notify_listener_events'\nLOG_LEVEL=debug\nSQS_ENDPOINT=http://localhost:4566\nAWS_REGION=eu-west-2\nEVENTS_SQS_QUEUE_URL=http://sqs.eu-west-2.127.0.0.1:4566/000000000000/forms_notify_listener_events\nAWS_ACCESS_KEY_ID=dummy\nAWS_SECRET_ACCESS_KEY=dummy\nRECEIVE_MESSAGE_TIMEOUT_MS=5000\nNOTIFY_TEMPLATE_ID=3d448938-8a8b-40c2-a3de-414597f976e1\nNOTIFY_API_KEY=[your api key]\nNOTIFY_REPLY_TO_ID=462e5ac0-28f1-4e51-9d8e-8d8c31f59f6a\nRECEIVE_MESSAGE_TIMEOUT_MS=5000\nMANAGER_URL=http://localhost:3001\nDESIGNER_URL=http://localhost:3000\n```\n\nFor proxy options, see https://www.npmjs.com/package/proxy-from-env which is used by https://github.com/TooTallNate/proxy-agents/tree/main/packages/proxy-agent. It's currently supports Hapi Wreck only, e.g. in the JWKS lookup.\n\n### Development\n\nInstall application dependencies:\n\n```bash\nnpm install\n```\n\n### Development\n\nTo run the application in `development` mode run:\n\n```bash\nnpm run dev\n```\n\n### Testing\n\nTo test the application run:\n\n```bash\nnpm run test\n```\n\n### Production\n\nTo mimic the application running in `production` mode locally run:\n\n```bash\nnpm start\n```\n\n### Notes on SQS queue configuration\n\n`ReceiveMessageWaitTime` - this is probably the most important queue setting and controls what amazon call long polling vs short polling. When `ReceiveMessageWaitTime` is greater than 0, long polling is in effect. The max `ReceiveMessageWaitTime` is 20s.\n\nThis is the code affect by this setting:\n\n```js\nexport function receiveEventMessages() {\n  const command = new ReceiveMessageCommand(input)\n  return sqsClient.send(command)\n}\n```\n\nWith short-polling, line 3 fetches any messages from SQS and yields immediately.\nIt may sample only a subset of the queue’s partitions, so you might not see all currently available messages on that call.\n\nWith long-polling, if there aren’t any messages found, the HTTP connection is kept open for up to 20s until some arrive. The consumer of receiveEventMessages is left waiting while that happens.\nIt will fetch all currently available messages up to the message limit across the queue's partitions.\n\nBy default, CDP set `ReceiveMessageWaitTime` to 20s. The auditing queue also uses this default.\n\nSee [here](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-short-and-long-polling.html) for more information.\n\n#### Queue configuration in forms-audit-api\n\n`RECEIVE_MESSAGE_TIMEOUT_MS` - the amount of time to wait between calls to receive messages\n\n`SQS_MAX_NUMBER_OF_MESSAGES` - the number of messages to receive at once (max 10)\n\n`SQS_VISIBILITY_TIMEOUT` - when receiving a message from an Amazon SQS queue, it remains in the queue but becomes temporarily invisible to other consumers. This invisibility is controlled by the visibility timeout, which ensures that other consumers cannot process the same message while you are working on it.\n\n### Npm scripts\n\nAll available Npm scripts can be seen in [package.json](./package.json).\nTo view them in your command line run:\n\n```bash\nnpm run\n```\n\n### Update dependencies\n\nTo update dependencies use [npm-check-updates](https://github.com/raineorshine/npm-check-updates):\n\n\u003e The following script is a good start. Check out all the options on\n\u003e the [npm-check-updates](https://github.com/raineorshine/npm-check-updates)\n\n```bash\nncu --interactive --format group\n```\n\n### Formatting\n\n#### Windows prettier issue\n\nIf you are having issues with formatting of line breaks on Windows update your global git config by running:\n\n```bash\ngit config --global core.autocrlf false\n```\n\n## API endpoints\n\n| Endpoint             | Description                    |\n| :------------------- | :----------------------------- |\n| `GET: /health`       | Health                         |\n| `GET: /example    `  | Example API (remove as needed) |\n| `GET: /example/\u003cid\u003e` | Example API (remove as needed) |\n\n## Development helpers\n\n### Proxy\n\nWe are using forward-proxy which is set up by default. To make use of this: `import { fetch } from 'undici'` then\nbecause of the `setGlobalDispatcher(new ProxyAgent(proxyUrl))` calls will use the ProxyAgent Dispatcher\n\nIf you are not using Wreck, Axios or Undici or a similar http that uses `Request`. Then you may have to provide the\nproxy dispatcher:\n\nTo add the dispatcher to your own client:\n\n```javascript\nimport { ProxyAgent } from 'undici'\n\nreturn await fetch(url, {\n  dispatcher: new ProxyAgent({\n    uri: proxyUrl,\n    keepAliveTimeout: 10,\n    keepAliveMaxTimeout: 10\n  })\n})\n```\n\n## Docker\n\n### Development image\n\nBuild:\n\n```bash\ndocker build --target development --no-cache --tag forms-notify-listener:development .\n```\n\nRun:\n\n```bash\ndocker run -e PORT=3001 -p 3001:3001 forms-notify-listener:development\n```\n\n### Production image\n\nBuild:\n\n```bash\ndocker build --no-cache --tag forms-notify-listener .\n```\n\nRun:\n\n```bash\ndocker run -e PORT=3001 -p 3001:3001 forms-notify-listener\n```\n\n### Docker Compose\n\nA local environment with:\n\n- Localstack for AWS services (S3, SQS)\n- Redis\n- This service.\n- A commented out frontend example.\n\n```bash\ndocker compose up --build -d\n```\n\n### Dependabot\n\nWe have added an example dependabot configuration file to the repository. You can enable it by renaming\nthe [.github/example.dependabot.yml](.github/example.dependabot.yml) to `.github/dependabot.yml`\n\n### SonarCloud\n\nInstructions for setting up SonarCloud can be found in [sonar-project.properties](./sonar-project.properties)\n\n## Licence\n\nTHIS INFORMATION IS LICENSED UNDER THE CONDITIONS OF THE OPEN GOVERNMENT LICENCE found at:\n\n\u003chttp://www.nationalarchives.gov.uk/doc/open-government-licence/version/3\u003e\n\nThe following attribution statement MUST be cited in your products and applications when using this information.\n\n\u003e Contains public sector information licensed under the Open Government license v3\n\n### About the licence\n\nThe Open Government Licence (OGL) was developed by the Controller of Her Majesty's Stationery Office (HMSO) to enable\ninformation providers in the public sector to license the use and re-use of their information under a common open\nlicence.\n\nIt is designed to encourage use and re-use of information freely and flexibly, with only a few conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefra%2Fforms-notify-listener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdefra%2Fforms-notify-listener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefra%2Fforms-notify-listener/lists"}