# hw-technology-com/geoportal architecture

> Architecture diagram of the GitHub repository hw-technology-com/geoportal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hw-technology-com/geoportal
- Repository: https://github.com/hw-technology-com/geoportal

## Overview

1. **Project shape**
   - This is a **static, client-side geoportal**: no backend application code in the repo, no build system, and no server-rendered pages.
   - The runtime is the browser, with the site hosted on **GitHub Pages**.

2. **Entry point and page shell**
   - `index.html` is the single application entry point.
   - `css/styles.css` provides the global layout and visual system.
   - The UI is likely organized as a single-page experience with sections/modules swapped in the browser rather than full page navigation.

3. **Application orchestration**
   - `js/app.js` acts as the central controller for navigation and UI state.
   - It coordinates which screen/module is active and connects the page shell to the geospatial tools.

4. **Configuration boundary**
   - `js/config.js` is the main integration boundary for environment-specific values.
   - It centralizes the **GeoServer base URL**, workspace name, and layer definitions, so the rest of the app does not hardcode service details.

5. **Map rendering subsystem**
   - `js/viewer.js` is the geospatial viewer built on **OpenLayers**.
   - It is responsible for initializing the map, managing layers, and presenting spatial data in the browser.

6. **WMS visualization flow**
   - `js/wms.js` handles map layer visualization through **WMS GetMap** requests.
   - The browser requests rendered map images from GeoServer, which are overlaid in the OpenLayers viewer.

7. **WFS download flow**
   - `js/download.js` manages feature export via **WFS GetFeature** requests.
   - It supports downloading geospatial data from GeoServer in formats such as **Shapefile ZIP** and **KML**.
   - This is the main data-extraction path, separate from map rendering.

8. **External geospatial service**
   - The application depends on an external **GeoServer** instance hosted at Azure (`geoserver-aqp.azurewebsites.net`).
   - GeoServer is the authoritative source of layers and the place where WMS/WFS requests are served from.

9. **Cross-origin and browser integration**
   - Because the frontend is on GitHub Pages and the services are on a different domain, the architecture depends on **CORS being enabled on GeoServer**.
   - Without that, the browser cannot fetch map and download responses.

10. **Contact subsystem**
   - `js/contact.js` is a separate UI module for contact/form interactions.
   - The repo does not show a dedicated API or mail backend, so this is likely client-side UI behavior or an integration point that still depends on external handling.

11. **Deployment architecture**
   - The repository includes GitHub Actions workflows under `.github/workflows/`.
   - These workflows likely automate static deployment/validation and publish the site to **GitHub Pages**.
   - There is no containerization or cloud app service in the repo itself; hosting is static.

12. **Key architecture diagram boundaries**
   - Draw three main zones:  
     **Browser SPA** (`index.html`, `css`, `js/*`) → **GeoServer WMS/WFS backend** → **Static hosting/CI** via GitHub Pages and GitHub Actions.
   - The important data flows are:
     - user interaction → `app.js` → `viewer.js`/`wms.js` → GeoServer map images
     - user download action → `download.js` → GeoServer feature exports
     - app configuration → `config.js` → all geospatial modules

