Skip to content

govuk-one-login/txma-infra

Repository files navigation

TxMA Infrastructure

Infrastructure for querying data in Transaction Monitoring & Audit. There is an additional README for each stack.

Pre-requisites

To run this project you will need the following:

  • SAM CLI - Used to build and deploy the application
  • Node.js version 18 - Recommended way to install is via NVM
  • Docker - Required to run SAM locally
  • Yarn version 3 - The package manager for the project
  • Checkov - Scans cloud infrastructure configurations to find misconfigurations before they're deployed. Added as a Husky pre-commit hook.

Important

  • Node version 18 is required since the runtimes for Lambda functions are fixed.
  • Remove any old versions of Yarn that you may have installed globally if installing via corepack enable, or else the global version will override the version coming from Node.

Getting started

The project is using Yarn Zero Installs. So as long as Yarn itself is installed, everything should be ready to go out of the box. As long as you are running Node v18+, the easiest way to install Yarn is to enable corepack.

corepack enable

Then the only other thing that needs to be enabled is the Husky hooks.

yarn husky install

Zero installs works because the dependencies are committed via the .yarn folder. These are all compressed, so the folder size is much smaller than node_modules would be.

In order to ensure that dependencies cannot be altered by anything other than Yarn itself, we run yarn install --check-cache in the pipeline. This avoids the possibility of malicous users altering any dependency code.

Code standards

This repository is set up to use Prettier for formatting, and ESLint to look for problems in any Typescript and Javascript code.

Prettier is an opinionated formatting tool for multiple languages/file formats. Exceptions can be added to the .prettierrc.json file.

ESLint is configured to use just its recommended rules via the .eslintrc.json file. These can be viewed at:

Additionally, its code formatting rules are disabled as these are handled by Prettier.

To run the linting:

yarn lint

Licence

MIT License