Skip to content
maricastrocPublic

About

A globe that finds the planet's notable earthquakes on its own, replays each one in time and explains it. Built with Next.js, MapLibre, deck.gl, Node.js and PostGIS.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation


Atlas
Atlas

The planet's earthquakes, found on their own, replayed in time and explained.

Next.js React TypeScript MapLibre deck.gl Node.js PostgreSQL PostGIS Railway Vercel

Features • How It Works • Engineering Notes • Tech Stack • How To Run • License

A globe that shows the planet right now, notices on its own when an earthquake deserves attention, rebuilds what happened second by second, and explains it to someone who is not a seismologist. The globe is the way in; the product is the moment: a real event, detected, put in context and replayed.

🔗 Live demo: atlas.marianacastro.dev

The replay of the 2011 Tōhoku earthquake: the clock runs from before the rupture, the P and S wave fronts spread from the epicenter and the captions explain each chapter
The 2011 Tōhoku earthquake, replayed. Also as video.


🌍 Features

🌐 The Planet, Now Day, night and twilight computed per pixel from the Sun's position, city lights only on the night side, the International Space Station on its orbit, and every earthquake of magnitude 3.5 or more from the last 24 hours, merged from the USGS and EMSC feeds.
🔎 Finds the Moments on Its Own A deterministic engine groups aftershocks with the classic Gardner–Knopoff windows, scores each event by strength, reports and rarity in its own region, and publishes only what deserves attention, with a daily ceiling. No editor in the loop.
🎬 Replays in Five Chapters Before, the rupture, the waves, the aftershocks and after. P and S wave fronts come from the ak135 travel-time tables at the real focal depth, seismic stations light up as the waves arrive, and aftershocks run on a logarithmic clock that still tells true elapsed time. Pause, scrub, skip chapters.
🗂️ An Archive Since 1900 10,747 moments rebuilt from the USGS catalog, on a decade axis, with magnitude filters, "on this day" and "around this place".
📍 Place Search Countries, seas and 31,803 cities by name. A country gathers the moments its card names, plus offshore moments within 300 km of its coast, so the Aleutian quakes still belong to the United States. The chosen country is outlined on the globe.
🧾 Every Number Declares Its Basis Each fact is marked as observed, calculated or approximate, and the method sheets explain how each one is made. The texts never claim more than the catalog supports.
✍️ Written for Non-Specialists Every moment gets a title, a lede and short paragraphs in Brazilian Portuguese: where, when in local time, how it compares with the region's history, which plates meet there. Famous quakes keep their established names.
🔗 Shareable Scenes A link can stop the replay at an exact second and camera. Shared links unfold into a share image drawn on the server as a printed "plate" of the moment.
📱 Fast First Paint The moment card is rendered on the server, so on a slow 4G phone the text is readable in 1.1 s while the globe keeps loading behind it.
🎨 Two Faces, One Globe Vigília, the photograph (the globe at night, the calm instrument panel), and Prancha, the page (a paper plate with the full story). Every visual effect needs a physical or narrative reason.

🖼️ Screenshots

A moment The plate, with the full story
The Tōhoku moment on the night globe, with title, lede and numbers The Prancha view: a paper globe and the written account of the quake
Searching for a place On a phone
Japan chosen in the place search: the country outlined and its moments listed The live view on a phone

🧭 How It Works

flowchart LR
  feeds["USGS and EMSC<br/>live feeds"] -->|every few minutes| collector
  comcat["USGS ComCat<br/>catalog since 1900"] -->|monthly| collector
  subgraph railway["Railway"]
    collector["Collector<br/>raw captures on a volume"] --> db[("PostgreSQL<br/>+ PostGIS")]
    db --> detection["Detection<br/>clusters, scores, texts"]
    detection --> db
    db --> api["Engine API<br/>moments, archive, replay packages"]
    collector -.daily.-> bucket[("Backup bucket")]
  end
  subgraph vercel["Vercel"]
    next["Next.js<br/>server card, share images, keyed proxy"]
  end
  api -->|HTTPS + key| next
  next --> browser["Browser<br/>MapLibre + deck.gl globe"]
Loading
  1. Collect. The engine polls the USGS and EMSC feeds and writes every response to disk before touching the database. The database is a function of those raw captures: verify replays them and proves the two match.
  2. Detect. Observations from both sources are fused into single events, grouped into mainshocks and aftershocks, and scored. A moment is born, revised and frozen through an explicit life cycle, so a published moment does not silently change.
  3. Describe. Each moment gets its text from versioned methods. When a method changes, the texts that depend on it are written again on the next run.
  4. Replay. A replay is a script of chapters on a timeline. The scene is a pure function of time, so a link can point at any instant and a server can draw that instant as an image. Replay packages are versioned by a hash of their content.
  5. Serve. The site never talks to the engine from the browser. Next.js routes call it over HTTPS with a shared key, render the first card on the server and draw share images with the same map code.

