{"id":28066728,"url":"https://github.com/defra/apha-apps-perms-case-mgmt-api","last_synced_at":"2026-04-28T18:04:32.501Z","repository":{"id":292835886,"uuid":"982076506","full_name":"DEFRA/apha-apps-perms-case-mgmt-api","owner":"DEFRA","description":"Git repository for service apha-apps-perms-case-mgmt-api","archived":false,"fork":false,"pushed_at":"2026-01-30T14:29:06.000Z","size":25113,"stargazers_count":0,"open_issues_count":3,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-01-31T06:50:55.834Z","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-05-12T10:40:39.000Z","updated_at":"2026-01-23T10:18:31.000Z","dependencies_parsed_at":"2025-05-19T16:45:37.456Z","dependency_job_id":"89c69e63-0bf1-4b2f-94ad-d3f7331097c7","html_url":"https://github.com/DEFRA/apha-apps-perms-case-mgmt-api","commit_stats":null,"previous_names":["defra/apha-apps-perms-case-mgmt-api"],"tags_count":63,"template":false,"template_full_name":null,"purl":"pkg:github/DEFRA/apha-apps-perms-case-mgmt-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fapha-apps-perms-case-mgmt-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fapha-apps-perms-case-mgmt-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fapha-apps-perms-case-mgmt-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fapha-apps-perms-case-mgmt-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DEFRA","download_url":"https://codeload.github.com/DEFRA/apha-apps-perms-case-mgmt-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fapha-apps-perms-case-mgmt-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32392316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T14:34:11.604Z","status":"ssl_error","status_checked_at":"2026-04-28T14:32:37.009Z","response_time":56,"last_error":"SSL_read: 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-05-12T15:52:19.209Z","updated_at":"2026-04-28T18:04:32.495Z","avatar_url":"https://github.com/DEFRA.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# apha-apps-perms-case-mgmt-api\n\nCase management service responsible for accepting submissions and making them accessible to the CSC. Additionally, it confirms the receipt of submission emails and sends corresponding notifications to clients.\n\n- [apha-apps-perms-case-mgmt-api](#apha-apps-perms-case-mgmt-api)\n  - [Requirements](#requirements)\n    - [Node.js](#nodejs)\n  - [Local development](#local-development)\n    - [Setup](#setup)\n    - [Development](#development)\n      - [Environment variables required](#environment-variables-required)\n    - [Testing](#testing)\n    - [Production](#production)\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    - [MongoDB Locks](#mongodb-locks)\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 apha-apps-perms-case-mgmt-api\nnvm use\n```\n\n## Local development\n\n### Setup\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#### Environment variables required\n\n| Environment Variable                                | Type    | Required value to run in local                                                                        | Description                                           |\n| --------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |\n| `STUB_MODE_ENABLED`                                 | Boolean | true or false                                                                                         | Enables/disables stub mode for the API                |\n| `NOTIFY_API_KEY`                                    | String  | [Value to be provided by tech team]                                                                   | API key for the Notify service                        |\n| `NOTIFY_EMAIL_DOWNLOAD_CONFIRMATION`                | Boolean | true or false                                                                                         | Enables/disables email download confirmation          |\n| `TB_NOTIFY_CASE_DELIVERY_EMAIL_ADDRESS`             | String  | an email that is in notify guest list                                                                 | Email address for TB case delivery notifications      |\n| `TB_NOTIFY_APPLICANT_CONFIRMATION_TEMPLATE_ID`      | String  | ccd16b08-ce79-489b-8dc7-1d48986229d3                                                                  | Template ID for TB applicant confirmation emails      |\n| `TB_NOTIFY_CASE_DELIVERY_TEMPLATE_ID`               | String  | 0aea83a0-82c1-4ec4-ada1-27db58b47812                                                                  | Template ID for TB case delivery emails               |\n| `EXOTICS_NOTIFY_CASE_DELIVERY_EMAIL_ADDRESS`        | String  | an email that is in notify guest list                                                                 | Email address for Exotics case delivery notifications |\n| `EXOTICS_NOTIFY_APPLICANT_CONFIRMATION_TEMPLATE_ID` | String  | 3e7055e8-02b9-471a-b69d-c1c0bed713f3                                                                  | Template ID for Exotics applicant confirmation emails |\n| `EXOTICS_NOTIFY_CASE_DELIVERY_TEMPLATE_ID`          | String  | 2d69616e-1a08-4628-8b70-4ceeaf99d2fd                                                                  | Template ID for Exotics case delivery emails          |\n| `AWS_REGION`                                        | String  | eu-west-2                                                                                             | AWS region for S3 file upload                         |\n| `AWS_ACCESS_KEY_ID`                                 | String  | test                                                                                                  | AWS access key ID for S3 authentication               |\n| `AWS_SECRET_ACCESS_KEY`                             | String  | test                                                                                                  | AWS secret access key for S3 authentication           |\n| `S3_BUCKET`                                         | String  | apha                                                                                                  | S3 bucket name for file uploads                       |\n| `GS_BINARY`                                         | String  | /usr/bin/gs                                                                                           | Path to Ghostscript binary                            |\n| `SHAREPOINT_TB25_INTEGRATION_ENABLED`               | Boolean | true or false                                                                                         | Enables/disables SharePoint TB25 integration          |\n| `SHAREPOINT_TB25_FOLDER_PATH`                       | String  | Digital Applications/TB25                                                                             | SharePoint folder path for TB25 documents             |\n| `SHAREPOINT_TB25_TENANT_ID`                         | String  | 6f504113-6b64-43f2-ade9-242e05780007                                                                  | SharePoint tenant ID for TB25 integration             |\n| `SHAREPOINT_TB25_CLIENT_ID`                         | String  | cfcf85b5-e70e-4adb-bae1-b274432d960d                                                                  | SharePoint client ID for TB25 integration             |\n| `SHAREPOINT_TB25_CLIENT_SECRET`                     | String  | [Value to be provided by tech team]                                                                   | SharePoint client secret for TB25 integration         |\n| `SHAREPOINT_TB25_SITE_ID`                           | String  | defradev.sharepoint.com%2C0f571f64-24e3-4e90-be4a-c9783309b888%2C23e0ce9e-2dd3-424d-b238-909907026576 | SharePoint site ID for TB25 integration               |\n| `SHAREPOINT_TB25_LIST_ID`                           | String  | 74fdce34-80bd-4a8f-8a8f-02250ab1b2d7                                                                  | SharePoint list ID for TB25 documents                 |\n| `SHAREPOINT_TB25_DRIVE_ID`                          | String  | b!ZB9XD-MkkE6-Ssl4Mwm4iJ7O4CPTLU1CsjiQmQcCZXbN0DSvuICgQ4b-b6WTW-4y                                    | SharePoint drive ID for TB25 documents                |\n| `SHAREPOINT_TB25_SITE_NAME`                         | String  | APHAApplicationsPermissionsTestSite                                                                   | SharePoint site name for TB25 integration             |\n| `SHAREPOINT_TB25_SITE_BASE_URL`                     | String  | https://defradev.sharepoint.com                                                                       | SharePoint base URL for TB25 integration              |\n| `SQS_ENDPOINT`                                      | String  | https://sqs.eu-west-2.amazonaws.com                                                                   | AWS SQS endpoint URL for local development            |\n| `SQS_QUEUE_URL`                                     | String  | https://sqs.eu-west-2.amazonaws.com/332499610595/apha_apps_perms_submitted_applications               | AWS SQS queue URL for submitted applications          |\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### 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| `POST: /submit` | Endpoint that will generate an application reference, send emails to CSC case workers and to the applicant and return the generated application reference |\n\n## Development helpers\n\n### MongoDB Locks\n\nIf you require a write lock for Mongo you can acquire it via `server.locker` or `request.locker`:\n\n```javascript\nasync function doStuff(server) {\n  const lock = await server.locker.lock('unique-resource-name')\n\n  if (!lock) {\n    // Lock unavailable\n    return\n  }\n\n  try {\n    // do stuff\n  } finally {\n    await lock.free()\n  }\n}\n```\n\nKeep it small and atomic.\n\nYou may use **using** for the lock resource management.\nNote test coverage reports do not like that syntax.\n\n```javascript\nasync function doStuff(server) {\n  await using lock = await server.locker.lock('unique-resource-name')\n\n  if (!lock) {\n    // Lock unavailable\n    return\n  }\n\n  // do stuff\n\n  // lock automatically released\n}\n```\n\nHelper methods are also available in `/src/helpers/mongo-lock.js`.\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 apha-apps-perms-case-mgmt-api:development .\n```\n\nRun:\n\n```bash\ndocker run -e PORT=3001 -p 3001:3001 apha-apps-perms-case-mgmt-api:development\n```\n\n### Production image\n\nBuild:\n\n```bash\ndocker build --no-cache --tag apha-apps-perms-case-mgmt-api .\n```\n\nRun:\n\n```bash\ndocker run -e PORT=3001 -p 3001:3001 apha-apps-perms-case-mgmt-api\n```\n\n### Docker Compose\n\nA local environment with:\n\n- Localstack for AWS services (S3, SQS)\n- Redis\n- MongoDB\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\nThe project has been set up to run SonarCloud checks on every Pull Request. The configuration 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%2Fapha-apps-perms-case-mgmt-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdefra%2Fapha-apps-perms-case-mgmt-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefra%2Fapha-apps-perms-case-mgmt-api/lists"}