# bengornadha/lamalice-clean-archi architecture

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

- Interactive diagram: https://gitdiagram.com/bengornadha/lamalice-clean-archi
- Repository: https://github.com/bengornadha/lamalice-clean-archi

## Overview

This is a Clean Architecture example for registering users. The main workflow builds a validator, password hasher, serializer, and repository; registration validates input, hashes the password, creates a user, and saves it. The example then fetches the user to verify persistence. The graph includes the documented BigQuery and S3 repository alternatives; only BigQuery’s storage interaction is visible in the supplied excerpt. Other links are limited to relationships shown by excerpts or the source index.

Main entry points: [`application/register_user.py`](https://github.com/bengornadha/lamalice-clean-archi/blob/main/application/register_user.py) (Register user), [`domain/services/user_validator.py`](https://github.com/bengornadha/lamalice-clean-archi/blob/main/domain/services/user_validator.py) (User validator), [`main.py`](https://github.com/bengornadha/lamalice-clean-archi/blob/main/main.py) (Example runner), [`infrastructures/serializers/user_serializer.py`](https://github.com/bengornadha/lamalice-clean-archi/blob/main/infrastructures/serializers/user_serializer.py) (User serializer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_standard["Example runner<br/>[main.py]"]
  node_di_entry["DI runner"]
  node_input["User input<br/>[user_input.py]"]
end

subgraph group_domain["Registration domain"]
  node_register["Register user<br/>[register_user.py]"]
  node_user_validator["User validator<br/>[user_validator.py]"]
  node_password_validator["Password validator"]
  node_user["Registered user<br/>[user.py]"]
  node_email["Email value<br/>[email.py]"]
  node_user_error["User not found<br/>[user.py]"]
end

subgraph group_contracts["Interfaces"]
  node_password_hasher_contract["Hasher contract<br/>[password_hasher.py]"]
  node_repository_contract["Repository contract<br/>[user_repository.py]"]
  node_serializer_contract["Serializer contract<br/>[user_serializer.py]"]
  node_validator_contract["Validator contracts<br/>[validator.py]"]
end

subgraph group_adapters["Infrastructure adapters"]
  node_bcrypt["Bcrypt hasher<br/>[hashers.py]"]
  node_memory_repo[("In-memory repository<br/>[user_repository.py]")]
  node_bigquery_repo[("BigQuery repository")]
  node_s3_repo[("S3 repository")]
  node_serializer["User serializer<br/>[user_serializer.py]"]
  node_serialized["Serialized user<br/>[user_serialized.py]"]
end

node_caller(("Caller"))
node_bigquery[("BigQuery")]

node_caller -->|"runs"| node_standard
node_caller -->|"runs"| node_di_entry
node_standard -->|"creates"| node_input
node_standard -->|"builds and calls"| node_register
node_standard -->|"configures"| node_user_validator
node_standard -->|"configures"| node_bcrypt
node_standard -->|"configures and fetches"| node_memory_repo
node_standard -->|"configures"| node_serializer
node_di_entry -->|"configures"| node_register
node_di_entry -->|"configures"| node_user_validator
node_register -->|"accepts"| node_input
node_register -->|"validates with"| node_user_validator
node_register -->|"hashes via"| node_password_hasher_contract
node_register -->|"saves via"| node_repository_contract
node_register -->|"creates"| node_user
node_register -->|"constructs"| node_email
node_user_validator -->|"validates"| node_input
node_user_validator -->|"checks existence"| node_repository_contract
node_user_validator -->|"constructs"| node_email
node_user_validator -->|"validates password"| node_password_validator
node_user_validator -->|"implements"| node_validator_contract
node_bcrypt -->|"implements"| node_password_hasher_contract
node_memory_repo -->|"implements"| node_repository_contract
node_bigquery_repo -->|"implements"| node_repository_contract
node_s3_repo -.->|"implements"| node_repository_contract
node_memory_repo -->|"serializes with"| node_serializer
node_memory_repo -->|"stores"| node_serialized
node_memory_repo -->|"raises"| node_user_error
node_bigquery_repo -->|"serializes with"| node_serializer
node_bigquery_repo -->|"constructs"| node_serialized
node_bigquery_repo -->|"queries and inserts"| node_bigquery
node_serializer -->|"implements"| node_serializer_contract
node_serializer -->|"produces and reads"| node_serialized
node_serializer -->|"converts"| node_user
node_user -->|"contains"| node_email

click node_standard "https://github.com/bengornadha/lamalice-clean-archi/blob/main/main.py"
click node_di_entry "https://github.com/bengornadha/lamalice-clean-archi/blob/main/main_injection_dependances.py"
click node_input "https://github.com/bengornadha/lamalice-clean-archi/blob/main/presentation/input/user_input.py"
click node_register "https://github.com/bengornadha/lamalice-clean-archi/blob/main/application/register_user.py"
click node_user_validator "https://github.com/bengornadha/lamalice-clean-archi/blob/main/domain/services/user_validator.py"
click node_password_validator "https://github.com/bengornadha/lamalice-clean-archi/blob/main/domain/services/user_password_validator.py"
click node_user "https://github.com/bengornadha/lamalice-clean-archi/blob/main/domain/entities/user.py"
click node_email "https://github.com/bengornadha/lamalice-clean-archi/blob/main/domain/value_objects/email.py"
click node_user_error "https://github.com/bengornadha/lamalice-clean-archi/blob/main/domain/exceptions/user.py"
click node_password_hasher_contract "https://github.com/bengornadha/lamalice-clean-archi/blob/main/interfaces/password_hasher.py"
click node_repository_contract "https://github.com/bengornadha/lamalice-clean-archi/blob/main/interfaces/user_repository.py"
click node_serializer_contract "https://github.com/bengornadha/lamalice-clean-archi/blob/main/interfaces/user_serializer.py"
click node_validator_contract "https://github.com/bengornadha/lamalice-clean-archi/blob/main/interfaces/validator/validator.py"
click node_bcrypt "https://github.com/bengornadha/lamalice-clean-archi/blob/main/infrastructures/hashers/hashers.py"
click node_memory_repo "https://github.com/bengornadha/lamalice-clean-archi/blob/main/infrastructures/persistence/user_repository.py"
click node_bigquery_repo "https://github.com/bengornadha/lamalice-clean-archi/blob/main/infrastructures/persistence/user_repository_bigquery.py"
click node_s3_repo "https://github.com/bengornadha/lamalice-clean-archi/blob/main/infrastructures/persistence/user_repository_s3.py"
click node_serializer "https://github.com/bengornadha/lamalice-clean-archi/blob/main/infrastructures/serializers/user_serializer.py"
click node_serialized "https://github.com/bengornadha/lamalice-clean-archi/blob/main/infrastructures/serializers/user_serialized.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_standard,node_di_entry,node_input toneBlue
class node_register,node_user_validator,node_password_validator,node_user,node_email,node_user_error,node_bigquery toneAmber
class node_password_hasher_contract,node_repository_contract,node_serializer_contract,node_validator_contract toneMint
class node_bcrypt,node_memory_repo,node_bigquery_repo,node_s3_repo,node_serializer,node_serialized toneRose
class node_caller toneIndigo
```

## Components

### Entry points

- [Example runner](https://github.com/bengornadha/lamalice-clean-archi/blob/main/main.py): `main.py`
- [DI runner](https://github.com/bengornadha/lamalice-clean-archi/blob/main/main_injection_dependances.py): `main_injection_dependances.py`
- [User input](https://github.com/bengornadha/lamalice-clean-archi/blob/main/presentation/input/user_input.py): `presentation/input/user_input.py`

### Registration domain

- [Register user](https://github.com/bengornadha/lamalice-clean-archi/blob/main/application/register_user.py): `application/register_user.py`
- [User validator](https://github.com/bengornadha/lamalice-clean-archi/blob/main/domain/services/user_validator.py): `domain/services/user_validator.py`
- [Password validator](https://github.com/bengornadha/lamalice-clean-archi/blob/main/domain/services/user_password_validator.py): `domain/services/user_password_validator.py`
- [Registered user](https://github.com/bengornadha/lamalice-clean-archi/blob/main/domain/entities/user.py): `domain/entities/user.py`
- [Email value](https://github.com/bengornadha/lamalice-clean-archi/blob/main/domain/value_objects/email.py): `domain/value_objects/email.py`
- [User not found](https://github.com/bengornadha/lamalice-clean-archi/blob/main/domain/exceptions/user.py): `domain/exceptions/user.py`

### Interfaces

- [Hasher contract](https://github.com/bengornadha/lamalice-clean-archi/blob/main/interfaces/password_hasher.py): `interfaces/password_hasher.py`
- [Repository contract](https://github.com/bengornadha/lamalice-clean-archi/blob/main/interfaces/user_repository.py): `interfaces/user_repository.py`
- [Serializer contract](https://github.com/bengornadha/lamalice-clean-archi/blob/main/interfaces/user_serializer.py): `interfaces/user_serializer.py`
- [Validator contracts](https://github.com/bengornadha/lamalice-clean-archi/blob/main/interfaces/validator/validator.py): `interfaces/validator/validator.py`

### Infrastructure adapters

- [Bcrypt hasher](https://github.com/bengornadha/lamalice-clean-archi/blob/main/infrastructures/hashers/hashers.py): `infrastructures/hashers/hashers.py`
- [In-memory repository](https://github.com/bengornadha/lamalice-clean-archi/blob/main/infrastructures/persistence/user_repository.py): `infrastructures/persistence/user_repository.py`
- [BigQuery repository](https://github.com/bengornadha/lamalice-clean-archi/blob/main/infrastructures/persistence/user_repository_bigquery.py): `infrastructures/persistence/user_repository_bigquery.py`
- [S3 repository](https://github.com/bengornadha/lamalice-clean-archi/blob/main/infrastructures/persistence/user_repository_s3.py): `infrastructures/persistence/user_repository_s3.py`
- [User serializer](https://github.com/bengornadha/lamalice-clean-archi/blob/main/infrastructures/serializers/user_serializer.py): `infrastructures/serializers/user_serializer.py`
- [Serialized user](https://github.com/bengornadha/lamalice-clean-archi/blob/main/infrastructures/serializers/user_serialized.py): `infrastructures/serializers/user_serialized.py`

### Other components

- **Caller**
- **BigQuery**

## Connections

- Caller → Example runner: runs (evidence: `README.md`)
- Caller → DI runner: runs (evidence: `README.md`)
- Example runner → User input: creates (evidence: `main.py`)
- Example runner → Register user: builds and calls (evidence: `main.py`)
- Example runner → User validator: configures (evidence: `main.py`)
- Example runner → Bcrypt hasher: configures (evidence: `main.py`)
- Example runner → In-memory repository: configures and fetches (evidence: `main.py`)
- Example runner → User serializer: configures (evidence: `main.py`)
- DI runner → Register user: configures (evidence: `main_injection_dependances.py`)
- DI runner → User validator: configures (evidence: `main_injection_dependances.py`)
- Register user → User input: accepts (evidence: `application/register_user.py`)
- Register user → User validator: validates with (evidence: `application/register_user.py`)
- Register user → Hasher contract: hashes via (evidence: `application/register_user.py`)
- Register user → Repository contract: saves via (evidence: `application/register_user.py`)
- Register user → Registered user: creates (evidence: `application/register_user.py`)
- Register user → Email value: constructs (evidence: `application/register_user.py`)
- User validator → User input: validates (evidence: `domain/services/user_validator.py`)
- User validator → Repository contract: checks existence (evidence: `domain/services/user_validator.py`)
- User validator → Email value: constructs (evidence: `domain/services/user_validator.py`)
- User validator → Password validator: validates password (evidence: `domain/services/user_validator.py`)
- User validator → Validator contracts: implements (evidence: `domain/services/user_validator.py`)
- Bcrypt hasher → Hasher contract: implements (evidence: `infrastructures/hashers/hashers.py`)
- In-memory repository → Repository contract: implements (evidence: `infrastructures/persistence/user_repository.py`)
- BigQuery repository → Repository contract: implements (evidence: `infrastructures/persistence/user_repository_bigquery.py`)
- S3 repository → Repository contract: implements (evidence: `infrastructures/persistence/user_repository_s3.py`)
- In-memory repository → User serializer: serializes with (evidence: `infrastructures/persistence/user_repository.py`)
- In-memory repository → Serialized user: stores (evidence: `infrastructures/persistence/user_repository.py`)
- In-memory repository → User not found: raises (evidence: `infrastructures/persistence/user_repository.py`)
- BigQuery repository → User serializer: serializes with (evidence: `infrastructures/persistence/user_repository_bigquery.py`)
- BigQuery repository → Serialized user: constructs (evidence: `infrastructures/persistence/user_repository_bigquery.py`)
- BigQuery repository → BigQuery: queries and inserts (evidence: `infrastructures/persistence/user_repository_bigquery.py`)
- User serializer → Serializer contract: implements (evidence: `infrastructures/serializers/user_serializer.py`)
- User serializer → Serialized user: produces and reads (evidence: `infrastructures/serializers/user_serializer.py`)
- User serializer → Registered user: converts (evidence: `infrastructures/serializers/user_serializer.py`)
- Registered user → Email value: contains (evidence: `domain/entities/user.py`)