🔬 Engineering Notes

A few problems that took real work, with the numbers that settled them. Every decision is recorded, with its reason and its measurements, in docs/decisoes.md (65 decisions, in Portuguese).

  • Seismic waves you can trust. P and S travel times come from the ak135 tables, interpolated in distance and depth. Against TauP and against arrivals the USGS measured for three quakes, the median residual is between −0.1 and 0.2 s, and 97 to 99% of arrivals fall within 3 s. The table it replaced was off by 59.5 s at 598 km depth.
  • Aftershocks without chain reactions. An early clustering linked any event to any other inside the window, which merged 18 years of activity around Tōhoku into one "moment". The classic Gardner–Knopoff windows, applied from the largest event down and scaled by rupture length above magnitude 7.5, fixed it.
  • A 60 fps budget. Interface layers over the globe may only animate transform and opacity, and every interface change passes a 10-second frame probe in headless Chrome. Safari went from 24 to 58 fps when the culprit turned out to be the interface, not WebGL.
  • Reproducible output. The same request draws the same share image, byte for byte, and builds the same replay package. The 30-day review list of detected moments is regenerated from saved fixtures and compared after each change to the methods.
  • Hosting on a small budget. Measured one change at a time on Railway, the engine went from 0.408 to 0.183 GB of memory: Node started directly instead of through pnpm, one shared copy of the context data, and the archive build in a short-lived process. Native backups need a paid plan, so the engine backs itself up to a bucket over S3, with an AWS SigV4 signer written in-house and checked against AWS's published example, and a restore that was tested on an empty database.
  • Reading before the globe is ready. On a throttled 4G phone, the first meaningful paint went from 9 s to 1.1 s by sending the moment card in the server HTML.

🛠️ Tech Stack

Category Technologies
Monorepo pnpm workspaces: apps/web, apps/engine, packages/core, packages/domain
Language TypeScript end to end, run directly by Node.js 22 with type stripping
Web Next.js 16 (App Router), React 19, server-rendered cards, next/og share images
Globe MapLibre GL JS with globe projection, deck.gl 9 layers, custom WebGL shaders for night, twilight and atmosphere
Engine Node.js collector, detection and HTTP API; no framework
Data PostgreSQL 17 with PostGIS 3.7
Science ak135 travel-time tables, Gardner–Knopoff aftershock windows, PB2002 plate boundaries, solar position
Hosting Vercel (site), Railway (engine, database, volumes, backup bucket)
Quality node:test (215 tests), TypeScript strict, ESLint, headless Chrome frame probes

📚 Data Sources

Source Used for License
USGS live feeds and ComCat Live earthquakes and the archive since 1900 Public domain
EMSC Live earthquakes CC BY 4.0
Natural Earth v5.1.2 Countries, seas and the share-image map Public domain
GeoNames Cities and local time zones CC BY 4.0
PB2002 (Bird, 2003), conversion by Hugo Ahlenius Plate boundaries ODC-BY 1.0
ak135 (Kennett, Engdahl and Buland, 1995), tables as in ObsPy/TauP Seismic wave travel times Cited as published
NASA Black Marble 2016 and GIBS City lights and daytime imagery Public domain
CelesTrak Space Station orbital elements Free, with attribution
EarthScope station service Seismic station positions Open data

Fonts: Newsreader, Archivo Narrow and Fragment Mono, under the SIL Open Font License (files in apps/web/src/identity/fonts).


ℹ️ How To Run the Application

Requirements: Node.js 22.18 or newer (.nvmrc pins 22.22.3), pnpm 11 and Docker.

git clone https://github.com/maricastroc/atlas.git
cd atlas
pnpm install
pnpm db:up              # PostgreSQL + PostGIS in Docker, on port 54329
pnpm engine collect     # first run: fetches the last 30 days and builds the archive

In another terminal:

pnpm dev                # the site at http://localhost:3000
Command What it does
pnpm test All unit tests
pnpm typecheck TypeScript across the workspace
pnpm engine status Collection health and what is in the database
pnpm engine verify Proves the database is exactly what the recorded captures produce
pnpm engine report --source=fixtures Rebuilds the 30-day review list from saved data

The engine guide is docs/motor.md, the method sheets are in docs/como-funciona.md, and hosting, backups and restore are in docs/publicacao.md. The documentation and the interface are in Brazilian Portuguese.


🗺️ Status

Phase 1, earthquakes, is complete and live. Next: a two-week watch of live detection, and the second category among aviation emergencies (published only after the outcome), tropical cyclones, auroras and visible Space Station passes.


📄 License

The code is released under the MIT License. The data and fonts listed above keep their own licenses.

About

A globe that finds the planet's notable earthquakes on its own, replays each one in time and explains it. Built with Next.js, MapLibre, deck.gl, Node.js and PostGIS.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages