# gabriellorencetti/water-gas-meter-api architecture

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

- Interactive diagram: https://gitdiagram.com/gabriellorencetti/water-gas-meter-api
- Repository: https://github.com/gabriellorencetti/water-gas-meter-api

## Overview

##### Project type and purpose
- This is a backend REST API service (“Water-Gas-Meter-API”) whose sole responsibility is:
- Accepting image uploads of water and gas meters
- Calling the Google Gemini OCR API to extract the meter readings
- Persisting those readings in a database
- Exposing endpoints to confirm readings and to list stored measurements

##### (minimal) file structure
- At top level you only have `.gitignore` and `README.md`, but we can infer a typical backend layout:
- `src/` or `app/` folder holding your code
- Subfolders such as `controllers/` (HTTP handlers), `services/` (business logic), `models/` or `repositories/` (data access), `config/` (env settings), `routes/`, and possibly `tests/`
- A remaining `uploads/` or cloud‐storage connector for raw image files

##### README for additional insights
- Endpoints:
- POST  /upload-image
- POST  /confirm-reading
- GET   /readings
- External dependency: Google Gemini OCR API
- Implied data store for readings (SQL or NoSQL) and likely object storage for images

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    Client["Client (Web/Mobile)"]:::client
    Client -->|HTTP Request| LB

    %% Ingress Layer
    LB["API Gateway / Load Balancer"]:::gateway
    LB -->|Forwards Request| Controller

    %% Application Layer
    subgraph "Meter-API Service"
        Controller["Controllers / Routes"]:::service
        ServiceLayer["Business Logic & OCR Service"]:::service
        Repo["Data Access Layer / Repository"]:::service
    end

    Controller -->|calls| ServiceLayer
    Controller -->|calls| Repo
    ServiceLayer -->|saves image| BlobStorage
    ServiceLayer -->|requests OCR| OCRAPI
    ServiceLayer -->|persists reading| Repo
    Repo -->|CRUD| Database

    %% Persistence & External
    BlobStorage["Blob Storage (AWS S3 / GCP)"]:::datastore
    Database["Readings DB (PostgreSQL)"]:::datastore
    OCRAPI["Google Gemini OCR API"]:::external

    %% Documentation Files
    Docs["Project Documentation & Endpoints Overview"]:::docs
    Gitignore["Gitignore Configuration"]:::docs
    Docs --- Gitignore

    %% Click Events
    click Docs "https://github.com/gabriellorencetti/water-gas-meter-api/blob/main/README.md"
    click Gitignore "https://github.com/gabriellorencetti/water-gas-meter-api/blob/main/.gitignore"

    %% Styles
    classDef client fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef gateway fill:#add8e6,stroke:#333,stroke-width:1px
    classDef service fill:#87cefa,stroke:#333,stroke-width:1px
    classDef datastore fill:#ffa500,stroke:#333,stroke-width:1px
    classDef external fill:#90ee90,stroke:#333,stroke-width:1px
    classDef docs fill:#eee8aa,stroke:#333,stroke-width:1px
```
