# comune-di-montesilvano/utenzepa architecture

> Architecture diagram of the GitHub repository comune-di-montesilvano/utenzepa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/comune-di-montesilvano/utenzepa
- Repository: https://github.com/comune-di-montesilvano/utenzepa

## Overview

UtenzePA is a public-sector property, utilities, and accounting management system. Users work through the Angular application to manage real estate, technical plants, utility contracts and consumption, spending, invoices, and administrative acts; the NestJS API provides the application services backed by MySQL. Invoice intake from PEC/SDI and accounting imports are distinct workflows, alongside the separately scheduled TINN integration. The README establishes the frontend/API/database arrangement; sampled controllers and the source index support only selected internal call edges, so other feature links are left out.

Main entry points: [`tinn/app/job.py`](https://github.com/comune-di-montesilvano/utenzepa/blob/main/tinn/app/job.py) (TINN import job), [`tinn/app/main.py`](https://github.com/comune-di-montesilvano/utenzepa/blob/main/tinn/app/main.py) (TINN scheduler), [`frontend/src/app/app.ts`](https://github.com/comune-di-montesilvano/utenzepa/blob/main/frontend/src/app/app.ts) (Angular application), [`backend/src/apis/plants/plants.service.ts`](https://github.com/comune-di-montesilvano/utenzepa/blob/main/backend/src/apis/plants/plants.service.ts) (Technical plants)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User Application"]
  node_frontend["Angular application<br/>[app.ts]"]
  node_authui["Session and login<br/>[auth.service.ts]"]
end

subgraph group_domain["Property And Utilities"]
  node_property["Property and plants"]
  node_plant["Technical plants<br/>[plants.service.ts]"]
  node_utilities["Utilities and supply"]
  node_agreements["Contracts and agreements"]
  node_thirdparties["Third parties"]
  node_acts["Administrative acts"]
end

subgraph group_finance["Finance And Imports"]
  node_spending["Budget and commitments"]
  node_invoices["Invoices and payments<br/>[invoice.service.ts]"]
  node_invoiceimport["PEC SDI intake"]
  node_accounting["Accounting import"]
end

subgraph group_platform["API Platform"]
  node_api["NestJS API<br/>[main.ts]"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_files["Attachments and photos"]
  node_mapping["Maps and geocoding"]
  node_mysql[("MySQL database<br/>[mysql.module.ts]")]
end

subgraph group_integrations["External Integrations"]
  node_tinn["TINN scheduler<br/>[main.py]"]
  node_job["TINN import job<br/>[job.py]"]
  node_ldap["LDAP / Active Directory"]
end

node_user(("Public-sector user"))
node_pec["PEC mailbox"]

node_user -->|"uses"| node_frontend
node_frontend -->|"calls API"| node_api
node_api -->|"uses database"| node_mysql
node_auth -->|"authenticates"| node_ldap
node_invoices -->|"gets documents"| node_invoiceimport
node_plant -->|"serves plant requests"| node_plant
node_utilities -->|"reconciles supply"| node_utilities
node_tinn -->|"runs job"| node_job
node_job -->|"uses inbox"| node_tinn
node_job -->|"extracts data"| node_tinn
node_job -->|"uses SFTP"| node_tinn
node_pec -.->|"supplies invoices"| node_invoiceimport

click node_frontend "https://github.com/comune-di-montesilvano/utenzepa/blob/main/frontend/src/app/app.ts"
click node_authui "https://github.com/comune-di-montesilvano/utenzepa/blob/main/frontend/src/app/services/auth.service.ts"
click node_property "https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/asset"
click node_plant "https://github.com/comune-di-montesilvano/utenzepa/blob/main/backend/src/apis/plants/plants.service.ts"
click node_utilities "https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/utility-supply"
click node_agreements "https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/contracts"
click node_thirdparties "https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/third-parties"
click node_acts "https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/acts"
click node_spending "https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/budget-commitments"
click node_invoices "https://github.com/comune-di-montesilvano/utenzepa/blob/main/backend/src/apis/invoices/invoice.service.ts"
click node_invoiceimport "https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/invoice-import"
click node_accounting "https://github.com/comune-di-montesilvano/utenzepa/blob/main/backend/src/apis/accounting-import/accounting-import.service.ts"
click node_api "https://github.com/comune-di-montesilvano/utenzepa/blob/main/backend/src/main.ts"
click node_auth "https://github.com/comune-di-montesilvano/utenzepa/blob/main/backend/src/apis/auth/auth.service.ts"
click node_files "https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/attachments"
click node_mapping "https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/map"
click node_mysql "https://github.com/comune-di-montesilvano/utenzepa/blob/main/backend/src/core/database/mysql/mysql.module.ts"
click node_tinn "https://github.com/comune-di-montesilvano/utenzepa/blob/main/tinn/app/main.py"
click node_job "https://github.com/comune-di-montesilvano/utenzepa/blob/main/tinn/app/job.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_frontend,node_authui,node_user toneBlue
class node_property,node_plant,node_utilities,node_agreements,node_thirdparties,node_acts toneAmber
class node_spending,node_invoices,node_invoiceimport,node_accounting toneMint
class node_api,node_auth,node_files,node_mapping,node_mysql toneRose
class node_tinn,node_job,node_ldap,node_pec toneIndigo
```

## Components

### User Application

- [Angular application](https://github.com/comune-di-montesilvano/utenzepa/blob/main/frontend/src/app/app.ts): `frontend/src/app/app.ts`
- [Session and login](https://github.com/comune-di-montesilvano/utenzepa/blob/main/frontend/src/app/services/auth.service.ts): `frontend/src/app/services/auth.service.ts`

### Property And Utilities

- [Property and plants](https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/asset): `backend/src/apis/asset`
- [Technical plants](https://github.com/comune-di-montesilvano/utenzepa/blob/main/backend/src/apis/plants/plants.service.ts): `backend/src/apis/plants/plants.service.ts`
- [Utilities and supply](https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/utility-supply): `backend/src/apis/utility-supply`
- [Contracts and agreements](https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/contracts): `backend/src/apis/contracts`
- [Third parties](https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/third-parties): `backend/src/apis/third-parties`
- [Administrative acts](https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/acts): `backend/src/apis/acts`

### Finance And Imports

- [Budget and commitments](https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/budget-commitments): `backend/src/apis/budget-commitments`
- [Invoices and payments](https://github.com/comune-di-montesilvano/utenzepa/blob/main/backend/src/apis/invoices/invoice.service.ts): `backend/src/apis/invoices/invoice.service.ts`
- [PEC SDI intake](https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/invoice-import): `backend/src/apis/invoice-import`
- [Accounting import](https://github.com/comune-di-montesilvano/utenzepa/blob/main/backend/src/apis/accounting-import/accounting-import.service.ts): `backend/src/apis/accounting-import/accounting-import.service.ts`

### API Platform

- [NestJS API](https://github.com/comune-di-montesilvano/utenzepa/blob/main/backend/src/main.ts): `backend/src/main.ts`
- [Authentication](https://github.com/comune-di-montesilvano/utenzepa/blob/main/backend/src/apis/auth/auth.service.ts): `backend/src/apis/auth/auth.service.ts`
- [Attachments and photos](https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/attachments): `backend/src/apis/attachments`
- [Maps and geocoding](https://github.com/comune-di-montesilvano/utenzepa/tree/main/backend/src/apis/map): `backend/src/apis/map`
- [MySQL database](https://github.com/comune-di-montesilvano/utenzepa/blob/main/backend/src/core/database/mysql/mysql.module.ts): `backend/src/core/database/mysql/mysql.module.ts`

### External Integrations

- [TINN scheduler](https://github.com/comune-di-montesilvano/utenzepa/blob/main/tinn/app/main.py): `tinn/app/main.py`
- [TINN import job](https://github.com/comune-di-montesilvano/utenzepa/blob/main/tinn/app/job.py): `tinn/app/job.py`
- **LDAP / Active Directory**

### Other components

- **Public-sector user**
- **PEC mailbox**

## Connections

- Public-sector user → Angular application: uses (evidence: `README.md`)
- Angular application → NestJS API: calls API (evidence: `README.md`)
- NestJS API → MySQL database: uses database (evidence: `README.md`)
- Authentication → LDAP / Active Directory: authenticates (evidence: `backend/src/apis/auth/auth.service.ts`)
- Invoices and payments → PEC SDI intake: gets documents
- Technical plants → Technical plants: serves plant requests (evidence: `backend/src/apis/plants/plants.controller.ts`)
- Utilities and supply → Utilities and supply: reconciles supply (evidence: `backend/src/apis/utility-supply/utility-supply.controller.ts`)
- TINN scheduler → TINN import job: runs job (evidence: `tinn/app/main.py`)
- TINN import job → TINN scheduler: uses inbox (evidence: `tinn/app/job.py`)
- TINN import job → TINN scheduler: extracts data (evidence: `tinn/app/job.py`)
- TINN import job → TINN scheduler: uses SFTP (evidence: `tinn/app/job.py`)
- PEC mailbox → PEC SDI intake: supplies invoices (evidence: `README.md`)
