Skip to content

Repository files navigation

Earth Event Atlas

Earth Event Atlas is an independent, map-first public explorer for NASA EONET natural-event records. It combines a searchable globe, time-range navigation, source-oriented event details, local Saved events, and a two-record comparison workspace over a typed database-backed mirror.

NASA EONET and the upstream sources listed on each record provide the data. Earth Event Atlas is not affiliated with or endorsed by NASA.

Run Locally On WSL2

Run Postgres, apply the schema, and sync EONET before starting the app:

cp .env.example .env.local
docker compose up -d postgres
npm install
npm run db:generate
npm run db:migrate
npm run eonet:sync
npm run dev

Open http://localhost:3000.

For a larger historical dataset, run:

npm run eonet:backfill

Useful commands:

npm run db:generate
npm run db:migrate
npm run db:deploy
npm run lint
npm run typecheck
npm run test:run
npm run build
npm run test:e2e
npm run eonet:sync
npm run eonet:backfill

Deploy On Vercel

  1. Create a Postgres database and copy its pooled connection string into DATABASE_URL.

  2. Set Vercel environment variables:

DATABASE_URL=postgresql://...
EONET_SYNC_SECRET=<generate-a-long-random-string>
NEXT_PUBLIC_MAP_STYLE_URL=<optional-maplibre-style-url>
  1. The included Vercel build command runs migrations before the Next.js build:
npm run db:deploy && npm run build

The install command can stay as npm install; postinstall runs prisma generate.

  1. Deploy, then seed the database once:
vercel --prod
curl -X POST "https://<your-project>.vercel.app/api/cron/eonet-sync?secret=<EONET_SYNC_SECRET>"
  1. The included vercel.json runs /api/cron/eonet-sync once per day at 02:00 UTC, which works on Vercel Hobby. On Pro, you can change the schedule to 0 */6 * * * for a six-hour sync cadence.

API keys:

  • NASA EONET does not require an API key: https://eonet.gsfc.nasa.gov/docs/v3
  • A map key is optional. Without NEXT_PUBLIC_MAP_STYLE_URL, the app uses Esri World Imagery in Hybrid mode with an optional dark Atlas view. For production, you can instead provide a MapLibre-compatible style URL.
  • Vercel Marketplace Postgres providers or Neon provide DATABASE_URL through their dashboard; no NASA key is needed.

Stack

  • Next.js App Router for the explorer, event detail, Saved, Compare, and API routes.
  • TanStack Query for client-side caching and refetch behavior.
  • Tailwind CSS plus a small token layer in src/app/globals.css.
  • Zod for validated event schemas at the EONET boundary.
  • MapLibre GL JS for the interactive map.
  • Prisma with Postgres for the mirrored EONET dataset and sync runs.

API shape

Upstream API:

App routes:

  • GET /api/events
  • GET /api/events/[id]
  • GET /api/events/timeline
  • GET /api/sync/status

The browser API reads from the mirrored database and returns event-first types:

  • Event
  • EventStatus
  • EventCategory
  • EventSource
  • EventGeometry
  • EventListPage
  • FavoriteEvent

The list route supports status, category, from, to, sort, search, page, and limit. Timeline buckets come from the mirrored database and the browser never needs to hit NASA directly during normal browsing.

Map configuration

MapLibre style is configurable through:

NEXT_PUBLIC_MAP_STYLE_URL=https://your-style-host/style.json

If that variable is not set, the app starts in a bundled hybrid mode using Esri World Imagery beneath the existing country boundaries, labels, and event layers. The in-map control can switch back to the night-cartography Atlas mode. Imagery attribution is displayed by the in-map attribution control.

Hybrid imagery is provided by NASA Global Imagery Browse Services (GIBS), part of NASA EOSDIS.

Notes

  • Saved and compare selections persist in localStorage under the current EONET event shape.
  • npm run eonet:sync refreshes the recent mirror window; npm run eonet:backfill fills historical data in throttled windows.
  • Playwright coverage targets the map-first explorer, detail route, Saved, and Compare flows.

About

Atlas is an independent, map-first public explorer for NASA EONET natural-event records

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages