# maf248/eco-metrics-earth architecture

> Architecture diagram of the GitHub repository maf248/eco-metrics-earth, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/maf248/eco-metrics-earth
- Repository: https://github.com/maf248/eco-metrics-earth

## Overview

eco-metrics earth is an environmental-metrics dashboard: people browse category pages and data-source information, while a Next.js frontend presents data served by a NestJS API. The API exposes metric-specific endpoints, uses provider-backed and bundled datasets, and returns attributed, freshness-aware responses. The README also names capabilities whose implementation is not represented in the sampled excerpts; those remain visible as API domain nodes. Relationships are limited to documented routes and excerpted controller calls; provider-fetch and browser-to-API wiring is not fully evidenced here.

Main entry points: [`apps/api/src/app/app.module.ts`](https://github.com/maf248/eco-metrics-earth/blob/main/apps/api/src/app/app.module.ts) (API application), [`apps/api/src/modules/ocean-health/ocean-health.controller.ts`](https://github.com/maf248/eco-metrics-earth/blob/main/apps/api/src/modules/ocean-health/ocean-health.controller.ts) (Ocean health), [`apps/web/src/app/[category]/page.tsx`](https://github.com/maf248/eco-metrics-earth/blob/main/apps/web/src/app/%5Bcategory%5D/page.tsx) (Category pages), [`apps/api/src/modules/providers/owid/owid-client.service.ts`](https://github.com/maf248/eco-metrics-earth/blob/main/apps/api/src/modules/providers/owid/owid-client.service.ts) (Our World in Data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Dashboard"]
  node_webpages["Category pages<br/>[page.tsx]"]
  node_webcomponents["Metric visualizations"]
  node_sourcespage["Source catalog page<br/>[page.tsx]"]
end

subgraph group_api["Metrics API"]
  node_apiapp["API application<br/>[app.module.ts]"]
  node_datasources["Source catalog endpoint"]
  node_co2["CO₂ emissions"]
  node_temperature["Global temperature"]
  node_deforestation["Forest metrics"]
  node_energy["Energy sources"]
  node_ocean["Ocean health"]
  node_waste["Waste recycling"]
  node_water["Water footprint"]
  node_othercapabilities["Other climate topics"]
end

subgraph group_providers["Data providers"]
  node_owid["Our World in Data"]
  node_copernicus["Copernicus climate"]
  node_noaa["NOAA sea level"]
end

subgraph group_shared["Shared contracts"]
  node_contracts["Metric data contracts<br/>[country-series.ts]"]
end

node_visitor(("Dashboard visitor"))

node_visitor -->|"browses"| node_webpages
node_webpages -.->|"renders"| node_webcomponents
node_visitor -->|"views sources"| node_sourcespage
node_apiapp -->|"registers"| node_datasources
node_apiapp -->|"registers"| node_co2
node_apiapp -->|"registers"| node_temperature
node_apiapp -->|"registers"| node_deforestation
node_apiapp -->|"registers"| node_energy
node_apiapp -->|"registers"| node_ocean
node_apiapp -->|"registers"| node_waste
node_apiapp -->|"registers"| node_water
node_apiapp -.->|"registers"| node_othercapabilities
node_datasources -->|"returns catalog"| node_contracts
node_deforestation -->|"uses envelope"| node_owid
node_energy -->|"uses envelope"| node_owid
node_ocean -->|"uses envelope"| node_owid
node_ocean -.->|"fetches data"| node_copernicus
node_ocean -.->|"fetches data"| node_noaa
node_waste -->|"returns metric data"| node_contracts
node_webpages -.->|"requests metrics"| node_apiapp

click node_webpages "https://github.com/maf248/eco-metrics-earth/blob/main/apps/web/src/app/%5Bcategory%5D/page.tsx"
click node_webcomponents "https://github.com/maf248/eco-metrics-earth/tree/main/apps/web/src/components"
click node_sourcespage "https://github.com/maf248/eco-metrics-earth/blob/main/apps/web/src/app/data-sources/page.tsx"
click node_apiapp "https://github.com/maf248/eco-metrics-earth/blob/main/apps/api/src/app/app.module.ts"
click node_datasources "https://github.com/maf248/eco-metrics-earth/blob/main/apps/api/src/modules/data-sources/data-sources.controller.ts"
click node_co2 "https://github.com/maf248/eco-metrics-earth/tree/main/apps/api/src/modules/co2-emissions"
click node_temperature "https://github.com/maf248/eco-metrics-earth/tree/main/apps/api/src/modules/global-temperature"
click node_deforestation "https://github.com/maf248/eco-metrics-earth/tree/main/apps/api/src/modules/deforestation"
click node_energy "https://github.com/maf248/eco-metrics-earth/tree/main/apps/api/src/modules/energy-sources"
click node_ocean "https://github.com/maf248/eco-metrics-earth/blob/main/apps/api/src/modules/ocean-health/ocean-health.controller.ts"
click node_waste "https://github.com/maf248/eco-metrics-earth/blob/main/apps/api/src/modules/waste-recycling/waste-recycling.controller.ts"
click node_water "https://github.com/maf248/eco-metrics-earth/tree/main/apps/api/src/modules/water-footprint"
click node_othercapabilities "https://github.com/maf248/eco-metrics-earth/tree/main/apps/api/src/modules"
click node_owid "https://github.com/maf248/eco-metrics-earth/blob/main/apps/api/src/modules/providers/owid/owid-client.service.ts"
click node_copernicus "https://github.com/maf248/eco-metrics-earth/blob/main/apps/api/src/modules/providers/copernicus-climate-pulse/copernicus-climate-pulse-client.service.ts"
click node_noaa "https://github.com/maf248/eco-metrics-earth/blob/main/apps/api/src/modules/providers/noaa-lsa/noaa-lsa-client.service.ts"
click node_contracts "https://github.com/maf248/eco-metrics-earth/blob/main/packages/shared/src/lib/country-series.ts"

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_webpages,node_webcomponents,node_sourcespage toneBlue
class node_apiapp,node_datasources,node_co2,node_temperature,node_deforestation,node_energy,node_ocean,node_waste,node_water,node_othercapabilities toneAmber
class node_owid,node_copernicus,node_noaa toneMint
class node_contracts toneRose
class node_visitor toneIndigo
```

## Components

### Dashboard

- [Category pages](https://github.com/maf248/eco-metrics-earth/blob/main/apps/web/src/app/%5Bcategory%5D/page.tsx): `apps/web/src/app/[category]/page.tsx`
- [Metric visualizations](https://github.com/maf248/eco-metrics-earth/tree/main/apps/web/src/components): `apps/web/src/components`
- [Source catalog page](https://github.com/maf248/eco-metrics-earth/blob/main/apps/web/src/app/data-sources/page.tsx): `apps/web/src/app/data-sources/page.tsx`

### Metrics API

- [API application](https://github.com/maf248/eco-metrics-earth/blob/main/apps/api/src/app/app.module.ts): `apps/api/src/app/app.module.ts`
- [Source catalog endpoint](https://github.com/maf248/eco-metrics-earth/blob/main/apps/api/src/modules/data-sources/data-sources.controller.ts): `apps/api/src/modules/data-sources/data-sources.controller.ts`
- [CO₂ emissions](https://github.com/maf248/eco-metrics-earth/tree/main/apps/api/src/modules/co2-emissions): `apps/api/src/modules/co2-emissions`
- [Global temperature](https://github.com/maf248/eco-metrics-earth/tree/main/apps/api/src/modules/global-temperature): `apps/api/src/modules/global-temperature`
- [Forest metrics](https://github.com/maf248/eco-metrics-earth/tree/main/apps/api/src/modules/deforestation): `apps/api/src/modules/deforestation`
- [Energy sources](https://github.com/maf248/eco-metrics-earth/tree/main/apps/api/src/modules/energy-sources): `apps/api/src/modules/energy-sources`
- [Ocean health](https://github.com/maf248/eco-metrics-earth/blob/main/apps/api/src/modules/ocean-health/ocean-health.controller.ts): `apps/api/src/modules/ocean-health/ocean-health.controller.ts`
- [Waste recycling](https://github.com/maf248/eco-metrics-earth/blob/main/apps/api/src/modules/waste-recycling/waste-recycling.controller.ts): `apps/api/src/modules/waste-recycling/waste-recycling.controller.ts`
- [Water footprint](https://github.com/maf248/eco-metrics-earth/tree/main/apps/api/src/modules/water-footprint): `apps/api/src/modules/water-footprint`
- [Other climate topics](https://github.com/maf248/eco-metrics-earth/tree/main/apps/api/src/modules): `apps/api/src/modules`

### Data providers

- [Our World in Data](https://github.com/maf248/eco-metrics-earth/blob/main/apps/api/src/modules/providers/owid/owid-client.service.ts): `apps/api/src/modules/providers/owid/owid-client.service.ts`
- [Copernicus climate](https://github.com/maf248/eco-metrics-earth/blob/main/apps/api/src/modules/providers/copernicus-climate-pulse/copernicus-climate-pulse-client.service.ts): `apps/api/src/modules/providers/copernicus-climate-pulse/copernicus-climate-pulse-client.service.ts`
- [NOAA sea level](https://github.com/maf248/eco-metrics-earth/blob/main/apps/api/src/modules/providers/noaa-lsa/noaa-lsa-client.service.ts): `apps/api/src/modules/providers/noaa-lsa/noaa-lsa-client.service.ts`

### Shared contracts

- [Metric data contracts](https://github.com/maf248/eco-metrics-earth/blob/main/packages/shared/src/lib/country-series.ts): `packages/shared/src/lib/country-series.ts`

### Other components

- **Dashboard visitor**

## Connections

- Dashboard visitor → Category pages: browses (evidence: `apps/web/src/app/[category]/page.tsx`)
- Category pages → Metric visualizations: renders
- Dashboard visitor → Source catalog page: views sources (evidence: `apps/web/src/app/data-sources/page.tsx`)
- API application → Source catalog endpoint: registers (evidence: `apps/api/src/app/app.module.ts`)
- API application → CO₂ emissions: registers (evidence: `apps/api/src/app/app.module.ts`)
- API application → Global temperature: registers (evidence: `apps/api/src/app/app.module.ts`)
- API application → Forest metrics: registers (evidence: `apps/api/src/app/app.module.ts`)
- API application → Energy sources: registers (evidence: `apps/api/src/app/app.module.ts`)
- API application → Ocean health: registers (evidence: `apps/api/src/app/app.module.ts`)
- API application → Waste recycling: registers (evidence: `apps/api/src/app/app.module.ts`)
- API application → Water footprint: registers (evidence: `apps/api/src/app/app.module.ts`)
- API application → Other climate topics: registers (evidence: `apps/api/src/app/app.module.ts`)
- Source catalog endpoint → Metric data contracts: returns catalog (evidence: `apps/api/src/modules/data-sources/data-sources.controller.ts`)
- Forest metrics → Our World in Data: uses envelope (evidence: `apps/api/src/modules/deforestation/deforestation.controller.ts`)
- Energy sources → Our World in Data: uses envelope (evidence: `apps/api/src/modules/energy-sources/energy-sources.controller.ts`)
- Ocean health → Our World in Data: uses envelope (evidence: `apps/api/src/modules/ocean-health/ocean-health.controller.ts`)
- Ocean health → Copernicus climate: fetches data
- Ocean health → NOAA sea level: fetches data
- Waste recycling → Metric data contracts: returns metric data (evidence: `apps/api/src/modules/waste-recycling/waste-recycling.controller.ts`)
- Category pages → API application: requests metrics
