This repository contains the ui code for the Find and Refer an Intervention UI
.
Most software can be installed using homebrew.
- Docker
- Node (v20)
After setting up the dependencies (below), run the application locally with with:
npm run start:dev
The dev server comes with Hot Module Reloading (reloads and restarts when any file changes are detected)
This project includes docker compose files to start the required dependencies for running the UI locally.
Run the following command to pull the relevant dependencies for the project.
docker-compose pull
and then the following command to run the containers.
docker-compose up
can optionally be run in detached mode in order to retain terminal use
docker-compose up -d
Node requires a .env file to start the application, but the project does not make heavy use of environmental variables.
Before starting the application create a new blank .env file by either creating a blank .env file:
touch .env
or copying the example file:
cp .env.example .env
The service uses a postgres database alongside flyaway migrations to create and populate the database. To connect to the database locally in your preferred database client (IntelliJ Ultimate, Dbeaver, Pgadmin, etc).
Create new connection using local database credentials;
Variable | Value |
---|---|
Port | 5432 |
Username | postgres |
Password | password |
The service uses an Oauth 2.0 setup managed through the Hmpps Auth project. To call any endpoints locally a bearer token must be generated. This can be done through calling the auth endpoint in the Hmpps-auth service.
Variable | Value |
---|---|
Grant type | Client credentials |
Access token URL | http://hmpps-auth:8090/auth/oauth/token |
Client ID | ----- |
Client Secret | ----- |
Scope | Read |
For Client ID and Secret refer to the relevant credentials for the Find and Refer Project.
For any issues please reach out to the Find and Refer Interventions team in slack #find-refer-interventions-team
These are used by the application to request tokens to make calls to APIs. These are system accounts that will have their own sets of roles.
Most API calls that occur as part of the request/response cycle will be on behalf of a user. To make a call on behalf of a user, a username should be passed when requesting a system token. The username will then become part of the JWT and can be used downstream for auditing purposes.
These tokens are cached until expiration.
These credentials are configured using the following env variables:
- CLIENT_CREDS_CLIENT_ID
- CLIENT_CREDS_CLIENT_SECRET
System tokens are obtained by making a call to HMPPS-Auth using the username of the logged in user. This token can then be added to the appropriate rest client calling to another service.
Once the application is running you should then be able to login with:
Community User username: bernard.beaks password: secret
Custody User username: FR_USER password: password123456
npm run lint
runseslint
.npm run typecheck
runs the TypeScript compilertsc
.
npm run test
A changelog for the service is available here