# StormTrust data service

`stormtrust-data` owns source ingestion and read contracts for StormTrust. It does not have a public hostname. The UI workshop and public website reach a small allowlist of read routes through Cloudflare service bindings.

For configured cadence, queue retries, persistence checkpoints, and recovery limits, see [Polling and triggers](/stormtrust/product/platform-and-data/polling-and-triggers/).

## Application reference

| Property                  | Value                               |
| ------------------------- | ----------------------------------- |
| Source                    | org/apps/data/                      |
| Worker                    | stormtrust-data                     |
| Public hostname           | None                                |
| Schedule                  | Every two minutes                   |
| Relational catalog        | D1 binding METADATA                 |
| Objects and map artifacts | R2 binding DATA                     |
| Source work               | Queue binding INGESTION\_QUEUE      |
| Revision notifications    | Queue binding REVISION\_QUEUE       |
| Live event rooms          | Durable Object binding EVENT\_ROOMS |
| Verification              | make app-verify APP=data            |

## Implemented flow

```txt
NOAA MRMS on AWS
        ↓
Two-minute discovery
        ↓
D1 source asset and version
        ↓
Ingestion Queue
        ↓
R2 raw object + rendered layer
        ↓
D1 timestamp-aligned revision
        ↓
R2 immutable revision manifest
        ↓
D1 outbox → Revision Queue
        ↓
Event Durable Object → WebSocket clients
```

D1 and R2 remain authoritative. Queues may deliver more than once. Durable Objects coordinate connected clients but do not become the system of record. The browser receives a revision notice, then reads the versioned revision API.

## Read routes

| Route                                    | Purpose                                                            |
| ---------------------------------------- | ------------------------------------------------------------------ |
| GET /api/geocode                         | Search a place and return coordinates and an optional bounding box |
| GET /api/mrms/history                    | Read the latest operational MRMS revisions                         |
| GET /api/storm-events                    | List available operational and benchmark events                    |
| GET /api/storm-events/:eventId/revisions | Read complete revisions for one event                              |
| GET /api/storm-events/:eventId/stream    | Receive revision notices over a WebSocket                          |
| GET /api/data/status                     | Inspect the latest source product state                            |

The two-minute scheduler invokes incomplete benchmark definitions checked into `org/apps/data/benchmarks/` after the trusted workflow applies migrations and deploys the Worker. D1 status makes the bootstrap idempotent, so later scheduled runs skip completed benchmarks and safely resume incomplete work.

The internal `POST /internal/backfills/mrms` route also registers a bounded historical MRMS window and queues it through the same decoder used by live data. Frontend Workers do not proxy this route.

## Ownership

Terraform owns the Worker identity, D1 database, R2 bucket, Queues, and dead-letter queues. Wrangler owns application code, bindings, the schedule, queue consumers, Durable Object migrations, deployments, and observability.

Review [Datasets and source contracts](/stormtrust/product/platform-and-data/datasets-and-source-contracts/) before adding a source. Review [Live revisions and historical evaluation](/stormtrust/product/platform-and-data/live-revisions-and-historical-evaluation/) before changing replay or model-evaluation behavior.

## Operational guides

Use the shared [validation and deployment guides](/stormtrust/engineering/operations/) and [health evidence by app](/stormtrust/engineering/operations/health/#evidence-by-application). For a failed release, follow [recovery procedures](/stormtrust/engineering/operations/recover/) with this application's state and access boundaries.
