Skip to content

zach333miller/Tide

Repository files navigation

Tide

A live window onto Earth's pulse. iNaturalist sightings render as actual photographs on the globe; earthquakes ripple by magnitude; EONET wildfires, storms, and volcanoes pulse as ambient texture — all streamed live over WebSocket and painted in a single instanced draw call.

Tide — live geospatial globe, biodiversity photo atlas, earthquake inspect card

flowchart LR
    iN[iNaturalist] --> R
    US[USGS] --> R
    EO[NASA EONET] --> R
    AI[AISStream] --> R
    R[Rust server<br/>axum · tokio]
    R --> SI[Spatial index<br/>R-tree + H3]
    R --> WAL[(Append-only WAL<br/>24 h, crash-safe)]
    SI --> WS{WebSocket<br/>fan-out}
    WS --> G[WebGL2 globe<br/>photo atlas]
Loading

Deep dive: docs/ABOUT.md · Public deploy guide: docs/DEPLOY_PUBLIC.md · Benchmarks: docs/BENCHMARKS.md

What's in here

what makes it interesting
Photo texture atlas on the globe · web/src/render/photo_atlas.ts 2048×2048 RGBA8 atlas, 1024 slots. iNat photos download → offscreen canvas → texSubImage2D. The fragment shader composites real photographs onto each point sprite — hundreds of species render in one drawArrays.
Hand-rolled R-tree · crates/tide-spatial/src/rtree.rs Guttman 1984 quadratic split + STR bulk-load. Generic in payload. 1M-point stress test. Doc comments cite the paper with ASCII split diagrams.
Append-only WAL with crash recovery · crates/tide-storage/src/wal.rs Length + CRC32 + CBOR records, one file per UTC hour. Recovery scans the active file from EOF, truncates torn tails, reopens. Fault-injection tested.
Source trait with backoff + circuit breaker · crates/tide-ingest/ Stream-returning trait. Each source = protocol parser; retry / dedup / rate-limit / bounded mpsc / metrics live in one Runner wrapper. Five connectors: iNaturalist, USGS, EONET, AISStream, OpenSky.
Custom WebGL2 renderer · web/src/render/ NASA Blue Marble–textured UV sphere. One instanced points draw call. Fragment shader switches on a glyph-type integer to draw chevrons, ripples, swirls, fire flickers, volcano pulses, or photo composites — back-of-globe cull in the vertex shader.

Performance

measurement result
WebSocket fan-out, 250 clients × 25 000 ev/s × 60 s p99 = 6.3 ms
WebSocket fan-out, 500 clients × 10 000 ev/s × 60 s p99 = 6.2 ms
R-tree bulk-load, 1 M points < 1 s
Globe + entities renderer, ~12 k entities, photo atlas active 60 fps

Measured on an Intel Core Ultra 7 155H. Full numbers + methodology in docs/BENCHMARKS.md.

Run locally

Requires Rust 1.75+ and Node 20+.

cargo run -p tide-server                    # ingestion + WebSocket server
cd web && npm install && npm run dev        # globe at http://localhost:5173

Default config enables iNaturalist + USGS + NASA EONET (free, no key). Set AISSTREAM_API_KEY in .env for vessel positions; OPENSKY_USERNAME + OPENSKY_PASSWORD plus enabled = true adds the aircraft overlay (off by default — flights crowd out the nature layer).

How it's organized

crates/
  tide-core        # Event, EntityType, validation
  tide-protocol    # Wire types + ts-rs codegen
  tide-ingest      # Source trait + per-feed implementations
  tide-spatial     # R-tree + H3 buckets
  tide-storage     # WAL + ring buffer + eviction
  tide-server      # axum HTTP + WebSocket + source manager
web/src/
  render/          # globe.ts, entities.ts, photo_atlas.ts, camera.ts
  protocol/        # ts-rs–generated TS + WS client + MessagePack
  ui/              # inspect card, featured panel, stats
docs/              # ABOUT, ARCHITECTURE, BENCHMARKS, WAL_FORMAT, …
Dockerfile · docker-compose.yml · fly.toml · vercel.json

Stack

Rust 1.75 · tokio · axum · rmp-serde (wire) · ciborium (WAL) · h3o · parking_lot · governor · metrics · tower-http · TypeScript 5 strict · gl-matrix · Vite · WebGL2. Protocol types generated by ts-rs. No React, no deck.gl, no Three.js.

Tests

cargo test --workspace                                  # 110+ tests
cargo test --release -p tide-server --test load -- --ignored --nocapture

CI runs check / test / clippy / fmt on Linux + Windows on every push.

License

MIT — see LICENSE.

About

No description, website, or topics provided.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors