# hmrc/manage-pensions-frontend architecture

> Architecture diagram of the GitHub repository hmrc/manage-pensions-frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hmrc/manage-pensions-frontend
- Repository: https://github.com/hmrc/manage-pensions-frontend

## Overview

Manage Pensions Frontend is a Play/Scala service for pension scheme administrators (PSAs) and practitioners (PSPs). Users authenticate, choose a role or service, then manage schemes or complete invitation, removal and deauthorisation journeys; the frontend also redirects users to registration, scheme-editing and AFT services. Controllers and actions provide the request flow, while connectors call backend services and cache user answers. The graph combines sampled implementation references with README-documented capabilities and integrations; unsampled journey internals are represented only at their supported directory level.

Main entry points: [`app/controllers/actions/DataRetrievalAction.scala`](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/actions/DataRetrievalAction.scala) (Load answers), [`app/services/PsaSchemeDashboardService.scala`](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/services/PsaSchemeDashboardService.scala) (Dashboard assembly), [`app/controllers/actions/AuthAction.scala`](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/actions/AuthAction.scala) (Authentication), [`app/connectors/scheme/ListOfSchemesConnector.scala`](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/connectors/scheme/ListOfSchemesConnector.scala) (Scheme lists)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and session"]
  node_auth["Authentication<br/>[AuthAction.scala]"]
  node_data_retrieval["Load answers"]
  node_retrievals["Answer retrieval<br/>[Retrievals.scala]"]
  node_session_expired["Session recovery"]
  node_data_request["Data request<br/>[DataRequest.scala]"]
  node_data_required["Require answers"]
  node_psa_scheme_auth["Scheme authorization"]
end

subgraph group_scheme["Scheme management"]
  node_administrator_dashboard["PSA dashboards"]
  node_practitioner_dashboard["PSP dashboards"]
  node_dashboard_service["Dashboard assembly"]
  node_scheme_list["Scheme lists"]
  node_scheme_details["Scheme details"]
  node_scheme_model["Scheme list model"]
  node_srn_model["Scheme reference"]
end

subgraph group_journeys["Pension journeys"]
  node_triage["Service triage"]
  node_invitations["Invitation journeys"]
  node_removal["PSA removal"]
  node_deauthorisation["PSP deauthorisation"]
  node_aft["AFT journeys"]
  node_email_response["Email responses"]
end

subgraph group_integration["Integrations and state"]
  node_answers["User answers<br/>[UserAnswers.scala]"]
  node_answer_cache["Answers cache"]
  node_scheme_backend["Pensions Scheme"]
  node_admin_connector["Administrator details"]
  node_admin_backend["Pension Administrator"]
  node_redirect_services["Registration and editing"]
  node_audit["Audit events<br/>[AuditService.scala]"]
  node_config["Service configuration"]
  node_minimal_model["Minimal user model"]
end

node_user(("PSA / PSP"))

node_user -->|"authenticates"| node_auth
node_auth -->|"transforms request"| node_data_retrieval
node_data_retrieval -->|"fetches answers"| node_answer_cache
node_data_retrieval -->|"wraps JSON"| node_answers
node_answers -->|"supplies answers"| node_retrievals
node_retrievals -->|"redirects missing data"| node_session_expired
node_auth -->|"loads role choice"| node_answer_cache
node_user -->|"selects service"| node_triage
node_user -.->|"opens dashboard"| node_administrator_dashboard
node_user -.->|"opens dashboard"| node_practitioner_dashboard
node_administrator_dashboard -->|"builds view"| node_dashboard_service
node_practitioner_dashboard -->|"uses dashboard data"| node_dashboard_service
node_dashboard_service -->|"loads schemes"| node_scheme_list
node_dashboard_service -->|"loads scheme details"| node_scheme_details
node_scheme_list -.->|"requests scheme list"| node_scheme_backend
node_scheme_details -.->|"requests scheme details"| node_scheme_backend
node_scheme_list -.->|"decodes response"| node_scheme_model
node_scheme_details -.->|"uses scheme reference"| node_srn_model
node_admin_connector -->|"requests minimal details"| node_admin_backend
node_admin_connector -.->|"decodes response"| node_minimal_model
node_user -.->|"invites or accepts"| node_invitations
node_invitations -.->|"submits invitations"| node_admin_backend
node_user -.->|"removes administrator"| node_removal
node_removal -.->|"removes association"| node_admin_backend
node_user -.->|"deauthorises practitioner"| node_deauthorisation
node_deauthorisation -->|"sends audit event"| node_audit
node_email_response -->|"sends email event"| node_audit
node_user -.->|"starts or amends return"| node_aft
node_user -.->|"starts registration or editing"| node_redirect_services
node_config -->|"configures destinations"| node_redirect_services
node_data_retrieval -.->|"creates request data"| node_data_request
node_data_required -.->|"requires data"| node_data_request
node_psa_scheme_auth -.->|"authorizes scheme access"| node_user

click node_auth "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/actions/AuthAction.scala"
click node_data_retrieval "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/actions/DataRetrievalAction.scala"
click node_answers "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/utils/UserAnswers.scala"
click node_answer_cache "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/connectors/UserAnswersCacheConnector.scala"
click node_retrievals "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/Retrievals.scala"
click node_session_expired "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/SessionExpiredController.scala"
click node_triage "https://github.com/hmrc/manage-pensions-frontend/tree/main/app/controllers/triagev2"
click node_administrator_dashboard "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/psa/PsaSchemeDashboardController.scala"
click node_practitioner_dashboard "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/psp/PspSchemeDashboardController.scala"
click node_dashboard_service "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/services/PsaSchemeDashboardService.scala"
click node_scheme_list "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/connectors/scheme/ListOfSchemesConnector.scala"
click node_scheme_details "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/connectors/scheme/SchemeDetailsConnector.scala"
click node_admin_connector "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/connectors/admin/MinimalConnector.scala"
click node_invitations "https://github.com/hmrc/manage-pensions-frontend/tree/main/app/controllers/invitations"
click node_removal "https://github.com/hmrc/manage-pensions-frontend/tree/main/app/controllers/psa/remove"
click node_deauthorisation "https://github.com/hmrc/manage-pensions-frontend/tree/main/app/controllers/psp/deauthorise"
click node_aft "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/connectors/PensionSchemeReturnConnector.scala"
click node_audit "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/audit/AuditService.scala"
click node_email_response "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/EmailResponseController.scala"
click node_config "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/config/FrontendAppConfig.scala"
click node_scheme_model "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/models/ListOfSchemes.scala"
click node_minimal_model "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/models/MinimalPSAPSP.scala"
click node_srn_model "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/models/SchemeReferenceNumber.scala"
click node_data_request "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/models/requests/DataRequest.scala"
click node_data_required "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/actions/DataRequiredAction.scala"
click node_psa_scheme_auth "https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/actions/PsaSchemeAuthAction.scala"

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_auth,node_data_retrieval,node_retrievals,node_session_expired,node_data_request,node_data_required,node_psa_scheme_auth toneBlue
class node_administrator_dashboard,node_practitioner_dashboard,node_dashboard_service,node_scheme_list,node_scheme_details,node_scheme_model,node_srn_model toneAmber
class node_triage,node_invitations,node_removal,node_deauthorisation,node_aft,node_email_response toneMint
class node_answers,node_answer_cache,node_scheme_backend,node_admin_connector,node_admin_backend,node_redirect_services,node_audit,node_config,node_minimal_model toneRose
class node_user toneIndigo
```

## Components

### Access and session

- [Authentication](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/actions/AuthAction.scala): `app/controllers/actions/AuthAction.scala`
- [Load answers](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/actions/DataRetrievalAction.scala): `app/controllers/actions/DataRetrievalAction.scala`
- [Answer retrieval](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/Retrievals.scala): `app/controllers/Retrievals.scala`
- [Session recovery](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/SessionExpiredController.scala): `app/controllers/SessionExpiredController.scala`
- [Data request](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/models/requests/DataRequest.scala): `app/models/requests/DataRequest.scala`
- [Require answers](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/actions/DataRequiredAction.scala): `app/controllers/actions/DataRequiredAction.scala`
- [Scheme authorization](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/actions/PsaSchemeAuthAction.scala): `app/controllers/actions/PsaSchemeAuthAction.scala`

### Scheme management

- [PSA dashboards](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/psa/PsaSchemeDashboardController.scala): `app/controllers/psa/PsaSchemeDashboardController.scala`
- [PSP dashboards](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/psp/PspSchemeDashboardController.scala): `app/controllers/psp/PspSchemeDashboardController.scala`
- [Dashboard assembly](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/services/PsaSchemeDashboardService.scala): `app/services/PsaSchemeDashboardService.scala`
- [Scheme lists](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/connectors/scheme/ListOfSchemesConnector.scala): `app/connectors/scheme/ListOfSchemesConnector.scala`
- [Scheme details](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/connectors/scheme/SchemeDetailsConnector.scala): `app/connectors/scheme/SchemeDetailsConnector.scala`
- [Scheme list model](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/models/ListOfSchemes.scala): `app/models/ListOfSchemes.scala`
- [Scheme reference](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/models/SchemeReferenceNumber.scala): `app/models/SchemeReferenceNumber.scala`

### Pension journeys

- [Service triage](https://github.com/hmrc/manage-pensions-frontend/tree/main/app/controllers/triagev2): `app/controllers/triagev2`
- [Invitation journeys](https://github.com/hmrc/manage-pensions-frontend/tree/main/app/controllers/invitations): `app/controllers/invitations`
- [PSA removal](https://github.com/hmrc/manage-pensions-frontend/tree/main/app/controllers/psa/remove): `app/controllers/psa/remove`
- [PSP deauthorisation](https://github.com/hmrc/manage-pensions-frontend/tree/main/app/controllers/psp/deauthorise): `app/controllers/psp/deauthorise`
- [AFT journeys](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/connectors/PensionSchemeReturnConnector.scala): `app/connectors/PensionSchemeReturnConnector.scala`
- [Email responses](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/controllers/EmailResponseController.scala): `app/controllers/EmailResponseController.scala`

### Integrations and state

- [User answers](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/utils/UserAnswers.scala): `app/utils/UserAnswers.scala`
- [Answers cache](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/connectors/UserAnswersCacheConnector.scala): `app/connectors/UserAnswersCacheConnector.scala`
- **Pensions Scheme**
- [Administrator details](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/connectors/admin/MinimalConnector.scala): `app/connectors/admin/MinimalConnector.scala`
- **Pension Administrator**
- **Registration and editing**
- [Audit events](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/audit/AuditService.scala): `app/audit/AuditService.scala`
- [Service configuration](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/config/FrontendAppConfig.scala): `app/config/FrontendAppConfig.scala`
- [Minimal user model](https://github.com/hmrc/manage-pensions-frontend/blob/main/app/models/MinimalPSAPSP.scala): `app/models/MinimalPSAPSP.scala`

### Other components

- **PSA / PSP**

## Connections

- PSA / PSP → Authentication: authenticates (evidence: `app/controllers/actions/AuthAction.scala`)
- Authentication → Load answers: transforms request (evidence: `app/controllers/actions/DataRetrievalAction.scala`)
- Load answers → Answers cache: fetches answers (evidence: `app/controllers/actions/DataRetrievalAction.scala`)
- Load answers → User answers: wraps JSON (evidence: `app/controllers/actions/DataRetrievalAction.scala`)
- User answers → Answer retrieval: supplies answers (evidence: `app/controllers/Retrievals.scala`)
- Answer retrieval → Session recovery: redirects missing data (evidence: `app/controllers/Retrievals.scala`)
- Authentication → Answers cache: loads role choice (evidence: `app/controllers/actions/AuthAction.scala`)
- PSA / PSP → Service triage: selects service (evidence: `app/controllers/triagev2/WhichServiceYouWantToViewController.scala`)
- PSA / PSP → PSA dashboards: opens dashboard
- PSA / PSP → PSP dashboards: opens dashboard
- PSA dashboards → Dashboard assembly: builds view (evidence: `app/controllers/psa/PsaSchemeDashboardController.scala`)
- PSP dashboards → Dashboard assembly: uses dashboard data (evidence: `app/controllers/psp/PspSchemeDashboardController.scala`)
- Dashboard assembly → Scheme lists: loads schemes (evidence: `app/services/PsaSchemeDashboardService.scala`)
- Dashboard assembly → Scheme details: loads scheme details (evidence: `app/services/PsaSchemeDashboardService.scala`)
- Scheme lists → Pensions Scheme: requests scheme list
- Scheme details → Pensions Scheme: requests scheme details
- Scheme lists → Scheme list model: decodes response (evidence: `app/connectors/scheme/ListOfSchemesConnector.scala`)
- Scheme details → Scheme reference: uses scheme reference (evidence: `app/services/PsaSchemeDashboardService.scala`)
- Administrator details → Pension Administrator: requests minimal details (evidence: `app/connectors/admin/MinimalConnector.scala`)
- Administrator details → Minimal user model: decodes response (evidence: `app/connectors/admin/MinimalConnector.scala`)
- PSA / PSP → Invitation journeys: invites or accepts
- Invitation journeys → Pension Administrator: submits invitations
- PSA / PSP → PSA removal: removes administrator
- PSA removal → Pension Administrator: removes association
- PSA / PSP → PSP deauthorisation: deauthorises practitioner
- PSP deauthorisation → Audit events: sends audit event (evidence: `app/controllers/psp/deauthorise/PsaDeauthPspDeclarationController.scala`)
- Email responses → Audit events: sends email event (evidence: `app/controllers/EmailResponseController.scala`)
- PSA / PSP → AFT journeys: starts or amends return
- PSA / PSP → Registration and editing: starts registration or editing
- Service configuration → Registration and editing: configures destinations (evidence: `app/config/FrontendAppConfig.scala`)
- Load answers → Data request: creates request data (evidence: `app/controllers/actions/DataRetrievalAction.scala`)
- Require answers → Data request: requires data (evidence: `app/controllers/actions/DataRequiredAction.scala`)
- Scheme authorization → PSA / PSP: authorizes scheme access (evidence: `app/controllers/actions/PsaSchemeAuthAction.scala`)
