Skip to content
Agustin Castiarena

Next eclipse

A live countdown to the next solar or lunar eclipse, with a 3D globe showing where on Earth you can see it. Built on NASA eclipse catalogs, precomputed offline, and hosted as a static site.

Role

Creator & sole developer

Period

Oct 2026

Stack

  • React
  • TypeScript
  • Vite
  • Chakra UI
  • three.js
  • react-globe.gl
  • Vitest
  • GitHub Actions
  • NASA open data
The Next eclipse site on desktop: a countdown to the 20 February 2027 penumbral lunar eclipse on the left and a 3D globe on the right covered in purple dots over Europe and Africa.

The problem

Eclipse dates are easy to find, but what you actually want to know is whether you can see this one from where you are. Most sites bury that in tables of coordinates or a static map. I wanted a single screen that counts down to the next eclipse and shows, on a globe you can spin, who gets the show, with no backend to run.

Approach

  1. Parsed the NASA GSFC eclipse catalogs (Espenak & Meeus) with a Node script into static JSON: a 46-eclipse index plus one geometry file per eclipse, loaded only when that eclipse is shown. A repository interface keeps the UI independent of where the data lives.
  2. Kept astronomy out of the browser: visibility geometry is precomputed offline, so the client only draws it. Solar eclipses render the central path with its limits and centre line; lunar ones a dot grid coloured by whether the Moon is up for the whole eclipse or only part of it.
  3. Built the interactive globe with three.js through react-globe.gl: drag to rotate, scroll to zoom, camera turns to face the eclipse. Paths that cross the antimeridian are split so they never draw a line across the planet, and the camera centre averages unit vectors.
  4. Designed a full-bleed dark layout: the globe fills the desktop screen behind the content, and on mobile the details sit in a glass bottom sheet over it. The globe chunk is lazy-loaded, with a fallback message when WebGL is unavailable.
  5. Made location opt-in: "Check my location" says whether you are inside the zone, entirely in the browser, and the selected type lives in the URL (?type=lunar) so views are shareable.

Outcomes

No server and no astronomy code in the client: 46 eclipses over the next 10 years served as static JSON

Countdown, data integrity, geometry, visibility lookups and date formatting covered by 46 Vitest tests

Location check runs on-device; nothing is sent anywhere

Deployed to GitHub Pages by a workflow that runs the tests before every deploy

The source code is private, so this case study describes the build instead of linking to it

Gallery

Opens a dialog lightbox: arrow keys move, Esc closes, focus returns to the thumbnail. Alt text shows as the caption.