# digitalservicebund/backend-challenge-review-typescript architecture

> Architecture diagram of the GitHub repository digitalservicebund/backend-challenge-review-typescript, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/digitalservicebund/backend-challenge-review-typescript
- Repository: https://github.com/digitalservicebund/backend-challenge-review-typescript

## Overview

This small Express dashboard serves one workflow: a browser requests the page, the application fetches GovData organization counts, aggregates each ministry with its listed subordinate agencies, sorts the results, and renders an HTML table. The department list supplies the ministry hierarchy; CKAN is the external data source. The main runtime calls are visible in the excerpts. The departments JSON contents were not sampled, so its role is based on the application import and README description.

Main entry points: [`app.ts`](https://github.com/digitalservicebund/backend-challenge-review-typescript/blob/main/app.ts) (HTTP route and orchestration), [`src/services/govdata-ckan-service.ts`](https://github.com/digitalservicebund/backend-challenge-review-typescript/blob/main/src/services/govdata-ckan-service.ts) (Dataset count aggregation and sorting), [`src/clients/govdata-ckan-client.ts`](https://github.com/digitalservicebund/backend-challenge-review-typescript/blob/main/src/clients/govdata-ckan-client.ts) (Organization data client), [`src/services/rendering-service.ts`](https://github.com/digitalservicebund/backend-challenge-review-typescript/blob/main/src/services/rendering-service.ts) (HTML table rendering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Dashboard runtime"]
  node_app["HTTP route and orchestration<br/>[app.ts]"]
  node_client["Organization data client"]
  node_rendering["HTML table rendering"]
end

subgraph group_domain["Ministry aggregation"]
  node_department_list["Ministry and agency list<br/>[departments.json]"]
  node_aggregation["Dataset count aggregation and sorting"]
  node_departments["Ministry hierarchy lookup"]
end

node_visitor(("Dashboard visitor"))
node_ckan{{"GovData CKAN API"}}

node_visitor -->|"requests page"| node_app
node_app -->|"fetches organizations"| node_client
node_client -->|"requests organization counts"| node_ckan
node_app -->|"loads ministry list"| node_department_list
node_app -->|"requests counts and sort"| node_aggregation
node_aggregation -->|"looks up ministries"| node_departments
node_aggregation -->|"supplies sorted counts"| node_rendering
node_app -->|"sends HTML"| node_visitor

click node_app "https://github.com/digitalservicebund/backend-challenge-review-typescript/blob/main/app.ts"
click node_client "https://github.com/digitalservicebund/backend-challenge-review-typescript/blob/main/src/clients/govdata-ckan-client.ts"
click node_department_list "https://github.com/digitalservicebund/backend-challenge-review-typescript/blob/main/src/data/departments.json"
click node_aggregation "https://github.com/digitalservicebund/backend-challenge-review-typescript/blob/main/src/services/govdata-ckan-service.ts"
click node_departments "https://github.com/digitalservicebund/backend-challenge-review-typescript/blob/main/src/services/departments-service.ts"
click node_rendering "https://github.com/digitalservicebund/backend-challenge-review-typescript/blob/main/src/services/rendering-service.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_app,node_client,node_rendering toneBlue
class node_department_list,node_aggregation,node_departments toneAmber
class node_visitor toneIndigo
class node_ckan toneMint
```

## Components

### Dashboard runtime

- [HTTP route and orchestration](https://github.com/digitalservicebund/backend-challenge-review-typescript/blob/main/app.ts): `app.ts`
- [Organization data client](https://github.com/digitalservicebund/backend-challenge-review-typescript/blob/main/src/clients/govdata-ckan-client.ts): `src/clients/govdata-ckan-client.ts`
- [HTML table rendering](https://github.com/digitalservicebund/backend-challenge-review-typescript/blob/main/src/services/rendering-service.ts): `src/services/rendering-service.ts`

### Ministry aggregation

- [Ministry and agency list](https://github.com/digitalservicebund/backend-challenge-review-typescript/blob/main/src/data/departments.json): `src/data/departments.json`
- [Dataset count aggregation and sorting](https://github.com/digitalservicebund/backend-challenge-review-typescript/blob/main/src/services/govdata-ckan-service.ts): `src/services/govdata-ckan-service.ts`
- [Ministry hierarchy lookup](https://github.com/digitalservicebund/backend-challenge-review-typescript/blob/main/src/services/departments-service.ts): `src/services/departments-service.ts`

### Other components

- **Dashboard visitor**
- **GovData CKAN API**

## Connections

- Dashboard visitor → HTTP route and orchestration: requests page (evidence: `app.ts`)
- HTTP route and orchestration → Organization data client: fetches organizations (evidence: `app.ts`)
- Organization data client → GovData CKAN API: requests organization counts (evidence: `src/clients/govdata-ckan-client.ts`)
- HTTP route and orchestration → Ministry and agency list: loads ministry list (evidence: `app.ts`)
- HTTP route and orchestration → Dataset count aggregation and sorting: requests counts and sort (evidence: `app.ts`)
- Dataset count aggregation and sorting → Ministry hierarchy lookup: looks up ministries (evidence: `src/services/govdata-ckan-service.ts`)
- Dataset count aggregation and sorting → HTML table rendering: supplies sorted counts (evidence: `app.ts`)
- HTTP route and orchestration → Dashboard visitor: sends HTML (evidence: `app.ts`)
