Pre-Sentence Service is a service that allows probation staff to capture and store pre-sentence data.
Ensure docker images are up-to-date
docker-compose pull
The easiest way to run the app is to use docker compose to create the service and all dependencies.
docker-compose up
The app requires:
- hmpps-auth - for authentication
- redis - session store and token caching
- postgres - database
- gotenberg - PDF generator
- localstack - Cloud service emulator
Ensure docker images are up-to-date
docker-compose pull
To start the main services excluding the typescript app:
docker-compose up --scale app=0
Now in a separate terminal window or tab, at the project root.
Install dependencies using npm install, ensuring you are using >= Node v24.0.0 LTS
And then, to build the assets and start the app with nodemon:
AWS_ENDPOINT=http://localhost:4566 npm run start:dev
Note: AWS_ENDPOINT is only set for correct use with localstack during local development.
You can now access the service at http://localhost:3000
npm run lint
npm run test
For local running, start a test db, redis, and wiremock instance by:
docker-compose -f docker-compose-test.yml up
Then, in a separate terminal window or tab, at the project root; run the server in test mode by:
AWS_ENDPOINT=http://localhost:4566 npm run start-feature (or AWS_ENDPOINT=http://localhost:4566 npm run start-feature:dev to run with nodemon)
Note: AWS_ENDPOINT is only set for correct use with localstack during local development.
And then either, run tests in headless mode with:
npm run int-test
Or run tests with the cypress UI:
npm run int-test-ui
In order to clean the database you can use:
npm run clean-db
This will remove all database tables, you must then restart the service in order to run the migrations and reset the database.
API documentation is provided via Swagger.
Once the applicaiton is running you can access the Swagger UI at:
http://localhost:3000/api/docs