<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Anjaligupta on Medium]]></title>
        <description><![CDATA[Stories by Anjaligupta on Medium]]></description>
        <link>https://medium.com/@anjaligupta10265?source=rss-e25da245ceb7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*UA51JLYEU-Ughvp6</url>
            <title>Stories by Anjaligupta on Medium</title>
            <link>https://medium.com/@anjaligupta10265?source=rss-e25da245ceb7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 03:56:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anjaligupta10265/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[I Built a Real-Time Global Ship Tracking Platform in 48 Hours — Here’s How]]></title>
            <link>https://medium.com/@anjaligupta10265/i-built-a-real-time-global-ship-tracking-platform-in-48-hours-heres-how-6652a3e01b69?source=rss-e25da245ceb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/6652a3e01b69</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[side-hustle]]></category>
            <category><![CDATA[supply-chain]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Anjaligupta]]></dc:creator>
            <pubDate>Mon, 06 Apr 2026 17:28:47 GMT</pubDate>
            <atom:updated>2026-04-06T17:28:47.569Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ktdNBt5lz3zfz4_0azPpXQ.png" /></figure><h3>From zero to 10,000+ live vessels on a world map</h3><h4>When I started this project, I had one simple question: <em>Can I see where every ship in the world is, right now?</em></h4><p>Forty-eight hours later, I had a fully deployed web application tracking over 10,000 vessels live across every ocean — the English Channel, the Strait of Hormuz, the Strait of Malacca, the Arabian Sea — all updating in real time on an interactive world map.</p><p>Here’s the complete story of how I built it, what broke along the way, and what I learned.</p><h4>The Idea</h4><p>Global shipping moves 90% of everything we consume. Every container of electronics, every tanker of oil, every bulk carrier of grain — it’s all out there on the water right now, broadcasting its position via radio.</p><p>That broadcast system is called AIS — Automatic Identification System. Every commercial vessel with a gross tonnage of 300 or more is legally required to continuously transmit its identity, position, speed, and heading. The signals travel at the speed of light. Coastal receiver stations and satellites pick them up.</p><p>I wanted to build something that takes that raw data stream and turns it into something beautiful and useful — a live map of global trade.</p><h4>The Tech Stack</h4><p>Before writing a single line of code, I mapped out the architecture:</p><p><strong>Frontend:</strong> React with Vite, Mapbox GL JS for the interactive map, and Tailwind CSS for styling.</p><p><strong>Real-time data:</strong> aisstream.io, a free WebSocket API that streams live AIS position reports from ships worldwide.</p><p><strong>Backend proxy:</strong> A Node.js WebSocket proxy server to handle the AIS stream connection and forward data to the browser.</p><p><strong>Database:</strong> Supabase (PostgreSQL) to cache ship positions so users see data instantly on load rather than waiting for the live stream to populate.</p><p><strong>Deployment:</strong> Vercel for the frontend, Render for the backend proxy server.</p><p>The core idea was simple: ships broadcast their GPS positions every few seconds. Those positions stream through a WebSocket into my proxy server, which forwards them to the browser, which plots them on the map.</p><p>Simple in theory. Surprisingly complex in practice.</p><h3>The Build</h3><h4>Setting Up the Map</h4><p>Mapbox GL JS was the obvious choice for the map. It handles hundreds of thousands of markers efficiently using WebGL rendering, supports custom styling, and has great documentation.</p><p>The key architectural decision was using a <strong>GeoJSON source with a symbol layer</strong> instead of individual DOM markers. When you have 10,000 ships on screen, individual markers would destroy performance. GeoJSON layers let Mapbox handle all rendering on the GPU.</p><p>Each ship became a directional triangle — a small arrow pointing in its direction of travel, colored by vessel type. Tankers are red. Cargo ships are green. Container ships are blue. Passenger vessels are purple. The colors make it instantly clear what kind of traffic is moving where.</p><h4>The WebSocket Challenge</h4><p>This is where things got interesting.</p><p>My first attempt connected directly from the browser to aisstream.io’s WebSocket endpoint. It kept failing with connection error 1006 — a silent, unhelpful error code that just means “something went wrong.”</p><p>After significant debugging, I discovered two separate issues. First, aisstream.io uses HTTP/2 for its WebSocket upgrade, which some browsers and network configurations handle inconsistently. Second, my API key wasn’t being correctly passed to the Web Worker handling the connection, because Web Workers can’t directly access Vite’s import.meta.env environment variables.</p><p>The solution was a Node.js proxy server. The browser connects to my proxy via WebSocket. The proxy connects to aisstream.io. The proxy handles the HTTP/2 negotiation, passes the API key correctly from environment variables, and forwards all AIS messages to the browser. Clean separation of concerns, and it solved both problems at once.</p><h4>The Data Pipeline</h4><p>AIS data comes in two message types. <strong>PositionReport</strong> messages arrive every few seconds and contain latitude, longitude, speed, heading, and MMSI — the unique vessel identifier. <strong>ShipStaticData</strong> messages arrive less frequently and contain the vessel name, type, destination, and call sign.</p><p>The browser receives both message types and merges them by MMSI into a ship state map. Every second, that map gets converted to a GeoJSON FeatureCollection and pushed to Mapbox to update the visualization.</p><p>At peak, the app processes over 50,000 AIS messages per hour.</p><h4>Building the Supabase Cache</h4><p>The live stream is great once it’s running, but it starts from zero every time someone loads the page. A new visitor would see an empty map for the first minute while ships accumulated.</p><p>The solution was Supabase. Every 30 seconds, the proxy server batches all received ship positions and upserts them into a PostgreSQL table using MMSI as the primary key. When a user loads the app, it first fetches the latest 10,000+ ship positions from Supabase, populates the map instantly, and then the live-stream layers update on top.</p><p>Load time went from “wait 60 seconds to see anything” to “see 10,000 ships in under 2 seconds.”</p><h4>The Filters</h4><p>A map with 10,000 undifferentiated dots isn’t very useful. I built a filter panel that lets users narrow down by:</p><ul><li><strong>Ship type</strong> — tankers, cargo ships, container ships, bulk carriers, passenger vessels, fishing boats</li><li><strong>Flag country</strong> — derived from the first three digits of each ship’s MMSI number, which encode the vessel’s country of registration</li><li><strong>Minimum speed</strong> — filter out anchored vessels and see only ships actively underway</li><li><strong>Known destination</strong> — show only ships that have broadcast a destination port</li></ul><p>The country derivation was particularly interesting. The Maritime Mobile Service Identity system assigns three-digit country codes — called MID codes — to every nation. The Netherlands is 244–246. Panama is 351–357. The Marshall Islands is 538. By parsing the first three digits of any MMSI, you can identify where a ship is registered without any additional data.</p><h4>What I Discovered</h4><p>Building this taught me things I didn’t expect to learn.</p><p><strong>Most ships aren’t registered where you think.</strong> Panama, Marshall Islands, Liberia, and Malta together account for a huge proportion of the world’s commercial fleet. These are “flags of convenience” — countries that offer ship registration with minimal regulation and taxation. When you filter by flag country, you quickly realize that global shipping is far more legally complex than it appears on the surface.</p><p><strong>The English Channel is extraordinarily busy.</strong> The stretch of water between Dover and Calais is the world’s busiest shipping lane. At any given moment, hundreds of vessels are transiting in parallel lanes, managed by a traffic separation scheme that functions like a maritime highway. Zooming into this area on the map is genuinely striking.</p><p><strong>AIS data has gaps.</strong> Terrestrial receivers only cover coastal areas. Ships in the middle of the ocean are invisible to land-based stations. Satellite AIS exists but is expensive. This means my map shows a heavily Europe and coastline-biased view of global shipping — the true picture requires commercial satellite AIS coverage that costs thousands of dollars per month.</p><p><strong>Debugging WebSocket connections is painful.</strong> Error code 1006 means nothing. The same symptom — silent connection failure — can come from a wrong API key, a network proxy intercepting traffic, an ad blocker, a VPN, an HTTP/2 negotiation failure, or a browser security policy. I encountered all of them.</p><h4>The Result</h4><p>The final application is live at <a href="https://ships.aihare.in/">https://ships.aihare.in/</a>.</p><p>It loads over 10,000 cached ship positions from Supabase on startup, connects to the live AIS stream within seconds, and continuously updates vessel positions in real time. The filter system lets you drill into specific vessel types or flag countries instantly. Clicking any ship shows its name, type, flag, speed, heading, and destination.</p><p>The entire stack — frontend, backend proxy, database, analytics — runs on free tiers. Total monthly cost: zero dollars.</p><h4>What’s Next</h4><p>There are obvious extensions that would make this significantly more powerful:</p><p><strong>Route history trails</strong> — showing the path each vessel has taken over the last 24 hours, which would make trade routes visually obvious.</p><p><strong>Port markers and statistics</strong> — overlaying major port locations with call volume data to show which ports are busiest at any given time.</p><p><strong>Anomaly detection</strong> — flagging vessels that behave unusually, such as ships that disable their AIS transponder in known smuggling corridors, or vessels loitering in unexpected locations.</p><p><strong>Satellite AIS coverage</strong> — integrating a commercial satellite AIS provider to extend coverage to open ocean routes, not just coastal waters.</p><p>For now, the project achieves what I set out to build: a real-time window into the movement of global trade, running on a laptop, for free.</p><p><em>If you found this useful or have questions about the build, I’d love to hear from you. Connect with me on LinkedIn or drop a comment below.</em></p><p>Programming Web Development JavaScript Data Visualization Side Projects</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6652a3e01b69" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>