# catasto-open/mapstorecatasto architecture

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

- Interactive diagram: https://gitdiagram.com/catasto-open/mapstorecatasto
- Repository: https://github.com/catasto-open/mapstorecatasto

## Overview

##### Main system components
- Frontend (Extension/UI): Represented primarily by the “js/extension” directory, which includes actions, components (e.g., panels, search components, maps), containers, selectors, and utilities. This is where the interactive map interface is implemented, along with user interactions (layer management, search, and visualization).
- Backend Services: Found under “backend” and “web”. The “backend” folder contains Java files, resources, and tests (with Maven “pom.xml” files) – likely providing API endpoints for retrieving and processing cadastral data. The “web” folder includes web-specific configurations (such as “web.xml”, dispatcher-servlet.xml, and additional properties) that integrate the backend into a deployable web application.
- Build and Deployment: Include build scripts such as “build.sh” and the “build” folder (with webpack and extension scripts) as well as Dockerfiles and the “docker” directory, which contain deployment configurations.
- Configuration and Assets: Note the “configs” directory holding various JSON configuration files (defining endpoints, plugin configurations, etc.) and the “assets” directory for translations and static JSON data.
- Integration with External Systems: The README notes integration with a separate “catasto-db” (via geoserver endpoints) – include an external service or data source component.

##### Relationships and interactions
- A link from the Backend to external data sources (like “catasto-db” accessed via geoserver endpoints) as configured in “config/localconfig.json”.
- How build and deployment components (Docker, Webpack, Maven) feed into the delivery of the final application.
- Configuration management (with files in “configs” and properties files in “docker” and “web/src/main/resources”) as central to connecting the various components.

##### Important architectural patterns and design principles
- Modularization: The clear separation between frontend extension modules (organized into subdirectories like “actions”, “components”, “epics”, “reducers”) and backend Java code follows a modular design principle.
- MVC/Redux-like Structure: The frontend structure suggests a React-Redux (or similar unidirectional data flow) pattern where actions, reducers, and selectors are neatly separated.
- Microservices/Integration: Although not strictly broken into microservices, the backend and the external service (catasto-db/geoserver) communicate in a loosely coupled manner.
- Containerization: Docker files and deployment scripts indicate a modern container-based deployment setup.

##### Relevant technologies and frameworks
- Frontend: JavaScript (with React, inferred from the use of JSX files) and Redux-like state management.
- Backend: Java, likely using frameworks such as Spring (implied by “applicationContext.xml”, “dispatcher-servlet.xml”) for web services.
- Build Tools: Maven (pom.xml files) for Java modules and Webpack for JavaScript bundling.
- Docker: For containerization and deployment.
- MapStore2 Integration: The project extends MapStore2, which is the foundation for the interactive map.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Frontend
    subgraph "MapStoreCatasto Frontend"
        FE1["Interactive Map UI (React/Redux)"]:::frontend
        FE2["JS Extension Modules (Actions, Reducers, Components)"]:::frontend
        FE3["API Integrations (geoserver.js, visura.js)"]:::frontend
    end

    %% Backend
    subgraph "MapStoreCatasto Backend"
        BE1["Java API Endpoints"]:::backend
        BE2["Business Logic & Data Processing"]:::backend
        BE3["Web Configurations (web.xml, dispatcher-servlet.xml)"]:::backend
    end

    %% Configuration and Assets
    subgraph "Configuration and Assets"
        CFG["JSON Configuration (localConfig.json)"]:::config
        AST["Static Assets (Translations, index.json)"]:::config
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        BD1["Build Scripts & Tools (Maven, Webpack)"]:::build
        BD2["Containerization (Docker, Dockerfile)"]:::build
    end

    %% External Data Service
    subgraph "External Cadastral Data Service"
        EXT["catasto-db/geoserver"]:::external
    end

    %% Relationships
    FE1 -->|"triggers"| BE1
    FE2 -->|"supports"| FE1
    FE3 -->|"integrates"| EXT
    BE1 -->|"fetches"| EXT
    BE1 -->|"reads"| CFG
    BE1 -->|"reads"| AST
    BE2 -->|"processes"| BE1
    BE3 -->|"configures"| BE1

    BD1 -->|"builds"| FE1
    BD1 -->|"builds"| BE1
    BD1 -->|"builds"| BE2
    BD1 -->|"builds"| BE3
    BD2 -->|"deploys"| FE1
    BD2 -->|"deploys"| BE1

    CFG -->|"configures"| FE3
    CFG -->|"configures"| BE3

    %% Legend (informative note, not interactive)
    LEG["Legend: Blue=Frontend | Green=Backend | Gray=Config/Assets | Purple=Build/Deployment | Orange=External"]:::legend

    %% Positioning the legend at bottom
    EXT --- LEG

    %% Click Events
    click FE2 "https://github.com/catasto-open/mapstorecatasto/tree/develop/js/extension"
    click BE1 "https://github.com/catasto-open/mapstorecatasto/tree/develop/backend/src/main/java"
    click BE3 "https://github.com/catasto-open/mapstorecatasto/tree/develop/web/src/main/webapp"
    click BD1 "https://github.com/catasto-open/mapstorecatasto/tree/develop/build"
    click BD2 "https://github.com/catasto-open/mapstorecatasto/tree/develop/docker"
    click CFG "https://github.com/catasto-open/mapstorecatasto/blob/develop/configs/localConfig.json"
    click AST "https://github.com/catasto-open/mapstorecatasto/tree/develop/assets"
    click FE3 "https://github.com/catasto-open/mapstorecatasto/tree/develop/js/extension/api"

    %% Class definitions with colors
    classDef frontend fill:#a2d2ff,stroke:#000,stroke-width:1px;
    classDef backend fill:#b8e994,stroke:#000,stroke-width:1px;
    classDef config fill:#e0e0e0,stroke:#000,stroke-width:1px;
    classDef build fill:#d3bdf0,stroke:#000,stroke-width:1px;
    classDef external fill:#ffcc80,stroke:#000,stroke-width:1px;
    classDef legend fill:#ffffff,stroke:#000,stroke-dasharray: 5 5,stroke-width:1px;
```
