NextJS application deployed via AWS Amplify to act as a login portal for NHS users.
Read more about the technical design at REFCOM-2024-007: WebUI User Auth.
- Make sure you have GitHub access with the right permissions
- Setup git locally on your machine
- Set your local git email as you
*@nhs.net
emaile.g. git config --global user.email "firstname.lastname1@nhs.net"
- Setup commit signing (this is required before you can commit any code to the repository). This is a very good resource to help Mac users
https://gist.github.com/troyfontaine/18c9146295168ee9ca2b30c00bd1b41e
- Pull the repository here
git@github.com:NHSDigital/nhs-notify-web-template-management.git
-
Install
asdf
HERE. We use this tool to manage the required version for packages (this can be found in the.tool-versions
file at the root of the project) on the project. You can use other tools usch asbrew
,apt
, etc, but you will be risking having different package versions to other developers. -
Then you need to install the following plugins:
asdf plugin-add nodejs asdf plugin-add direnv asdf plugin-add terraform asdf plugin-add gitleaks asdf plugin-add pre-commit
-
Now you can install the tools, and they will be runnable from within the
nhs-notify-web-template-management
directory:asdf install
-
Now you can run the command below to install the packages in the project:
npm install
To create a backend sandbox intended for use with local development, run the command
npm run create-backend-sandbox environment-name
substituting your environment name in as appropriate.
This command will also generate an amplify_outputs file in the root of the repository that will be used when running the app locally.
To destroy the sandbox when it is no longer needed, run the command
npm run destroy-backend-sandbox environment-name
You can point the app at any existing Cognito instance, not necessarily one you have created, by updating the user_pool_id and user_pool_client_id values in the amplify_outputs file.
In order to use a new Cognito user pool, you can run the sandbox auth script with your chosen email and password:
./scripts/sandbox_auth.sh email password
You can also manually create a user in that user pool:
- Log into the
nhs-notify-iam-dev
AWS account - Load AWS Cognito
- Open the relevant Cognito user pool
- Select
Create user
- Enter details
- Use your .nhs email address
- Select randomly generated password
- Select Send an email invitation
- Wait for email to arrive in your .nhs inbox
- Load web application and sign in
Having created your backend sandbox or otherwise set up your amplify_outputs file, you can start the app locally by running
npm run dev
npm run test:unit
You'll need to ensure you have an authenticated terminal to nhs-notify-iam-dev
AWS account. Then run:
cd /tests/test-team/
npm run test:component