# jameslmilner/terra-draw architecture

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

- Interactive diagram: https://gitdiagram.com/jameslmilner/terra-draw
- Repository: https://github.com/jameslmilner/terra-draw

## Overview

##### Project type and purpose
- Project type: A TypeScript-based monorepo library for client-side map drawing.

##### File structure
- Top-level:
- **.github**, **.devcontainer**, CI/CD and dev-container config.
- **packages/**: a workspace containing:
– **development**: local demo site / playground (Webpack, TS)
– **e2e**: end-to-end tests (Playwright)
- Other dirs:
- **docs/** & **guides/**: static site content generated from JSDoc + Markdown
- Root scripts/config: Jest, ESLint, Husky, release scripts, versioning (versionrc.js), TypeScript configs.

##### README for additional insights
- Points to guides on adapters, modes, development.
- Technology stack implied: TypeScript, npm workspaces, Webpack (demo), Jest for unit tests, Playwright for E2E, CI/CD via GitHub Actions.

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% CI/CD Pipeline
  CI["CI/CD Pipeline"]:::cicd
  click CI "https://github.com/jameslmilner/terra-draw/tree/main/.github/workflows/"

  %% Configuration
  ConfigVR["Versioning & Release Scripts"]:::config
  click ConfigVR "https://github.com/jameslmilner/terra-draw/blob/main/.versionrc.js"
  click ConfigVR "https://github.com/jameslmilner/terra-draw/blob/main/release.js"
  click ConfigVR "https://github.com/jameslmilner/terra-draw/blob/main/bump.mjs"
  click ConfigVR "https://github.com/jameslmilner/terra-draw/blob/main/update.mjs"

  ConfigLJ["ESLint & Jest Configs"]:::config
  click ConfigLJ "https://github.com/jameslmilner/terra-draw/blob/main/eslint.config.mjs"
  click ConfigLJ "https://github.com/jameslmilner/terra-draw/blob/main/jest.config.ts"
  click ConfigLJ "https://github.com/jameslmilner/terra-draw/blob/main/jest.nocheck.config.ts"

  CI -->|triggers| ConfigVR
  CI -->|uses| ConfigLJ

  %% Monorepo Workspace
  subgraph "Monorepo Workspace"
    direction TB

    %% Core Engine
    TerraCore["Terra Draw Core Engine"]:::core
    click TerraCore "https://github.com/jameslmilner/terra-draw/tree/main/packages/terra-draw/"

    %% Adapters
    subgraph "Adapters"
      direction TB
      LeafletAd["Leaflet Adapter"]:::adapter
      click LeafletAd "https://github.com/jameslmilner/terra-draw/blob/main/packages/terra-draw-leaflet-adapter/src/terra-draw-leaflet-adapter.ts"

      OpenLayersAd["OpenLayers Adapter"]:::adapter
      click OpenLayersAd "https://github.com/jameslmilner/terra-draw/blob/main/packages/terra-draw-openlayers-adapter/src/terra-draw-openlayers-adapter.ts"

      MapboxGLAd["Mapbox GL Adapter"]:::adapter
      click MapboxGLAd "https://github.com/jameslmilner/terra-draw/blob/main/packages/terra-draw-mapbox-gl-adapter/src/terra-draw-mapbox-gl-adapter.ts"

      MapLibreGLAd["MapLibre GL Adapter"]:::adapter
      click MapLibreGLAd "https://github.com/jameslmilner/terra-draw/blob/main/packages/terra-draw-maplibre-gl-adapter/src/terra-draw-maplibre-gl-adapter.ts"

      GoogleMapsAd["Google Maps Adapter"]:::adapter
      click GoogleMapsAd "https://github.com/jameslmilner/terra-draw/blob/main/packages/terra-draw-google-maps-adapter/src/terra-draw-google-maps-adapter.ts"

      ArcGISAd["ArcGIS Adapter"]:::adapter
      click ArcGISAd "https://github.com/jameslmilner/terra-draw/blob/main/packages/terra-draw-arcgis-adapter/src/terra-draw-arcgis-adapter.ts"
    end

    %% Demo and E2E
    Demo["Demo/Development Site"]:::demo
    click Demo "https://github.com/jameslmilner/terra-draw/tree/main/packages/development/"

    E2E["End-to-End Test Suite"]:::test
    click E2E "https://github.com/jameslmilner/terra-draw/tree/main/packages/e2e/"

    %% Documentation
    Docs["Docs & Guides"]:::docs
    click Docs "https://github.com/jameslmilner/terra-draw/tree/main/docs/"
    click Docs "https://github.com/jameslmilner/terra-draw/tree/main/guides/"
  end

  %% External Mapping Libraries
  subgraph "External Mapping Libraries"
    direction TB
    Lf["Leaflet"]:::external
    OL["OpenLayers"]:::external
    MBGL["Mapbox GL"]:::external
    MLGL["MapLibre GL"]:::external
    GM["Google Maps SDK"]:::external
    AG["ArcGIS SDK"]:::external
  end

  %% Relationships
  TerraCore -->|implements interface| LeafletAd
  TerraCore -->|implements interface| OpenLayersAd
  TerraCore -->|implements interface| MapboxGLAd
  TerraCore -->|implements interface| MapLibreGLAd
  TerraCore -->|implements interface| GoogleMapsAd
  TerraCore -->|implements interface| ArcGISAd

  LeafletAd -->|calls API| Lf
  OpenLayersAd -->|calls API| OL
  MapboxGLAd -->|calls API| MBGL
  MapLibreGLAd -->|calls API| MLGL
  GoogleMapsAd -->|calls API| GM
  ArcGISAd -->|calls API| AG

  Demo -->|imports| TerraCore
  Demo -->|uses adapters| LeafletAd
  Demo -->|uses adapters| OpenLayersAd
  Demo -->|uses adapters| MapboxGLAd
  Demo -->|uses adapters| MapLibreGLAd
  Demo -->|uses adapters| GoogleMapsAd
  Demo -->|uses adapters| ArcGISAd

  E2E -->|runs tests on| Demo

  CI -->|runs tests/builds| TerraCore
  CI -->|runs tests/builds| LeafletAd
  CI -->|runs tests/builds| OpenLayersAd
  CI -->|runs tests/builds| MapboxGLAd
  CI -->|runs tests/builds| MapLibreGLAd
  CI -->|runs tests/builds| GoogleMapsAd
  CI -->|runs tests/builds| ArcGISAd
  CI -->|runs tests/builds| Demo
  CI -->|runs E2E| E2E
  CI -->|builds docs| Docs

  %% Styles
  classDef core fill:#cfe2f3,stroke:#2f5597,color:#0b5394,stroke-width:2px;
  classDef adapter fill:#d9ead3,stroke:#38761d,color:#215b0c,stroke-width:2px;
  classDef external fill:#f2f2f2,stroke:#7f7f7f,color:#444444,stroke-width:1px,stroke-dasharray: 2 2;
  classDef demo fill:#ffe599,stroke:#b45f06,color:#663c00,stroke-width:2px;
  classDef test fill:#d9d2e9,stroke:#5b0fbe,color:#351c75,stroke-width:2px;
  classDef docs fill:#fff2cc,stroke:#bf9000,color:#7f6000,stroke-width:2px;
  classDef cicd fill:#f4cccc,stroke:#cc0000,color:#990000,stroke-width:2px;
  classDef config fill:#e7e6e6,stroke:#888888,color:#333333,stroke-width:1px;
```
