# fgoerner/geozen architecture

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

- Interactive diagram: https://gitdiagram.com/fgoerner/geozen
- Repository: https://github.com/fgoerner/geozen

## Overview

##### Main Components
- Data Model – This includes all the geometry classes (Point, LineString, Polygon, MultiPolygon, etc.), Feature, FeatureCollection, and supporting classes like CoordinateReferenceSystem and Position. These reside in the src/main/java/dev/goerner/geozen/model package.
- Jackson Integration – This component is represented by the GeoZenModule class and the serializers/deserializers (found under src/main/java/dev/goerner/geozen/model/jackson with subpackages for serializer and deserializer). This integration is key for enabling conversion between GeoJSON and the internal data model.
- Geometric Calculations – The DistanceCalculator (in src/main/java/dev/goerner/geozen/calc) provides utility for geometric operations like distance computations.
- Testing Suite – Located in src/test, these unit tests verify the correctness of the data model, Jackson integration, and calculation utilities.
- Build and CI/CD Infrastructure – Since there are Gradle build scripts (build.gradle.kts, settings.gradle.kts) and GitHub workflows (.github/workflows, .github/codeql), they indicate that the project maintains automated testing, static analysis, and publishing processes.

##### Relationships and Interactions
- The Data Model serves as the backbone. The serializers and deserializers depend on these classes to properly convert objects to/from JSON format.
- The Jackson Integration (via the GeoZenModule) is designed to plug into Jackson’s ObjectMapper, orchestrating how data is serialized and deserialized.
- The Calculation utilities use the data model objects to perform computations (e.g., DistanceCalculator takes in geometry types).
- The testing layer verifies the proper functioning of both the core data model and its integration with Jackson as well as any calculation utilities.
- Build scripts and CI/CD workflows facilitate continuous integration, automated testing, and deployment (e.g., Maven publishing).

##### Architectural Patterns and Design Principles
- Modular Design – The separation of the data model, Jackson integration (module, serializers/deserializers), and calculation utilities makes the library modular and extensible.
- Object-Oriented Design – The careful organization into packages and classes reflects standard OOP practices. The serializers/deserializers follow a strategy pattern where similar types are handled using specific classes.
- Integration with External Libraries – The use of Jackson for JSON handling indicates a plug-and-play design where developers can easily mix GeoZen’s functionality with standard JSON processing pipelines.
- Test-Driven Development – The extensive test directory suggests that the project relies on comprehensive unit testing to ensure reliability.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Subgraph: Client Interaction
    subgraph "Client Interaction"
        Client["Client Application"]:::client
        ObjectMapper["ObjectMapper (Jackson)"]:::objectmapper
    end

    %% Subgraph: Jackson Integration
    subgraph "Jackson Integration"
        GeoZenModule["GeoZenModule Integration"]:::integration
        Serializers["Jackson Serializers"]:::integration
        Deserializers["Jackson Deserializers"]:::integration
    end

    %% Subgraph: Core Library
    subgraph "Core Library"
        DataModel["GeoJSON Data Model"]:::datamodel
        Calculation["Distance Calculation Utility"]:::calculator
    end

    %% Subgraph: Supporting Infrastructure
    subgraph "Supporting Infrastructure"
        Testing["Unit Test Suite"]:::testing
        BuildGradle["build.gradle.kts"]:::cicd
        SettingsGradle["settings.gradle.kts"]:::cicd
        GitHub[".github (Workflows & CodeQL)"]:::cicd
    end

    %% Connections for Client Interaction and Jackson Integration
    Client -->|"registers"| ObjectMapper
    ObjectMapper -->|"registers"| GeoZenModule

    %% Connections within Jackson Integration and Core Library
    GeoZenModule -->|"handles"| Serializers
    GeoZenModule -->|"handles"| Deserializers
    GeoZenModule -->|"operates on"| DataModel

    %% Connection from Core Library to Geometric Calculation
    DataModel -->|"provides-data-to"| Calculation

    %% Connections for Testing involvement
    Testing ---|"tests"| DataModel
    Testing ---|"tests"| GeoZenModule
    Testing ---|"tests"| Calculation

    %% Connections for Build and CI/CD Pipeline
    BuildGradle -->|"builds"| DataModel
    BuildGradle -->|"builds"| GeoZenModule
    SettingsGradle -->|"builds"| DataModel
    GitHub -->|"triggers"| Testing

    %% Click Events for Component Mapping
    click DataModel "https://github.com/fgoerner/geozen/tree/main/src/main/java/dev/goerner/geozen/model"
    click GeoZenModule "https://github.com/fgoerner/geozen/blob/main/src/main/java/dev/goerner/geozen/model/jackson/GeoZenModule.java"
    click Deserializers "https://github.com/fgoerner/geozen/tree/main/src/main/java/dev/goerner/geozen/model/jackson/deserializer"
    click Serializers "https://github.com/fgoerner/geozen/tree/main/src/main/java/dev/goerner/geozen/model/jackson/serializer"
    click Calculation "https://github.com/fgoerner/geozen/blob/main/src/main/java/dev/goerner/geozen/calc/DistanceCalculator.java"
    click Testing "https://github.com/fgoerner/geozen/tree/main/src/test"
    click BuildGradle "https://github.com/fgoerner/geozen/blob/main/build.gradle.kts"
    click SettingsGradle "https://github.com/fgoerner/geozen/blob/main/settings.gradle.kts"
    click GitHub "https://github.com/fgoerner/geozen/blob/main/.github"

    %% Styles
    classDef client fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef objectmapper fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef integration fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef datamodel fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef calculator fill:#FFDEAD,stroke:#333,stroke-width:2px;
    classDef testing fill:#D3D3D3,stroke:#333,stroke-width:2px;
    classDef cicd fill:#FFA07A,stroke:#333,stroke-width:2px;
```
