# miguelcocohdez/proyecto-microservicios-riverspain architecture

> Architecture diagram of the GitHub repository miguelcocohdez/proyecto-microservicios-riverspain, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/miguelcocohdez/proyecto-microservicios-riverspain
- Repository: https://github.com/miguelcocohdez/proyecto-microservicios-riverspain

## Overview

##### Project type and purpose
- RiverSpain is a distributed system built as an academic project using a microservices architecture.
- Its core purpose is to manage data about rivers, fish species, protected zones, volunteers and to send notifications (e-mail) using Spring Boot, Spring Cloud (Eureka, Config Server), Docker and MySQL.

##### File structure
- At the root you have:
- docker-compose.yml – orchestrates all containers into a `riverspain_network`
- pom.xml – parent aggregator (optional)
- carpeta `datospruebabdd` – SQL scripts for initial data
- carpetas de microservicios independientes:
– microservicio-eureka (Service Discovery)
– microservicio-config (Central Config)
– microservicio-gateway (API Gateway)
– microservicio-peces, ‑rios, ‑zonas, ‑voluntarios, ‑batidas (domain services)
- Each microservice follows the standard Spring Boot layout:
src/main/java/com/riverspain/<servicename>/{application, config, dto, entity, repository, service, rest, client…}
- Each has its own application.yml, Dockerfile, and test suite.

##### README for additional insights
- It lists technologies (Spring Cloud Config, Eureka, Feign, JPA, Docker Compose).
- It describes deployment steps: create network, docker compose up, endpoint checks.
- It enumerates each microservice and notes “batidas” is maintained in a separate repo.

##### Capturing essential architectural elements
- Be extremely detailed: represent every microservice, infra service, database, network boundary and external dependency.
- Service registration, discovery, configuration fetch, request routing, inter-service calls, and persistence.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "riverspain_network"
        direction TB

        DockerCompose["Docker Compose Orchestrator"]:::infra
        datos["Initial Data SQL Scripts"]:::db
        pom["Parent Maven POM"]:::infra

        subgraph "Infrastructure Services"
            direction TB
            Config["Config Server"]:::infra
            Eureka["Eureka Discovery Server"]:::infra
        end

        Gateway["API Gateway"]:::gateway

        subgraph "Domain Microservices"
            direction TB
            Peces["Peces Service"]:::service
            Rios["Ríos Service"]:::service
            Zonas["Zonas Service"]:::service
            Voluntarios["Voluntarios Service"]:::service
            Batidas["Batidas Service"]:::service
            Ciudades["Ciudades Service"]:::service
        end

        subgraph "Databases"
            direction TB
            DB_Peces(("MySQL Peces DB")):::db
            DB_Rios(("MySQL Ríos DB")):::db
            DB_Zonas(("MySQL Zonas DB")):::db
            DB_Voluntarios(("MySQL Voluntarios DB")):::db
            DB_Batidas(("MySQL Batidas DB")):::db
            DB_Ciudades(("MySQL Ciudades DB")):::db
        end

    end

    Clients["External Clients"]:::external
    SMTP["SMTP E-mail Service"]:::external

    %% Registration and Configuration Fetch
    Gateway -->|"register"| Eureka
    Gateway -->|"fetch config"| Config
    Peces -->|"register"| Eureka
    Peces -->|"fetch config"| Config
    Rios -->|"register"| Eureka
    Rios -->|"fetch config"| Config
    Zonas -->|"register"| Eureka
    Zonas -->|"fetch config"| Config
    Voluntarios -->|"register"| Eureka
    Voluntarios -->|"fetch config"| Config
    Batidas -->|"register"| Eureka
    Batidas -->|"fetch config"| Config
    Ciudades -->|"register"| Eureka
    Ciudades -->|"fetch config"| Config

    %% Client to Gateway
    Clients -->|"HTTP Requests"| Gateway

    %% Gateway to Domain Services
    Gateway -->|"route to Peces"| Peces
    Gateway -->|"route to Ríos"| Rios
    Gateway -->|"route to Zonas"| Zonas
    Gateway -->|"route to Voluntarios"| Voluntarios
    Gateway -->|"route to Batidas"| Batidas
    Gateway -->|"route to Ciudades"| Ciudades

    %% Inter-service Feign Calls
    Zonas -->|"calls Peces"| Peces
    Zonas -->|"calls Ciudades"| Ciudades
    Zonas -->|"calls Voluntarios"| Voluntarios

    %% Persistence
    Peces -->|"JPA"| DB_Peces
    Rios -->|"JPA"| DB_Rios
    Zonas -->|"JPA"| DB_Zonas
    Voluntarios -->|"JPA"| DB_Voluntarios
    Batidas -->|"JPA"| DB_Batidas
    Ciudades -->|"JPA"| DB_Ciudades

    %% External SMTP
    Voluntarios -->|"send email"| SMTP

    %% Click Events
    click DockerCompose "https://github.com/miguelcocohdez/proyecto-microservicios-riverspain/blob/main/docker-compose.yml"
    click datos "https://github.com/miguelcocohdez/proyecto-microservicios-riverspain/tree/main/datospruebabdd/"
    click pom "https://github.com/miguelcocohdez/proyecto-microservicios-riverspain/blob/main/pom.xml"
    click Config "https://github.com/miguelcocohdez/proyecto-microservicios-riverspain/tree/main/microservicio-config/"
    click Config "https://github.com/miguelcocohdez/proyecto-microservicios-riverspain/tree/main/microservicio-config/src/main/resources/configuraciones/"
    click Eureka "https://github.com/miguelcocohdez/proyecto-microservicios-riverspain/tree/main/microservicio-eureka/"
    click Gateway "https://github.com/miguelcocohdez/proyecto-microservicios-riverspain/tree/main/microservicio-gateway/"
    click Peces "https://github.com/miguelcocohdez/proyecto-microservicios-riverspain/tree/main/microservicio-peces/"
    click Peces "https://github.com/miguelcocohdez/proyecto-microservicios-riverspain/blob/main/microservicio-peces/src/main/java/com/riverspain/peces/config/OpenApiConfig.java"
    click Rios "https://github.com/miguelcocohdez/proyecto-microservicios-riverspain/tree/main/microservicio-rios/"
    click Zonas "https://github.com/miguelcocohdez/proyecto-microservicios-riverspain/tree/main/microservicio-zonas/"
    click Voluntarios "https://github.com/miguelcocohdez/proyecto-microservicios-riverspain/tree/main/microservicio-voluntarios/"
    click Batidas "https://github.com/miguelcocohdez/proyecto-microservicios-riverspain/tree/main/microservicio-batidas/"
    click Ciudades "https://github.com/miguelcocohdez/proyecto-microservicios-riverspain/tree/main/microservicio-ciudades/"
    click README "https://github.com/miguelcocohdez/proyecto-microservicios-riverspain/blob/main/README.md"

    %% Styles
    classDef infra fill:#f2f2f2,stroke:#333,stroke-width:1px
    classDef gateway fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef service fill:#d4edda,stroke:#333,stroke-width:1px
    classDef db fill:#fff3cd,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef external fill:#f8d7da,stroke:#333,stroke-width:1px,stroke-dasharray: 2 2
```
