# ua-snap/ardac-explorer architecture

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

- Interactive diagram: https://gitdiagram.com/ua-snap/ardac-explorer
- Repository: https://github.com/ua-snap/ardac-explorer

## Overview

Based on our analysis of the file tree and the README, ARDAC Explorer is a Nuxt.js (Vue) based full-stack web application that provides an interactive, map-intensive UI with rich content—including charts, items, and geospatial data visualization. The system is designed to serve both static and dynamic pages, integrate external geospatial services (like GeoServer, Rasdaman, and SNAP), and deploy as a statically generated website (with AWS S3 and CloudFront) while also offering robust local development support.

##### Main Components
- Client-Side Application:
– The Nuxt.js-based Vue SPA forms the heart of the frontend. Identify the key folders:
▪ Pages: (“pages/index.vue”, “pages/about.vue”, etc.) which define the different views.
▪ Layouts: (“layouts/default.vue”, “layouts/home.vue”) that provide common page structure.
▪ Components: an extensive collection including both general components (e.g., Header.vue, Footer.vue, Navbar.vue) and specialized “global” components (e.g., climate charts and map visualizations) used across the site.
▪ Stores: Vuex (or its Nuxt store module) used for managing state for charts, maps, and other data modules.
▪ Plugins: for integrating third-party libraries (Leaflet, Plotly, Lodash, etc.) and custom utilities.
▪ Assets & Public: static assets including geospatial data (GeoJSON files), images, styles (SCSS), and preview files.
- External Services & APIs:
– Highlight the external endpoints configured via environment variables:
▪ GEOSERVER_URL – for WMS map services.
▪ RASDAMAN_URL – for accessing rasdaman OWS (likely for spatiotemporal data queries).
▪ SNAP_API_URL – for additional Earth science data.
- Server-Side & Build Tools:
– Nuxt’s server folder (with its TS configuration) which may coordinate SSR or API handling.
– Scripts (e.g., csv2json.cjs) and configuration files (nuxt.config.ts, package.json, tsconfig.json) that drive the build and development process.
- Deployment Infrastructure:
– AWS S3 bucket for static website hosting.
– CloudFront for caching and distribution, with specific instructions for invalidations.
– CI/CD elements as noted by the deployment “npm run generate” command and AWS CLI usage.

##### Relationships and Interactions
- Pages load and compose various components which further depend on the state management in Stores and data provided by Assets.
- Plugins initialize and enhance functionality at startup (e.g., Leaflet maps, Plotly charts) and should be illustrated as middleware between the UI components and low-level external libraries.
- The Server processes requests (if using SSR or API route endpoints) and serves the pre-rendered pages which are built into a static site.
- The deployment pipeline (build, generate, AWS S3 upload, CloudFront invalidation) should be depicted as a separate process that finalizes the static site contents.

##### Architectural Patterns & Design Principles
- Component-Based Architecture: Emphasize separation between reusable Vue components and pages.
- Integration with External Services: Indicate how data flows from external geoservices (GeoServer, Rasdaman, SNAP) into the client application.
- Static Site Generation with Hydration: Notice that while the site is built statically, techniques in “app.vue” are used to catch and route dynamic redirects – mark this in the flow.

##### Technology, Frameworks, and Libraries
- Nuxt.js/Vue.js is the primary framework.
- SCSS for styling.
- Leaflet (with proj4leaflet plugin) for mapping.
- Plotly for advanced chart rendering.
- Lodash for utility functions.
- AWS (S3 and CloudFront) for hosting and distribution.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client-Side Application
    subgraph "Client-Side Application (Nuxt/Vue SPA)"
        Pages["Pages (Views)"]:::frontend
        Layouts["Layouts (Common Structures)"]:::frontend
        Components["Components (UI Elements)"]:::frontend
        Stores["Stores (State Management)"]:::frontend
        Plugins["Plugins (Third-Party & Utilities)"]:::frontend
        Assets["Assets & Public (Static Files)"]:::frontend
    end

    %% External Services & APIs
    subgraph "External Services & APIs"
        GeoServer["GeoServer (WMS)"]:::external
        Rasdaman["Rasdaman (OWS)"]:::external
        SNAP["SNAP_API (EarthData)"]:::external
    end

    %% Server-Side & Build Tools
    subgraph "Server & Build"
        Server["Server-Side (SSR/API)"]:::server
        Build["Build & Configuration"]:::build
    end

    %% Deployment Infrastructure
    subgraph "Deployment Infrastructure"
        S3["AWS S3 (Static Hosting)"]:::deployment
        CloudFront["CloudFront (CDN)"]:::deployment
        CICD["CI_CD_Pipeline"]:::deployment
    end

    %% Relationships within Client-Side Application
    Pages -->|"uses_layout"| Layouts
    Pages -->|"composes"| Components
    Pages -->|"manages_state"| Stores
    Components -->|"loads_assets"| Assets
    Plugins -->|"enhances"| Components

    %% Client-Side data flows to External Services
    Pages ---|"calls_geoservice"| GeoServer
    Pages ---|"calls_geoservice"| Rasdaman
    Pages ---|"calls_geoservice"| SNAP
    Plugins ---|"integrates_with"| GeoServer
    Plugins ---|"integrates_with"| Rasdaman
    Plugins ---|"integrates_with"| SNAP

    %% Server providing SSR to Client
    Server -->|"serves_pages"| Pages

    %% Build and Deployment Flow
    CICD -->|"triggers_build"| Build
    Build -->|"generates_static_site"| S3
    S3 -->|"distributes_via"| CloudFront

    %% Click Events for Client-Side Components
    click Pages "https://github.com/ua-snap/ardac-explorer/tree/main/pages"
    click Layouts "https://github.com/ua-snap/ardac-explorer/tree/main/layouts"
    click Components "https://github.com/ua-snap/ardac-explorer/tree/main/components"
    click Stores "https://github.com/ua-snap/ardac-explorer/tree/main/stores"
    click Plugins "https://github.com/ua-snap/ardac-explorer/tree/main/plugins"
    click Assets "https://github.com/ua-snap/ardac-explorer/tree/main/assets"

    %% Click Events for Server and Build Tools
    click Server "https://github.com/ua-snap/ardac-explorer/tree/main/server"
    click Build "https://github.com/ua-snap/ardac-explorer/blob/main/nuxt.config.ts"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef external fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef server fill:#FFC0CB,stroke:#000,stroke-width:2px;
    classDef build fill:#FFA07A,stroke:#000,stroke-width:2px;
    classDef deployment fill:#FFD700,stroke:#000,stroke-width:2px;
```
