# ministryofjustice/hmpps-arns-assessment-platform-ui architecture

> Architecture diagram of the GitHub repository ministryofjustice/hmpps-arns-assessment-platform-ui, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ministryofjustice/hmpps-arns-assessment-platform-ui
- Repository: https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui

## Overview

This is the HMPPS ARNS Assessment Platform UI: an Express application that hosts declarative form journeys, including sentence plans, training-session launch, platform policies, access, and data deletion. The principal user workflow is authenticated access, sentence-plan form interaction, and persistence through the assessment service to the versioned AAP datastore. The README also describes a two-phase form engine, but its implementation is an external Forge dependency, not present in this tree. Edges follow shown calls or README statements; unverified form-package routing is marked dashed.

Main entry points: [`server/app.ts`](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/app.ts) (Express app), [`server/data/assessmentPlatformApiClient.ts`](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/data/assessmentPlatformApiClient.ts) (AAP API client), [`server/forms/sentence-plan`](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/tree/main/server/forms/sentence-plan) (Sentence plan), [`server/forms/training-session-launcher`](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/tree/main/server/forms/training-session-launcher) (Training launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_express["Express app<br/>[app.ts]"]
  node_auth["Authentication"]
  node_session["Web session<br/>[setUpWebSession.ts]"]
  node_routes["HTTP routes<br/>[index.ts]"]
  node_formengine["Forge form engine"]
end

subgraph group_journeys["Form journeys"]
  node_sentence["Sentence plan"]
  node_access["Access journey"]
  node_launcher["Training launcher"]
  node_deletion["Data deletion"]
  node_policies["Platform policies"]
  node_goal["Goal management"]
  node_plan["Plan history"]
end

subgraph group_assessment["Assessment services"]
  node_assessment_service["Assessment service"]
  node_api_client["AAP API client"]
  node_cache[("Assessment cache")]
end

subgraph group_integrations["External systems"]
  node_redis[("Redis<br/>[redisClient.ts]")]
  node_aap["AAP datastore API"]
  node_coordinator["Coordinator API"]
  node_handover["Handover API"]
  node_authservice["HMPPS Auth"]
  node_delius["Delius API<br/>[deliusApiClient.ts]"]
  node_arns["ARNS API<br/>[arnsApiClient.ts]"]
  node_pdf["PDF renderer<br/>[gotenbergClient.ts]"]
end

node_practitioner(("Practitioner"))

node_practitioner -->|"requests"| node_express
node_express -->|"installs middleware"| node_auth
node_express -->|"installs middleware"| node_session
node_express -->|"mounts routes"| node_routes
node_express -->|"creates router"| node_formengine
node_formengine -.->|"registers package"| node_sentence
node_formengine -.->|"registers package"| node_access
node_formengine -->|"registers package"| node_launcher
node_formengine -->|"registers package"| node_deletion
node_formengine -->|"registers package"| node_policies
node_sentence -.->|"uses effects"| node_goal
node_sentence -.->|"uses effects"| node_plan
node_assessment_service -->|"executes commands"| node_api_client
node_assessment_service -->|"executes queries"| node_api_client
node_api_client -->|"reads cache"| node_cache
node_cache -->|"uses store"| node_redis
node_api_client -->|"sends API requests"| node_aap
node_express -.->|"provides journeys"| node_assessment_service
node_auth -.->|"authenticates"| node_authservice
node_launcher -.->|"creates or merges sessions"| node_coordinator
node_launcher -.->|"prepares handover"| node_handover
node_express -->|"checks authorization"| node_delius
node_express -.->|"uses service"| node_arns
node_express -.->|"serves PDF"| node_pdf
node_deletion -->|"creates API client"| node_api_client

click node_express "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/app.ts"
click node_auth "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/middleware/setUpAuthentication.ts"
click node_session "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/middleware/setUpWebSession.ts"
click node_routes "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/routes/index.ts"
click node_sentence "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/tree/main/server/forms/sentence-plan"
click node_access "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/tree/main/server/forms/access"
click node_launcher "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/tree/main/server/forms/training-session-launcher"
click node_deletion "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/tree/main/server/forms/data-deletion-tool"
click node_policies "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/tree/main/server/forms/platform"
click node_goal "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/tree/main/server/forms/sentence-plan/effects/goals"
click node_plan "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/tree/main/server/forms/sentence-plan/effects/plan"
click node_assessment_service "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/services/assessmentService.ts"
click node_api_client "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/data/assessmentPlatformApiClient.ts"
click node_cache "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/data/assessmentCacheStore.ts"
click node_redis "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/data/redisClient.ts"
click node_coordinator "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/data/coordinatorApiClient.ts"
click node_handover "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/data/handoverApiClient.ts"
click node_delius "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/data/deliusApiClient.ts"
click node_arns "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/data/arnsApiClient.ts"
click node_pdf "https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/data/gotenbergClient.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_express,node_auth,node_session,node_routes,node_formengine toneBlue
class node_sentence,node_access,node_launcher,node_deletion,node_policies,node_goal,node_plan toneAmber
class node_assessment_service,node_api_client,node_cache toneMint
class node_redis,node_aap,node_coordinator,node_handover,node_authservice,node_delius,node_arns,node_pdf toneRose
class node_practitioner toneIndigo
```

## Components

### Web application

- [Express app](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/app.ts): `server/app.ts`
- [Authentication](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/middleware/setUpAuthentication.ts): `server/middleware/setUpAuthentication.ts`
- [Web session](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/middleware/setUpWebSession.ts): `server/middleware/setUpWebSession.ts`
- [HTTP routes](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/routes/index.ts): `server/routes/index.ts`
- **Forge form engine**

### Form journeys

- [Sentence plan](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/tree/main/server/forms/sentence-plan): `server/forms/sentence-plan`
- [Access journey](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/tree/main/server/forms/access): `server/forms/access`
- [Training launcher](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/tree/main/server/forms/training-session-launcher): `server/forms/training-session-launcher`
- [Data deletion](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/tree/main/server/forms/data-deletion-tool): `server/forms/data-deletion-tool`
- [Platform policies](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/tree/main/server/forms/platform): `server/forms/platform`
- [Goal management](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/tree/main/server/forms/sentence-plan/effects/goals): `server/forms/sentence-plan/effects/goals`
- [Plan history](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/tree/main/server/forms/sentence-plan/effects/plan): `server/forms/sentence-plan/effects/plan`

### Assessment services

- [Assessment service](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/services/assessmentService.ts): `server/services/assessmentService.ts`
- [AAP API client](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/data/assessmentPlatformApiClient.ts): `server/data/assessmentPlatformApiClient.ts`
- [Assessment cache](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/data/assessmentCacheStore.ts): `server/data/assessmentCacheStore.ts`

### External systems

- [Redis](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/data/redisClient.ts): `server/data/redisClient.ts`
- **AAP datastore API**
- [Coordinator API](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/data/coordinatorApiClient.ts): `server/data/coordinatorApiClient.ts`
- [Handover API](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/data/handoverApiClient.ts): `server/data/handoverApiClient.ts`
- **HMPPS Auth**
- [Delius API](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/data/deliusApiClient.ts): `server/data/deliusApiClient.ts`
- [ARNS API](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/data/arnsApiClient.ts): `server/data/arnsApiClient.ts`
- [PDF renderer](https://github.com/ministryofjustice/hmpps-arns-assessment-platform-ui/blob/main/server/data/gotenbergClient.ts): `server/data/gotenbergClient.ts`

### Other components

- **Practitioner**

## Connections

- Practitioner → Express app: requests (evidence: `server/app.ts`)
- Express app → Authentication: installs middleware (evidence: `server/app.ts`)
- Express app → Web session: installs middleware (evidence: `server/app.ts`)
- Express app → HTTP routes: mounts routes (evidence: `server/app.ts`)
- Express app → Forge form engine: creates router (evidence: `server/app.ts`)
- Forge form engine → Sentence plan: registers package
- Forge form engine → Access journey: registers package
- Forge form engine → Training launcher: registers package
- Forge form engine → Data deletion: registers package
- Forge form engine → Platform policies: registers package
- Sentence plan → Goal management: uses effects
- Sentence plan → Plan history: uses effects
- Assessment service → AAP API client: executes commands (evidence: `server/services/assessmentService.ts`)
- Assessment service → AAP API client: executes queries (evidence: `server/services/assessmentService.ts`)
- AAP API client → Assessment cache: reads cache (evidence: `server/data/assessmentPlatformApiClient.ts`)
- Assessment cache → Redis: uses store (evidence: `server/data/assessmentCacheStore.ts`)
- AAP API client → AAP datastore API: sends API requests (evidence: `server/data/assessmentPlatformApiClient.ts`)
- Express app → Assessment service: provides journeys
- Authentication → HMPPS Auth: authenticates (evidence: `server/middleware/setUpAuthentication.ts`)
- Training launcher → Coordinator API: creates or merges sessions (evidence: `server/forms/training-session-launcher/flags/handlers.ts`)
- Training launcher → Handover API: prepares handover
- Express app → Delius API: checks authorization (evidence: `server/app.ts`)
- Express app → ARNS API: uses service
- Express app → PDF renderer: serves PDF
- Data deletion → AAP API client: creates API client (evidence: `server/forms/data-deletion-tool/effects/api/createApiClient.ts`)
