# fpaolant/realestateads architecture

> Architecture diagram of the GitHub repository fpaolant/realestateads, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fpaolant/realestateads
- Repository: https://github.com/fpaolant/realestateads

## Overview

##### Project type and purpose
- This is a full-stack, microservices/SOA system (“RealEstateAds”) composed of multiple Spring Boot modules (account, ads, wallet, geolocation, search, publish), a Spring Cloud Gateway, a Eureka Discovery server, and an Angular SPA client.
- Purpose: allow users to sign up, manage accounts and wallets, publish real-estate ads (with payment), and search ads by title, city or geographic radius.

##### File structure
- Top-level Maven modules:
- account-service, ads-service, wallet-service, geolocation-service (SOAP or REST providers)
- search-service, publish-service (prosumer services calling providers)
- gateway (Spring Cloud Gateway)
- discovery-service (Eureka Server)
- client (Angular SPA + Nginx)
- Supporting artifacts: `wsdl/` and `openapi/` definitions, `docker-compose.yml`, Dockerfiles in each module.
- Patterns: Microservices registered to Eureka, API Gateway as single entrypoint, prosumers orchestrate multiple provider calls asynchronously.

##### Key insights from the README
- Services categorized as Providers (REST or SOAP) and Prosumers (aggregators).
- Gateway routes ALL client requests to underlying services.
- Discovery service handles service registration and lookup.
- Sequence flows: Login, Signup, Search Ads, Publish Ad describe interactions through Gateway → Services.

- Blue for frontend/client
- Green for Gateway & Discovery
- Orange for REST Provider services
- Purple for SOAP Provider services
- Yellow for Prosumer services
- Grey for shared infrastructure (DB, WSDL/OpenAPI)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Zone
    subgraph "Client Zone"
        direction TB
        AngularSPA["Angular SPA Client"]:::frontend
    end

    %% Gateway & Discovery Zone
    subgraph "Gateway & Discovery"
        direction TB
        APIGateway["API Gateway"]:::gateway
        EurekaDiscovery["Eureka Discovery Server"]:::discovery
    end

    %% Service Zone
    subgraph "Provider Services"
        direction TB
        AccountService["Account-Service (REST)"]:::rest
        AdsService["Ads-Service (SOAP)"]:::soap
        WalletService["Wallet-Service (REST)"]:::rest
        GeolocationService["Geolocation-Service (SOAP)"]:::soap
    end

    subgraph "Prosumer Services"
        direction TB
        SearchService["Search-Service"]:::prosumer
        PublishService["Publish-Service"]:::prosumer
    end

    %% Infrastructure Zone
    subgraph "Infrastructure"
        direction TB
        MySQLDB["MySQL Database"]:::infra
        WSDLDefs["WSDL Definitions"]:::infra
        OpenAPIDefs["OpenAPI Definitions"]:::infra
    end

    %% Client to Gateway
    AngularSPA -->|"HTTP/HTTPS"| APIGateway

    %% Gateway to Discovery and Services
    APIGateway -->|"lookup"| EurekaDiscovery
    APIGateway -->|"REST/SOAP"| AccountService
    APIGateway -->|"REST"| WalletService
    APIGateway -->|"SOAP"| AdsService
    APIGateway -->|"SOAP"| GeolocationService
    APIGateway -->|"REST"| SearchService
    APIGateway -->|"REST"| PublishService

    %% Service registration
    AccountService -->|"register"| EurekaDiscovery
    AdsService -->|"register"| EurekaDiscovery
    WalletService -->|"register"| EurekaDiscovery
    GeolocationService -->|"register"| EurekaDiscovery
    SearchService -->|"register"| EurekaDiscovery
    PublishService -->|"register"| EurekaDiscovery

    %% Provider to DB
    AccountService -->|"JPA"| MySQLDB
    AdsService -->|"JPA"| MySQLDB
    WalletService -->|"JPA"| MySQLDB
    GeolocationService -->|"JPA"| MySQLDB

    %% Prosumer orchestration flows
    SearchService -->|"calls Ads (SOAP)"| AdsService
    SearchService -->|"calls Geolocation (SOAP)"| GeolocationService
    PublishService -->|"calls Wallet (REST)"| WalletService
    PublishService -->|"calls Ads (SOAP)"| AdsService
    PublishService -->|"calls Wallet (REST)"| WalletService

    %% External Artifacts
    AdsService -.-> WSDLDefs
    GeolocationService -.-> WSDLDefs
    AccountService -.-> OpenAPIDefs
    WalletService -.-> OpenAPIDefs

    %% Click Events
    click AngularSPA "https://github.com/fpaolant/realestateads/tree/main/client/"
    click APIGateway "https://github.com/fpaolant/realestateads/tree/main/gateway/"
    click EurekaDiscovery "https://github.com/fpaolant/realestateads/tree/main/discovery-service/"
    click AccountService "https://github.com/fpaolant/realestateads/tree/main/account-service/"
    click AdsService "https://github.com/fpaolant/realestateads/tree/main/ads-service/"
    click WalletService "https://github.com/fpaolant/realestateads/tree/main/wallet-service/"
    click GeolocationService "https://github.com/fpaolant/realestateads/tree/main/geolocation-service/"
    click SearchService "https://github.com/fpaolant/realestateads/tree/main/search-service/"
    click PublishService "https://github.com/fpaolant/realestateads/tree/main/publish-service/"
    click WSDLDefs "https://github.com/fpaolant/realestateads/tree/main/wsdl/"
    click OpenAPIDefs "https://github.com/fpaolant/realestateads/tree/main/openapi/"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,color:#004085
    classDef gateway fill:#d4edda,stroke:#155724,color:#155724
    classDef discovery fill:#d4edda,stroke:#0b5345,color:#0b5345
    classDef rest fill:#fff3cd,stroke:#856404,color:#856404
    classDef soap fill:#f5c6cb,stroke:#721c24,color:#721c24
    classDef prosumer fill:#ffeeba,stroke:#856404,color:#856404
    classDef infra fill:#e2e3e5,stroke:#6c757d,color:#6c757d
```
