← All projects
Case study · Hydrology

Basin Explorer.

Satellite explorers of Argentine river basins on a shared codebase: Río Negro (8,016 river reaches, 25 sub-basins) and the Córdoba basins. Custom TypeScript/DuckDB/GDAL data pipeline with automated checks at every step; natural-language search where an LLM picks rivers and metrics but never writes numbers.

(01) The problem

Values with a
source.

Explore river basins on satellite imagery, with every value traceable to its source.

Tap a river, a reach or a sub-basin to open a panel with its metrics. The Río Negro explorer covers 8,016 river reaches and 25 sub-basins.

(02) Architecture

No separate
backend.

Geometry and metadata live apart and meet on a feature id. This is the path of a click on the map:

Static PMTiles

River and basin geometry is served as static PMTiles vector tiles, which the browser reads with HTTP range requests.

Feature id

Every feature in the tiles carries an id that matches a document in MongoDB, so a click knows exactly what to fetch.

CDN-cached route handlers

The click reaches Next.js route handlers whose responses are cached on a CDN.

Read-only MongoDB

Metadata lives in MongoDB and is read only from Server Components and Route Handlers, through a read-only database user.

There is no separate backend: the Next.js app is the whole stack.

(03) Data pipeline

Checked at every
step.

The data is built by a pipeline of TypeScript steps that run DuckDB and tippecanoe.

Each step writes a report.json and runs automated checks.

(04) LLM search

The model never writes
numbers.

A natural-language ask box answers questions like “Which is longer, Caleufú or Agrio?”.

The LLM only picks the rivers and the measure. The values in the answer are read from the data and shown with their source and, where they apply, the caveats on modeled data.

(05) Multi-region

One codebase, many
basins.

Each region is its own explorer on a shared codebase: Río Negro at /rionegro and the Córdoba basins at /cordoba.

Regions are declared in a registry with their own config, messages and content, and share every component.

(06) Stack

What it's
built with.

Core stack
Next.js, TypeScript, MapLibre GL, PMTiles, DuckDB, GDAL, MongoDB
Also
Zustand, next-intl, zod, Tailwind CSS, Vitest, Playwright, tippecanoe