# mdomke/schwifty architecture

> Architecture diagram of the GitHub repository mdomke/schwifty, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mdomke/schwifty
- Repository: https://github.com/mdomke/schwifty
- Video tour (about a minute): https://gitdiagram.com/mdomke/schwifty/video

## Overview

schwifty is a Python library for parsing, validating, generating, and looking up IBANs and BICs. The main workflow constructs an IBAN, derives its BBAN, and validates its country-specific structure and checksum; generation builds a BBAN before forming an IBAN. BIC operations validate codes or look up candidates through the bank registry. The graph reflects documented capabilities, but unsampled implementation details and registry data files are not represented.

Main entry points: [`schwifty/iban.py`](https://github.com/mdomke/schwifty/blob/main/schwifty/iban.py) (IBAN operations), [`schwifty/bban.py`](https://github.com/mdomke/schwifty/blob/main/schwifty/bban.py) (BBAN operations), [`schwifty/bic.py`](https://github.com/mdomke/schwifty/blob/main/schwifty/bic.py) (BIC operations), [`schwifty/checksum/__init__.py`](https://github.com/mdomke/schwifty/blob/main/schwifty/checksum/__init__.py) (Checksum framework)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Public code API"]
  node_iban["IBAN operations<br/>[iban.py]"]
  node_bic["BIC operations<br/>[bic.py]"]
  node_exceptions["Validation errors<br/>[exceptions.py]"]
end

subgraph group_account["Account formats"]
  node_bban["BBAN operations<br/>[bban.py]"]
  node_common["Code normalization<br/>[common.py]"]
  node_domain["Format definitions<br/>[domain.py]"]
end

subgraph group_validation["Validation algorithms"]
  node_checksum["Checksum framework<br/>[__init__.py]"]
  node_country_checksums["Country checksum rules"]
end

subgraph group_lookup["Registry lookup"]
  node_registry[("Bank and format registry<br/>[registry.py]")]
  node_country_data["Country metadata"]
end

node_consumer(("Library user"))

node_consumer -->|"constructs or generates"| node_iban
node_consumer -->|"constructs or looks up"| node_bic
node_iban -->|"creates and validates"| node_bban
node_iban -->|"reads format specs"| node_registry
node_iban -->|"validates IBAN digits"| node_checksum
node_iban -->|"looks up country"| node_country_data
node_bic -->|"looks up banks"| node_registry
node_bic -->|"validates country"| node_country_data
node_bban -->|"reads specs and banks"| node_registry
node_bban -->|"normalizes components"| node_common
node_bban -->|"computes national checksum"| node_checksum
node_bban -->|"uses components and ranges"| node_domain
node_checksum -->|"loads algorithms"| node_country_checksums
node_iban -->|"raises validation errors"| node_exceptions
node_bic -->|"raises validation errors"| node_exceptions
node_bban -->|"raises generation errors"| node_exceptions

click node_iban "https://github.com/mdomke/schwifty/blob/main/schwifty/iban.py"
click node_bic "https://github.com/mdomke/schwifty/blob/main/schwifty/bic.py"
click node_bban "https://github.com/mdomke/schwifty/blob/main/schwifty/bban.py"
click node_common "https://github.com/mdomke/schwifty/blob/main/schwifty/common.py"
click node_domain "https://github.com/mdomke/schwifty/blob/main/schwifty/domain.py"
click node_registry "https://github.com/mdomke/schwifty/blob/main/schwifty/registry.py"
click node_checksum "https://github.com/mdomke/schwifty/blob/main/schwifty/checksum/__init__.py"
click node_country_checksums "https://github.com/mdomke/schwifty/tree/main/schwifty/checksum"
click node_exceptions "https://github.com/mdomke/schwifty/blob/main/schwifty/exceptions.py"

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_iban,node_bic,node_exceptions,node_consumer toneBlue
class node_bban,node_common,node_domain toneAmber
class node_checksum,node_country_checksums toneMint
class node_registry,node_country_data toneRose
```

## Components

### Public code API

- [IBAN operations](https://github.com/mdomke/schwifty/blob/main/schwifty/iban.py): `schwifty/iban.py`
- [BIC operations](https://github.com/mdomke/schwifty/blob/main/schwifty/bic.py): `schwifty/bic.py`
- [Validation errors](https://github.com/mdomke/schwifty/blob/main/schwifty/exceptions.py): `schwifty/exceptions.py`

### Account formats

- [BBAN operations](https://github.com/mdomke/schwifty/blob/main/schwifty/bban.py): `schwifty/bban.py`
- [Code normalization](https://github.com/mdomke/schwifty/blob/main/schwifty/common.py): `schwifty/common.py`
- [Format definitions](https://github.com/mdomke/schwifty/blob/main/schwifty/domain.py): `schwifty/domain.py`

### Validation algorithms

- [Checksum framework](https://github.com/mdomke/schwifty/blob/main/schwifty/checksum/__init__.py): `schwifty/checksum/__init__.py`
- [Country checksum rules](https://github.com/mdomke/schwifty/tree/main/schwifty/checksum): `schwifty/checksum`

### Registry lookup

- [Bank and format registry](https://github.com/mdomke/schwifty/blob/main/schwifty/registry.py): `schwifty/registry.py`
- **Country metadata**

### Other components

- **Library user**

## Connections

- Library user → IBAN operations: constructs or generates
- Library user → BIC operations: constructs or looks up
- IBAN operations → BBAN operations: creates and validates
- IBAN operations → Bank and format registry: reads format specs
- IBAN operations → Checksum framework: validates IBAN digits
- IBAN operations → Country metadata: looks up country
- BIC operations → Bank and format registry: looks up banks
- BIC operations → Country metadata: validates country
- BBAN operations → Bank and format registry: reads specs and banks
- BBAN operations → Code normalization: normalizes components
- BBAN operations → Checksum framework: computes national checksum
- BBAN operations → Format definitions: uses components and ranges
- Checksum framework → Country checksum rules: loads algorithms
- IBAN operations → Validation errors: raises validation errors
- BIC operations → Validation errors: raises validation errors
- BBAN operations → Validation errors: raises generation errors
