# infra-geo-ouverte/igo2-lib architecture

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

- Interactive diagram: https://gitdiagram.com/infra-geo-ouverte/igo2-lib
- Repository: https://github.com/infra-geo-ouverte/igo2-lib

## Overview

##### Main Components
- Demonstration Application – Under “projects/demo” you have a full Angular demo app that shows how to compose and use the various IGO2 modules.
- IGO2 Library Modules – The repository is organized as a monorepo with multiple packages:
– @igo2/utils: Low-level utilities (e.g., base64, uuid, string and date utilities) with zero external dependencies.
– @igo2/core: Core services and application-wide functions (configuration, language handling, messaging, media, requests, etc.).
– @igo2/auth: Authentication and security components employing different providers (Google, Facebook, Microsoft, etc.).
– @igo2/geo: Mapping and geospatial components that depend on OpenLayers and integrate mapping functionalities (catalogs, layers, drawing, query, etc.).
– @igo2/context: Bridges elements from auth and geo to provide integrated context management features.
– @igo2/integration: A set of tools and components that bring together multiple aspects of the library in an integrated fashion.
- Build and Deployment Scripts – The “scripts” folder along with configuration files (angular.json, tsconfig.*, commitlint, eslint, etc.) manage build, test, and release processes.

##### Relationships and Interactions
- The “demo” project acts as a client application consuming the various libraries.
- The core library functions form the backbone used by common UI components and services.
- Authentication components in @igo2/auth work independently and also integrate with @igo2/context for a seamless security and context management experience.
- The utilities module (@igo2/utils) underpins almost all modules by supplying common helper functions.
- Integration services aggregate functionalities from distinct modules (geo, auth, context, etc.) so they can be used together within client applications.

##### Architectural Patterns and Design Principles
- Modular Architecture: Each package is highly decoupled and self-contained to promote reusability and scalability.
- Layered Design: There’s a clear separation between utility functions, core business logic, UI components, and domain-specific modules such as geo and auth.
- Angular Best Practices: The design leverages Angular’s dependency injection, module encapsulation, and component-driven patterns.
- Build & Test Automation: Configuration files and scripts indicate a strong emphasis on automated building, testing, and quality (with tools like ESLint, Karma, and CI/CD workflows).

##### Technologies, Frameworks, and Libraries
- Angular and Angular Material form the UI framework.
- OpenLayers is used for geospatial mapping.
- TypeScript, with its angular.json and tsconfig files, guides the code structure and compilation.
- Standard build tools (npm, scripts with postbuild/prestart actions) and testing tools (Karma, ESLint) are integrated.

## Diagram (Mermaid)

```mermaid
graph TD
    Demo["Demo Application"]:::demo

    subgraph "Library Modules"
        subgraph "Utility Layer"
            Utils["@igo2/utils"]:::utils
        end
        subgraph "Core Layer"
            Core["@igo2/core"]:::core
        end
        subgraph "UI Components"
            Common["@igo2/common"]:::common
        end
        subgraph "Domain Specific"
            Auth["@igo2/auth"]:::auth
            Geo["@igo2/geo"]:::geo
            Context["@igo2/context"]:::context
            Integration["@igo2/integration"]:::integration
        end
    end

    Build["Build & Deployment Scripts"]:::build

    subgraph "External Dependencies"
        Angular["Angular & Angular Material"]:::external
        OpenLayers["OpenLayers"]:::external
    end

    %% Demo Application interactions
    Demo -->|"uses"| Core
    Demo -->|"uses"| Common
    Demo -->|"uses"| Auth
    Demo -->|"uses"| Geo
    Demo -->|"uses"| Context
    Demo -->|"uses"| Integration

    %% Utils provides common functionality
    Utils -->|"provides"| Core
    Utils -->|"provides"| Common
    Utils -->|"provides"| Auth
    Utils -->|"provides"| Geo
    Utils -->|"provides"| Context
    Utils -->|"provides"| Integration

    %% Core supports UI components and mapping
    Core -->|"supports"| Common
    Core -->|"supports"| Geo

    %% Authentication integrates with context
    Auth -->|"integrates"| Context

    %% Domain specific aggregation for integrated features
    Auth -->|"aggregates"| Integration
    Geo -->|"aggregates"| Integration
    Context -->|"aggregates"| Integration

    %% Build and Deployment affects all modules
    Demo -->|"built_by"| Build
    Utils -->|"built_by"| Build
    Core -->|"built_by"| Build
    Common -->|"built_by"| Build
    Auth -->|"built_by"| Build
    Geo -->|"built_by"| Build
    Context -->|"built_by"| Build
    Integration -->|"built_by"| Build

    %% External dependencies usage
    Demo -->|"framework"| Angular
    Geo -->|"mapping"| OpenLayers

    %% Click Events
    click Demo "https://github.com/infra-geo-ouverte/igo2-lib/tree/master/projects/demo"
    click Utils "https://github.com/infra-geo-ouverte/igo2-lib/tree/master/packages/utils"
    click Core "https://github.com/infra-geo-ouverte/igo2-lib/tree/master/packages/core"
    click Common "https://github.com/infra-geo-ouverte/igo2-lib/tree/master/packages/common"
    click Auth "https://github.com/infra-geo-ouverte/igo2-lib/tree/master/packages/auth"
    click Geo "https://github.com/infra-geo-ouverte/igo2-lib/tree/master/packages/geo"
    click Context "https://github.com/infra-geo-ouverte/igo2-lib/tree/master/packages/context"
    click Integration "https://github.com/infra-geo-ouverte/igo2-lib/tree/master/packages/integration"

    %% Styles
    classDef demo fill:#f4f4f4,stroke:#333,stroke-width:2px;
    classDef utils fill:#7fdde7,stroke:#333,stroke-width:2px;
    classDef core fill:#98fb98,stroke:#333,stroke-width:2px;
    classDef common fill:#ffeb99,stroke:#333,stroke-width:2px;
    classDef auth fill:#ff9999,stroke:#333,stroke-width:2px;
    classDef geo fill:#dda0dd,stroke:#333,stroke-width:2px;
    classDef context fill:#ffc107,stroke:#333,stroke-width:2px;
    classDef integration fill:#7fffd4,stroke:#333,stroke-width:2px;
    classDef build fill:#d3d3d3,stroke:#333,stroke-width:2px;
    classDef external fill:#e0ffff,stroke:#333,stroke-width:2px;
```
