# hmrc/eori-common-component-registration-frontend architecture

> Architecture diagram of the GitHub repository hmrc/eori-common-component-registration-frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hmrc/eori-common-component-registration-frontend
- Repository: https://github.com/hmrc/eori-common-component-registration-frontend

## Overview

##### Project Type and Purpose
- This is a web‑based frontend application (Scala + Play Framework) for the EORI Common Component Registration journey.
- It provides the UI, controllers, forms and views, and orchestrates calls to various downstream microservices (identity, subscription, data store, email verification, etc.).

##### Key Directories (Architectural Layers)
- app/assets: static assets (CSS, JS, templates).
- app/uk/gov/hmrc/eoricommoncomponent/frontend:
- controllers – Play MVC Controllers (HTTP entry points).
- services – Business logic layer (service façade, flow management, caching).
- connector – HTTP clients to external downstream services.
- views – Twirl templates assembling the HTML.
- config/filters – routing, auth, and global filters.
- modules – Guice modules for wiring dependencies (DI).
- conf: Play configuration (application.conf, routes, logging).
- bin: operational scripts (run, test, coverage).
- public/api: API definitions (OpenAPI JSON and docs).
- test: unit & integration tests, organized by layer (controllers, services, connectors, domain, views, end‑to‑end).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "UI Layer" 
        style UI fill:#AED6F1,stroke:#2E86C1,stroke-width:2px
        Browser["Client Browser"] 
        StaticAssets["Static Assets"] 
    end

    %% Controller Layer
    subgraph "Controller Layer"
        style ControllerLayer fill:#ABEBC6,stroke:#27AE60,stroke-width:2px
        Router["HTTP Router (conf/routes)"] 
        Filters["Filters (auth, session)"] 
        Controllers["Controllers"] 
        AuthControllers["Auth Controllers & Actions"] 
        EmailControllers["Email Journey Controllers"] 
        NonProdControllers["Non‑Prod/Test Controllers"] 
    end

    %% Service Layer
    subgraph "Service Layer"
        style ServiceLayer fill:#ABEBC6,stroke:#27AE60,stroke-width:2px
        Services["Business Services"] 
        SessionCache["SessionCacheService & FlowManager"] 
    end

    %% Connector Layer
    subgraph "Connector Layer"
        style ConnectorLayer fill:#ABEBC6,stroke:#27AE60,stroke-width:2px
        Connectors["HTTP Connectors"] 
        HTTPParsers["HTTP Parsers"] 
    end

    %% Domain & Views
    subgraph "Domain & Views"
        style DomainViews fill:#AED6F1,stroke:#2E86C1,stroke-width:2px
        DomainModels["Domain Models & Forms"] 
        Views["Twirl Views"] 
        ViewHelpers["View Helpers"] 
    end

    %% Config & DI
    subgraph "Config & DI"
        style ConfigDI fill:#D7BDE2,stroke:#8E44AD,stroke-width:2px
        AppConfig["AppConfig"] 
        ServiceConfig["ServiceConfig"] 
        ModuleConfig["Guice Modules"] 
        ErrorHandler["ApplicationLoader & ErrorHandler"] 
    end

    %% External Services
    subgraph "External Services"
        style External fill:#F5CBA7,stroke:#D35400,stroke-width:2px
        AddrAPI["Address Lookup API"] 
        EmailVerif["Email Verification Service"] 
        EnrolmentStore["Enrolment Store Proxy"] 
        MatchingService["Matching Service"] 
        SubscriptionAPI["Subscription Service"] 
        DataStore["Customs Data Store"] 
        TaxEnrolments["Tax Enrolments"] 
        VATControl["VAT Control List"] 
        AuthIdentity["Internal Auth & Identity"] 
    end

    %% Testing & Others
    subgraph "Other"
        style Other fill:#D5DBDB,stroke:#616A6B,stroke-width:2px
        APIDefs["Public API Definitions"] 
        Scripts["Operational Scripts"] 
        WireMock["WireMock Stubs & Tests"] 
    end

    %% Flow
    Browser -->|"GET HTML/CSS/JS"| StaticAssets
    Browser -->|"HTTP Request"| Router
    StaticAssets --> Router
    Router -->|"apply filters"| Filters
    Filters --> Controllers
    Controllers --> AuthControllers
    Controllers --> EmailControllers
    Controllers --> NonProdControllers
    Controllers --> Services
    Services --> SessionCache
    SessionCache --> Services
    Services --> Connectors
    Connectors --> HTTPParsers
    Connectors --> AddrAPI
    Connectors --> EmailVerif
    Connectors --> EnrolmentStore
    Connectors --> MatchingService
    Connectors --> SubscriptionAPI
    Connectors --> DataStore
    Connectors --> TaxEnrolments
    Connectors --> VATControl
    Connectors --> AuthIdentity
    AddrAPI --> Connectors
    EmailVerif --> Connectors
    EnrolmentStore --> Connectors
    MatchingService --> Connectors
    SubscriptionAPI --> Connectors
    DataStore --> Connectors
    TaxEnrolments --> Connectors
    VATControl --> Connectors
    AuthIdentity --> Connectors
    Connectors --> Services
    Services --> Controllers
    Controllers --> DomainModels
    Controllers --> Views
    Views --> ViewHelpers
    Views --> Browser
    ConfigDI --> Router
    ConfigDI --> Filters
    ConfigDI --> Controllers
    ConfigDI --> Services
    ConfigDI --> Connectors
    ConfigDI --> ErrorHandler
    Other --> ConfigDI
    Other --> WireMock

    %% Click Events
    click StaticAssets "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/app/assets"
    click Router "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/conf/routes"
    click Filters "https://github.com/hmrc/eori-common-component-registration-frontend/blob/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/filters/Filters.scala"
    click Filters "https://github.com/hmrc/eori-common-component-registration-frontend/blob/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/filters/RouteFilter.scala"
    click Controllers "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/controllers"
    click AuthControllers "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/controllers/auth"
    click EmailControllers "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/controllers/email"
    click NonProdControllers "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/controllers/nonProd"
    click Services "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/services"
    click SessionCache "https://github.com/hmrc/eori-common-component-registration-frontend/blob/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/services/cache/SessionCacheService.scala"
    click SessionCache "https://github.com/hmrc/eori-common-component-registration-frontend/blob/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/services/cache/ClearCacheAndRegistrationIdentificationService.scala"
    click SessionCache "https://github.com/hmrc/eori-common-component-registration-frontend/blob/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/controllers/SubscriptionFlowManager.scala"
    click Connectors "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/connector"
    click HTTPParsers "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/connector/httpparsers"
    click DomainModels "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/domain"
    click DomainModels "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/forms"
    click DomainModels "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/forms/models"
    click DomainModels "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/viewModels"
    click Views "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/views"
    click ViewHelpers "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/views/helpers"
    click AppConfig "https://github.com/hmrc/eori-common-component-registration-frontend/blob/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/config/AppConfig.scala"
    click ServiceConfig "https://github.com/hmrc/eori-common-component-registration-frontend/blob/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/config/ServiceConfig.scala"
    click ModuleConfig "https://github.com/hmrc/eori-common-component-registration-frontend/blob/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/config/Module.scala"
    click ModuleConfig "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/modules"
    click ErrorHandler "https://github.com/hmrc/eori-common-component-registration-frontend/blob/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/CdsErrorHandler.scala"
    click ErrorHandler "https://github.com/hmrc/eori-common-component-registration-frontend/blob/main/app/uk/gov/hmrc/eoricommoncomponent/frontend/ApplicationLoader.scala"
    click APIDefs "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/public/api"
    click Scripts "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/bin/"
    click WireMock "https://github.com/hmrc/eori-common-component-registration-frontend/tree/main/test/util/externalservices"

    %% Styles
    classDef ui fill:#AED6F1,stroke:#2E86C1
    classDef core fill:#ABEBC6,stroke:#27AE60
    classDef ext fill:#F5CBA7,stroke:#D35400
    classDef config fill:#D7BDE2,stroke:#8E44AD
    classDef other fill:#D5DBDB,stroke:#616A6B

    class Browser,StaticAssets,DomainModels,Views,ViewHelpers ui
    class Router,Filters,Controllers,AuthControllers,EmailControllers,NonProdControllers,Services,SessionCache,Connectors,HTTPParsers core
    class AddrAPI,EmailVerif,EnrolmentStore,MatchingService,SubscriptionAPI,DataStore,TaxEnrolments,VATControl,AuthIdentity ext
    class AppConfig,ServiceConfig,ModuleConfig,ErrorHandler config
    class APIDefs,Scripts,WireMock other
```
