Repository navigation
Description
Problem
`data.nemar.org//metadata.json` is the long pole on the website's dataset detail SSR critical path. Measured directly from a US-West machine:
- TTFB: 896 ms (cold)
- Payload: 41 KB uncompressed
Most of those 41 KB are fields the page header doesn't need at SSR time:
- `authors[]` (often dozens of entries with affiliations + ORCIDs)
- `funding[]`
- `related_identifiers[]`
- `keywords[]`
- Full `description` text
The header/Hero only needs: `name`, short `description` blurb, `recording_modality`, `tasks`, `external_links.dataset_doi`, `external_links.github_url`. About 1–2 KB worth.
Ask
Add a second endpoint that returns just the header-critical fields:
```
GET https://data.nemar.org//metadata-summary.json
-> 200 application/json
{
"id": "on005262",
"name": "...",
"short_description": "...", // first 280 chars of description
"recording_modality": ["EEG"],
"tasks": ["inner-speech"],
"license": "...",
"github_url": "...",
"dataset_doi": "...",
"openneuro_id": "ds005262", // null if NEMAR-native
"latest_version": "v1.0.0"
}
```
Target: <3 KB, <100 ms TTFB.
Full `metadata.json` continues to serve the right-rail DetailRail panel (authors, funding, etc.), which the website now fetches client-side via its own `/api/dataset//readme` and `/api/dataset//tree` endpoints (see nemarOrg/website@c15a199).
Why it matters
Combined with the recent website-side defer refactor, the detail page TTFB went from ~2.5 s to ~0.34–1.1 s. The remaining cold-page floor is exactly this `metadata.json` fetch. Slimming it would put the detail page below 300 ms cold consistently.
Implementation hint
If a separate endpoint is heavyweight to add, an alternative is a query-param projection on the existing endpoint:
```
GET //metadata.json?fields=name,short_description,recording_modality,tasks,license,external_links.dataset_doi,external_links.github_url
```
Either form unblocks the perf gain.
Related
- Epic: Redesign nemar.org on Cloudflare Pages + Astro, reusing data.nemar.org website#1 (redesign epic)
- OpenNeuro import path doesn't backfill modalities, tasks, subject_count into the D1 catalog #512 (OpenNeuro DOI backfill — same code path)
Activity