Main entry points: [`js/app.js`](https://github.com/hw-technology-com/geoportal/blob/main/js/app.js) (App controller), [`js/viewer.js`](https://github.com/hw-technology-com/geoportal/blob/main/js/viewer.js) (Map viewer), [`js/wms.js`](https://github.com/hw-technology-com/geoportal/blob/main/js/wms.js) (WMS overlay), [`js/download.js`](https://github.com/hw-technology-com/geoportal/blob/main/js/download.js) (Downloads)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser_spa["Browser SPA"]
  node_index_html["App shell<br/>page entry<br/>[index.html]"]
  node_styles_css["Global styles<br/>css system<br/>[styles.css]"]
  node_app_js["App controller<br/>spa controller<br/>[app.js]"]
  node_config_js["Config<br/>[config.js]"]
  node_viewer_js["Map viewer<br/>openlayers viewer<br/>[viewer.js]"]
  node_wms_js["WMS overlay<br/>map render<br/>[wms.js]"]
  node_download_js["Downloads<br/>feature export<br/>[download.js]"]
  node_contact_js["Contact UI<br/>contact module<br/>[contact.js]"]
  node_openlayers["OpenLayers<br/>mapping library"]
end

subgraph group_geoserver["GeoServer backend"]
  node_geoserver[("GeoServer<br/>external service")]
  node_wms_service["WMS<br/>map image API"]
  node_wfs_service["WFS<br/>feature API"]
  node_cors{{"CORS<br/>browser policy"}}
end

subgraph group_delivery["Hosting & CI"]
  node_deploy_workflows["GitHub Actions<br/>ci workflows<br/>[deploy.yml]"]
  node_github_pages["GitHub Pages<br/>static hosting"]
end

node_index_html -->|"loads"| node_styles_css
node_index_html -->|"boots"| node_app_js
node_app_js -->|"reads"| node_config_js
node_app_js -->|"orchestrates"| node_viewer_js
node_app_js -->|"routes"| node_download_js
node_app_js -->|"opens"| node_contact_js
node_viewer_js -->|"uses"| node_openlayers
node_viewer_js -->|"requests"| node_wms_js
node_wms_js -->|"uses"| node_config_js
node_download_js -->|"uses"| node_config_js
node_wms_js -->|"GetMap"| node_wms_service
node_download_js -->|"GetFeature"| node_wfs_service
node_wms_service -->|"served by"| node_geoserver
node_wfs_service -->|"served by"| node_geoserver
node_geoserver -->|"must allow"| node_cors
node_deploy_workflows -->|"publishes"| node_github_pages
node_github_pages -->|"hosts"| node_index_html

click node_index_html "https://github.com/hw-technology-com/geoportal/blob/main/index.html"
click node_styles_css "https://github.com/hw-technology-com/geoportal/blob/main/css/styles.css"
click node_app_js "https://github.com/hw-technology-com/geoportal/blob/main/js/app.js"
click node_config_js "https://github.com/hw-technology-com/geoportal/blob/main/js/config.js"
click node_viewer_js "https://github.com/hw-technology-com/geoportal/blob/main/js/viewer.js"
click node_wms_js "https://github.com/hw-technology-com/geoportal/blob/main/js/wms.js"
click node_download_js "https://github.com/hw-technology-com/geoportal/blob/main/js/download.js"
click node_contact_js "https://github.com/hw-technology-com/geoportal/blob/main/js/contact.js"
click node_deploy_workflows "https://github.com/hw-technology-com/geoportal/blob/main/.github/workflows/deploy.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_index_html,node_styles_css,node_app_js,node_config_js,node_viewer_js,node_wms_js,node_download_js,node_contact_js,node_openlayers toneBlue
class node_geoserver,node_wms_service,node_wfs_service,node_cors toneAmber
class node_deploy_workflows,node_github_pages toneMint
```

## Components

### Browser SPA

Client-side static application running in the browser.

- [App shell](https://github.com/hw-technology-com/geoportal/blob/main/index.html): page entry · Single-page entry point that loads the application UI. · `index.html`
- [Global styles](https://github.com/hw-technology-com/geoportal/blob/main/css/styles.css): css system · Site-wide layout and visual system. · `css/styles.css`
- [App controller](https://github.com/hw-technology-com/geoportal/blob/main/js/app.js): spa controller · Coordinates navigation, UI state, and module wiring. · `js/app.js`
- [Config](https://github.com/hw-technology-com/geoportal/blob/main/js/config.js): integration config · Centralizes GeoServer URL, workspace, and layer definitions. · `js/config.js`
- [Map viewer](https://github.com/hw-technology-com/geoportal/blob/main/js/viewer.js): openlayers viewer · Initializes the browser map and manages spatial layers. · `js/viewer.js`
- [WMS overlay](https://github.com/hw-technology-com/geoportal/blob/main/js/wms.js): map render · Builds WMS requests for rendered map images. · `js/wms.js`
- [Downloads](https://github.com/hw-technology-com/geoportal/blob/main/js/download.js): feature export · Handles WFS-based exports such as Shapefile ZIP and KML. · `js/download.js`
- [Contact UI](https://github.com/hw-technology-com/geoportal/blob/main/js/contact.js): contact module · Client-side contact/form interaction module. · `js/contact.js`
- **OpenLayers**: mapping library · Browser mapping library used by the viewer.

### GeoServer backend

External geospatial services for rendering and feature export.

- **GeoServer**: external service · Authoritative source for map layers and feature data.
- **WMS**: map image API · Rendered map-image endpoint consumed by the viewer.
- **WFS**: feature API · Feature-download endpoint used for data exports.
- **CORS**: browser policy · Cross-origin access required for browser requests to GeoServer.

### Hosting & CI

Static deployment and workflow automation.

- [GitHub Actions](https://github.com/hw-technology-com/geoportal/blob/main/.github/workflows/deploy.yml): ci workflows · Static validation and deployment automation. · `.github/workflows/deploy.yml`
- **GitHub Pages**: static hosting · Publishes the static site for browser delivery.

## Connections

- App shell → Global styles: loads · The page shell applies the global stylesheet.
- App shell → App controller: boots · The page entry loads the main application controller.
- App controller → Config: reads · The app consumes shared service and layer configuration.
- App controller → Map viewer: orchestrates · Main UI state activates the geospatial viewer.
- App controller → Downloads: routes · Download actions are delegated to the export module.
- App controller → Contact UI: opens · Contact interactions are handled in a separate UI module.
- Map viewer → OpenLayers: uses · The viewer is implemented on top of OpenLayers.
- Map viewer → WMS overlay: requests · Map layers are rendered through WMS overlay requests.
- WMS overlay → Config: uses · WMS requests use the shared GeoServer configuration.
- Downloads → Config: uses · WFS export requests use the shared GeoServer configuration.
- WMS overlay → WMS: GetMap · Browser map images are fetched from GeoServer WMS.
- Downloads → WFS: GetFeature · Feature exports are fetched from GeoServer WFS.
- WMS → GeoServer: served by · GeoServer provides the WMS endpoint.
- WFS → GeoServer: served by · GeoServer provides the WFS endpoint.
- GeoServer → CORS: must allow · Cross-origin browser requests depend on CORS configuration.
- GitHub Actions → GitHub Pages: publishes · GitHub Actions deploy the static site to GitHub Pages.
- GitHub Pages → App shell: hosts · The static host serves the browser entry point and assets.
