Real-time ship tracking on a dark-themed map. Displays AIS vessel positions worldwide with rotated heading indicators and detailed vessel information on click.
Inspired by the now-defunct shipradar24.xyz.
- Full-screen dark map (OpenStreetMap basemap, inverted to dark)
- Ship markers rotated to heading, colored by type (cargo, tanker, passenger, etc.)
- Real-time position updates via AISStream.io WebSocket
- Click any ship for details: name, MMSI, IMO, type, speed, course, destination, dimensions
- Automatic fallback to Digitraffic.fi (Baltic region) if AISStream is unavailable
npm install
cp .env.example .env
# Add your AISStream API key to .env (free at https://aisstream.io)
npm run devOpen http://localhost:5173.
| Source | Coverage | Auth | Protocol |
|---|---|---|---|
| AISStream.io | Global | Free API key | WebSocket (proxied via Vite/nginx to force HTTP/1.1) |
| Digitraffic.fi | Baltic Sea | None | REST (30s polling) |
AISStream's server negotiates HTTP/2 via ALPN, but doesn't support WebSocket-over-HTTP/2 (RFC 8441). Browsers hang at readyState=0. The app proxies through Vite (dev) or nginx (prod) to force HTTP/1.1 upstream.
docker build --build-arg VITE_AISSTREAM_API_KEY=<your-key> -t shiptracker .
docker run -p 8080:80 shiptrackernpm test # Run all tests
npm run coverage # Run with coverage (80% threshold)- Vite + vanilla TypeScript
- Leaflet + leaflet-rotatedmarker
- Vitest + jsdom (84 tests, 99% statement coverage)
- nginx:alpine (production)
Data: Digitraffic (CC 4.0 BY), AISStream. Map tiles: OpenStreetMap.