# paulbraganza12/iban-validator architecture

> Architecture diagram of the GitHub repository paulbraganza12/iban-validator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/paulbraganza12/iban-validator
- Repository: https://github.com/paulbraganza12/iban-validator

## Overview

##### Project type and purpose
- From the file tree and README, this is a full-stack IBAN-validation Single-Page Application (SPA) built with Create React App (TypeScript) on the frontend, accompanied by a backend (in the `go/` directory or via Ruby Rake scripts) that actually performs the IBAN-validation logic.
- The UI offers input components (`Validation` and `ValidationList`), uses reusable hooks (`useIban`, `useIbanValidation`), and defines two service layers (`ValidationViewModelService` for transforming data for the view, and `ValidationApiService` for HTTP calls). Extensive testing is in place: Jest for unit tests and Cypress for end-to-end “journey” tests.

##### File structure
- Top level:
- Dot files (ESLint, Prettier, tool-versions, envrc) and `package.json`/`Gemfile` (Node & Ruby toolchain)
- `public/` – static assets for CRA
- `src/` – React components, hooks, services, styles, tests
- `go/` – Go backend (presumed BFF/microservice)
- `rake/` + `Rakefile` – Ruby-based build or orchestration scripts
- In `src/` you see logical separation:
- `components/` – presentational components
- `hooks/` – domain-specific hooks (IBAN input, async validation)
- `service/` – two layers: API client and ViewModel service
- `__test__/unit/` – Jest unit tests exercising those services
- `__test__/journey/` – Cypress tests driving the full stack (with fakes in `support/arrangments/bff-responses.ts`)

##### Detail without over-splitting
- Every distinct piece: components vs. hooks vs. services
- External dependencies (ESLint, Prettier, CI scripts) in a supporting-tools section

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Tier
    Browser["Browser"]:::browser

    %% SPA Layer
    subgraph "SPA (React App)"
        subgraph "Entry & Static Assets"
            Entry["public/, src/index.tsx, src/index.css, src/App.tsx, src/App.css"]:::frontend
        end
        subgraph "UI Components"
            CompIn["Validation Input"]:::frontend
            CompList["Validation List"]:::frontend
        end
        subgraph "Domain Hooks & Logic"
            HookIban["useIban"]:::logic
            HookValidate["useIbanValidation"]:::logic
        end
        subgraph "Service Layer"
            VMService["ValidationViewModelService"]:::service
            APIService["ValidationApiService"]:::service
        end
    end

    %% API Tier
    subgraph "API Tier"
        GoService["Go BFF / Microservice"]:::backend
        Rake["Rake Tasks & Env"]:::backend
    end

    %% Data Tier
    subgraph "Data Tier"
        ExternalData["External IBAN Data Source"]:::data
    end

    %% Tests & CI
    subgraph "Tests & CI"
        Unit["Jest Unit Tests"]:::test
        E2E["Cypress E2E Tests"]:::test
    end

    %% Interactions
    Browser -->|"loads SPA"| Entry
    CompIn ---|"uses"| HookIban
    CompIn ---|"uses"| HookValidate
    CompList ---|"uses"| HookValidate
    HookIban -->|"manages input state"| VMService
    HookValidate -->|"triggers validation"| VMService
    VMService -->|"transforms data"| APIService
    APIService -->|"POST /validate { iban }"| GoService
    GoService -->|"validates or forwards"| ExternalData
    ExternalData -->|"valid: boolean"| GoService
    GoService -->|"200 { valid }"| APIService
    APIService -->|"resolves promise"| VMService
    VMService -->|"updates UI model"| HookValidate
    HookValidate -->|"provides result"| CompIn
    HookValidate -->|"provides result"| CompList

    Unit -.->|"unit tests on"| VMService
    Unit -.->|"unit tests on"| APIService
    E2E -.->|"drives UI"| Browser
    E2E -.->|"stubs responses"| GoService

    %% Click Events
    click Entry "https://github.com/paulbraganza12/iban-validator/tree/main/public/"
    click CompIn "https://github.com/paulbraganza12/iban-validator/blob/main/src/components/Validation/validation.tsx"
    click CompList "https://github.com/paulbraganza12/iban-validator/blob/main/src/components/ValidationList/validation-list.tsx"
    click HookIban "https://github.com/paulbraganza12/iban-validator/blob/main/src/hooks/useIban.ts"
    click HookValidate "https://github.com/paulbraganza12/iban-validator/blob/main/src/hooks/useIbanValidation.ts"
    click VMService "https://github.com/paulbraganza12/iban-validator/blob/main/src/service/ValidationViewModelService.ts"
    click APIService "https://github.com/paulbraganza12/iban-validator/blob/main/src/service/ValidationApiService.ts"
    click GoService "https://github.com/paulbraganza12/iban-validator/tree/main/go/"
    click Rake "https://github.com/paulbraganza12/iban-validator/tree/main/Rakefile"
    click Unit "https://github.com/paulbraganza12/iban-validator/blob/main/src/__test__/unit/ValidationApiService.test.ts"
    click E2E "https://github.com/paulbraganza12/iban-validator/tree/main/src/__test__/journey/"

    %% Styles
    classDef browser fill:#e0f7fa,stroke:#006064,color:#006064;
    classDef frontend fill:#bbdefb,stroke:#0d47a1,color:#0d47a1;
    classDef logic fill:#b3e5fc,stroke:#01579b,color:#01579b;
    classDef service fill:#c8e6c9,stroke:#1b5e20,color:#1b5e20;
    classDef backend fill:#c8e6c9,stroke:#2e7d32,color:#2e7d32;
    classDef data fill:#ffe0b2,stroke:#ef6c00,color:#e65100;
    classDef test fill:#e1bee7,stroke:#6a1b9a,color:#4a148c;
```
