# msferraresi/pyments_api architecture

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

- Interactive diagram: https://gitdiagram.com/msferraresi/pyments_api
- Repository: https://github.com/msferraresi/pyments_api

## Overview

This is a Flask backend for managing users, houses, payments, and their supporting reference data. A client request reaches dynamically registered service blueprints, which perform API and persistence operations through SQLAlchemy models; user operations also include authentication, validation, and avatar handling. The graph preserves the distinct service and model areas identified by the source index. The README is empty, and several service implementations were not excerpted, so those service-to-model links rely on the index; other unshown behavior is not inferred.

Main entry points: [`src/__init__.py`](https://github.com/msferraresi/pyments_api/blob/main/src/__init__.py) (Flask app), [`src/models`](https://github.com/msferraresi/pyments_api/tree/main/src/models) (Payment references), [`src/services/userService.py`](https://github.com/msferraresi/pyments_api/blob/main/src/services/userService.py) (User API), [`src/models/user.py`](https://github.com/msferraresi/pyments_api/blob/main/src/models/user.py) (Users and roles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application runtime"]
  node_app["Flask app<br/>[__init__.py]"]
  node_launcher["App launcher<br/>[main.py]"]
end

subgraph group_services["API services"]
  node_user_api["User API<br/>[userService.py]"]
  node_payment_api["Payment API<br/>[paymentService.py]"]
  node_house_api["House API<br/>[houseService.py]"]
  node_concept_api["Concept API<br/>[conceptService.py]"]
  node_currency_api["Currency API<br/>[currencyService.py]"]
  node_role_api["Role API<br/>[roleService.py]"]
  node_status_api["Status API<br/>[statusService.py]"]
  node_house_type_api["House type API"]
  node_payment_type_api["Payment type API"]
end

subgraph group_domain["Domain models"]
  node_user_model["Users and roles<br/>[user.py]"]
  node_house_model["Houses<br/>[house.py]"]
  node_payment_model["Payments<br/>[payment.py]"]
  node_reference_models["Payment references"]
  node_regex["Email validation<br/>[regex.py]"]
end

subgraph group_config["Configuration"]
  node_environment["Environment settings"]
end

node_client(("API client"))
node_database[("MySQL database")]

node_client -->|"sends requests"| node_app
node_launcher -->|"creates app"| node_app
node_app -->|"loads settings"| node_environment
node_app -->|"initializes schema"| node_database
node_app -->|"registers blueprint"| node_user_api
node_app -->|"registers blueprint"| node_payment_api
node_app -->|"registers blueprint"| node_house_api
node_app -->|"registers blueprint"| node_concept_api
node_app -->|"registers blueprint"| node_currency_api
node_app -->|"registers blueprint"| node_role_api
node_app -->|"registers blueprint"| node_status_api
node_app -->|"registers blueprint"| node_house_type_api
node_app -->|"registers blueprint"| node_payment_type_api
node_user_api -->|"queries and updates"| node_user_model
node_user_api -->|"validates email"| node_regex
node_payment_api -->|"queries and updates"| node_payment_model
node_house_api -->|"uses model"| node_house_model
node_concept_api -->|"uses model"| node_reference_models
node_currency_api -->|"uses model"| node_reference_models
node_role_api -->|"uses model"| node_user_model
node_status_api -->|"uses model"| node_reference_models
node_house_type_api -->|"uses model"| node_reference_models
node_payment_type_api -->|"uses model"| node_reference_models
node_user_model -->|"maps records"| node_database
node_house_model -->|"maps records"| node_database
node_payment_model -->|"maps records"| node_database
node_reference_models -->|"maps records"| node_database

click node_app "https://github.com/msferraresi/pyments_api/blob/main/src/__init__.py"
click node_user_api "https://github.com/msferraresi/pyments_api/blob/main/src/services/userService.py"
click node_payment_api "https://github.com/msferraresi/pyments_api/blob/main/src/services/paymentService.py"
click node_house_api "https://github.com/msferraresi/pyments_api/blob/main/src/services/houseService.py"
click node_concept_api "https://github.com/msferraresi/pyments_api/blob/main/src/services/conceptService.py"
click node_currency_api "https://github.com/msferraresi/pyments_api/blob/main/src/services/currencyService.py"
click node_role_api "https://github.com/msferraresi/pyments_api/blob/main/src/services/roleService.py"
click node_status_api "https://github.com/msferraresi/pyments_api/blob/main/src/services/statusService.py"
click node_house_type_api "https://github.com/msferraresi/pyments_api/blob/main/src/services/typeHouseService.py"
click node_payment_type_api "https://github.com/msferraresi/pyments_api/blob/main/src/services/typePaymentService.py"
click node_user_model "https://github.com/msferraresi/pyments_api/blob/main/src/models/user.py"
click node_house_model "https://github.com/msferraresi/pyments_api/blob/main/src/models/house.py"
click node_payment_model "https://github.com/msferraresi/pyments_api/blob/main/src/models/payment.py"
click node_reference_models "https://github.com/msferraresi/pyments_api/tree/main/src/models"
click node_regex "https://github.com/msferraresi/pyments_api/blob/main/src/utils/regex.py"
click node_environment "https://github.com/msferraresi/pyments_api/tree/main/config"
click node_launcher "https://github.com/msferraresi/pyments_api/blob/main/main.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_app,node_launcher,node_client toneBlue
class node_user_api,node_payment_api,node_house_api,node_concept_api,node_currency_api,node_role_api,node_status_api,node_house_type_api,node_payment_type_api,node_database toneAmber
class node_user_model,node_house_model,node_payment_model,node_reference_models,node_regex toneMint
class node_environment toneRose
```

## Components

### Application runtime

- [Flask app](https://github.com/msferraresi/pyments_api/blob/main/src/__init__.py): `src/__init__.py`
- [App launcher](https://github.com/msferraresi/pyments_api/blob/main/main.py): `main.py`

### API services

- [User API](https://github.com/msferraresi/pyments_api/blob/main/src/services/userService.py): `src/services/userService.py`
- [Payment API](https://github.com/msferraresi/pyments_api/blob/main/src/services/paymentService.py): `src/services/paymentService.py`
- [House API](https://github.com/msferraresi/pyments_api/blob/main/src/services/houseService.py): `src/services/houseService.py`
- [Concept API](https://github.com/msferraresi/pyments_api/blob/main/src/services/conceptService.py): `src/services/conceptService.py`
- [Currency API](https://github.com/msferraresi/pyments_api/blob/main/src/services/currencyService.py): `src/services/currencyService.py`
- [Role API](https://github.com/msferraresi/pyments_api/blob/main/src/services/roleService.py): `src/services/roleService.py`
- [Status API](https://github.com/msferraresi/pyments_api/blob/main/src/services/statusService.py): `src/services/statusService.py`
- [House type API](https://github.com/msferraresi/pyments_api/blob/main/src/services/typeHouseService.py): `src/services/typeHouseService.py`
- [Payment type API](https://github.com/msferraresi/pyments_api/blob/main/src/services/typePaymentService.py): `src/services/typePaymentService.py`

### Domain models

- [Users and roles](https://github.com/msferraresi/pyments_api/blob/main/src/models/user.py): `src/models/user.py`
- [Houses](https://github.com/msferraresi/pyments_api/blob/main/src/models/house.py): `src/models/house.py`
- [Payments](https://github.com/msferraresi/pyments_api/blob/main/src/models/payment.py): `src/models/payment.py`
- [Payment references](https://github.com/msferraresi/pyments_api/tree/main/src/models): `src/models`
- [Email validation](https://github.com/msferraresi/pyments_api/blob/main/src/utils/regex.py): `src/utils/regex.py`

### Configuration

- [Environment settings](https://github.com/msferraresi/pyments_api/tree/main/config): `config`

### Other components

- **API client**
- **MySQL database**

## Connections

- API client → Flask app: sends requests (evidence: `src/__init__.py`)
- App launcher → Flask app: creates app (evidence: `main.py`)
- Flask app → Environment settings: loads settings (evidence: `src/__init__.py`)
- Flask app → MySQL database: initializes schema (evidence: `src/__init__.py`)
- Flask app → User API: registers blueprint (evidence: `src/__init__.py`)
- Flask app → Payment API: registers blueprint (evidence: `src/__init__.py`)
- Flask app → House API: registers blueprint (evidence: `src/__init__.py`)
- Flask app → Concept API: registers blueprint (evidence: `src/__init__.py`)
- Flask app → Currency API: registers blueprint (evidence: `src/__init__.py`)
- Flask app → Role API: registers blueprint (evidence: `src/__init__.py`)
- Flask app → Status API: registers blueprint (evidence: `src/__init__.py`)
- Flask app → House type API: registers blueprint (evidence: `src/__init__.py`)
- Flask app → Payment type API: registers blueprint (evidence: `src/__init__.py`)
- User API → Users and roles: queries and updates (evidence: `src/services/userService.py`)
- User API → Email validation: validates email (evidence: `src/services/userService.py`)
- Payment API → Payments: queries and updates (evidence: `src/services/paymentService.py`)
- House API → Houses: uses model (evidence: `src/services/houseService.py`)
- Concept API → Payment references: uses model (evidence: `src/services/conceptService.py`)
- Currency API → Payment references: uses model (evidence: `src/services/currencyService.py`)
- Role API → Users and roles: uses model (evidence: `src/services/roleService.py`)
- Status API → Payment references: uses model (evidence: `src/services/statusService.py`)
- House type API → Payment references: uses model (evidence: `src/services/typeHouseService.py`)
- Payment type API → Payment references: uses model (evidence: `src/services/typePaymentService.py`)
- Users and roles → MySQL database: maps records (evidence: `src/models/user.py`)
- Houses → MySQL database: maps records (evidence: `src/models/house.py`)
- Payments → MySQL database: maps records (evidence: `src/models/payment.py`)
- Payment references → MySQL database: maps records (evidence: `src/models/concept.py`)
