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 "[email protected]"
- 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
[email protected]: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
copy and rename .env.template
to .env
- Log into the
nhs-notify-iam-dev
AWS account - Load AWS Cognito
- Open
nhs-notify-main-app
Cognito user pool - Grab
User pool ID
value
- Log into the
nhs-notify-iam-dev
AWS account - Load AWS Cognito
- Open
nhs-notify-main-app
Cognito user pool - Load
App integration
tab- Found (at the bottom of the page)
- Grab
Client ID
value
true/false
When true
a new Cognito instance will be created within the Amplify sandbox. You'll need to manually add users.
- Log into the
nhs-notify-iam-dev
AWS account - Load AWS Cognito
- Open
nhs-notify-main-app
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
-
To run an Amplify sandbox. To do this, authenticate with the AWS account
nhs-notify-iam-dev
then run:npx ampx sandbox --profile <your AWS profile for nhs-notify-iam-dev account>
-
Then in a separate terminal, run the app locally:
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