<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Enes Bilgin</title>
    <description>The latest articles on DEV Community by Enes Bilgin (@enes_bilgin).</description>
    <link>https://dev.to/enes_bilgin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3954218%2F7e6f6bbd-03eb-499a-9bef-57ed5d6fd3cb.jpeg</url>
      <title>DEV Community: Enes Bilgin</title>
      <link>https://dev.to/enes_bilgin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/enes_bilgin"/>
    <language>en</language>
    <item>
      <title>From TLEs to Real-Time Satellite Tracking: Building an Orbital Backend with Spring Boot and Orekit</title>
      <dc:creator>Enes Bilgin</dc:creator>
      <pubDate>Sat, 20 Jun 2026 13:44:50 +0000</pubDate>
      <link>https://dev.to/enes_bilgin/from-tles-to-real-time-satellite-tracking-building-an-orbital-backend-with-spring-boot-and-orekit-lgn</link>
      <guid>https://dev.to/enes_bilgin/from-tles-to-real-time-satellite-tracking-building-an-orbital-backend-with-spring-boot-and-orekit-lgn</guid>
      <description>&lt;p&gt;I've worked on projects where getting the right data was the bottleneck. You can't build features without data, and sometimes the data just doesn't exist or is locked behind paid APIs. Satellite tracking is different — the orbital data is publicly available. That shouldn't be a story, but it is. Most developers never think about it because they assume someone else has already built the tracking layer. They call an external API and move on.&lt;/p&gt;

&lt;p&gt;I didn't want to move on. I wanted to understand: how do two lines of numbers become a real-time position on Earth? And could I build that myself, with no aerospace background?&lt;/p&gt;

&lt;p&gt;I looked at existing satellite tracking tools, but most were black boxes — they called an external API and rendered the result on a map. I couldn't see how it worked. That bugged me. I wanted to build it myself and find out.&lt;/p&gt;

&lt;p&gt;That question led me into orbital mechanics, TLE propagation, and Orekit — a Java library used by the European Space Agency. Orekit is powerful, but almost all examples assume standalone or academic usage. There were barely any resources explaining how to integrate it into a production web backend. My progress was slow — learning by failing.&lt;/p&gt;

&lt;p&gt;So I built Vigilance: a Spring Boot backend that takes raw orbital data and turns it into live satellite positions, pass predictions, and ground footprints. Here's what I learned about making aerospace-grade physics play nice with a web framework.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is a TLE and Why Does It Go Stale
&lt;/h2&gt;

&lt;p&gt;A TLE (Two-Line Element Set) is two lines of 69-character data that encode everything needed to calculate a satellite's position and velocity at a specific moment. Here's the ISS:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ISS (ZARYA)&lt;br&gt;
1 25544U 98067A   24101.21315433  .00002243  00000+0  48609-4 0  9991&lt;br&gt;
2 25544  51.6392  59.7121 0003000  73.4153 286.7121 15.50011348397460&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Those six numbers encode: inclination, RAAN (where the orbit crosses the equator), eccentricity, argument of perigee, mean anomaly, and mean motion. Think of it as a snapshot of where the satellite is and how it's moving.&lt;/p&gt;

&lt;p&gt;But TLEs decay. I learned this the hard way: the Earth's bulge causes precession, atmospheric drag eats altitude, and after a week your position prediction could be off by kilometers. I'd watch my own predictions degrade in real time.&lt;/p&gt;

&lt;p&gt;The US Space Force updates TLEs regularly — sometimes daily for high-value satellites, less frequently for others. Use a TLE that's a week old, and your position could be kilometers off. That's fine for some applications, but if you're predicting when a satellite flies over a ground station, you need fresh data.&lt;/p&gt;
&lt;h2&gt;
  
  
  The TLE Lifecycle State Machine
&lt;/h2&gt;

&lt;p&gt;To handle TLE freshness, I built a state machine with five states: PENDING → ACTIVE → STALE → EXPIRED → FETCH_FAILED.&lt;/p&gt;

&lt;p&gt;Here's how it works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──────────┐         ┌──────────┐         ┌──────────┐         ┌──────────┐
│ PENDING  │────────►│ ACTIVE   │────────►│  STALE   │────────►│ EXPIRED  │
│(no data) │         │(&amp;lt;12h)    │         │(12-48h)  │         │(&amp;gt;48h)    │
└────┬─────┘         └────┬─────┘         └────┬─────┘         └──────────┘
     │                     │                     │
     │ fetch failed        │ retry success      │
     ▼                     │                     │
┌──────────┐              │                     │
│FETCH_FAIL │─────────────┘                     │
│(transient)│                                   │
└────┬─────┘                                   │
     │ 5+ failures                             │
     └─────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PENDING&lt;/strong&gt;: No data yet&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ACTIVE&lt;/strong&gt;: Fresh data (less than 12 hours old)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;STALE&lt;/strong&gt;: Getting old (12-48 hours) — still usable, should refresh&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EXPIRED&lt;/strong&gt;: Too old (48+ hours) or satellite doesn't exist&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FETCH_FAILED&lt;/strong&gt;: Tried to fetch, failed (network error, rate limit, etc.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The refresh strategy is asynchronous. When a user requests satellite data, the service checks the TLE status. If it's STALE, EXPIRED, or FETCH_FAILED, it triggers a background refresh. The user gets the current data immediately; the system fetches fresh data in the background.&lt;/p&gt;

&lt;p&gt;I added a distributed lock using ConcurrentHashMap.newKeySet() to prevent duplicate refreshes when multiple users request the same satellite simultaneously. There's also a 5-minute cooldown between refresh attempts to avoid hammering CelesTrak. After five failed fetches, I mark the satellite EXPIRED — catches decommissioned satellites and invalid NORAD IDs.&lt;/p&gt;

&lt;p&gt;The state machine solves the data freshness problem, but it's only one part of the system. At a high level, Vigilance looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌─────────────────┐
│  React Frontend │
│   (Map &amp;amp; UI)    │
└────────┬────────┘
         │ REST API
         ▼
┌──────────────────────────────────────┐
│          Spring Boot Backend         │
│                                      │
│  REST Controller                     │
│         │                            │
│         ▼                            │
│  Satellite Service                   │
│         │                            │
│         ▼                            │
│   TLE Repository                     │
│         │                            │
│         ▼                            │
│   TLE State Machine                  │
│ (ACTIVE / STALE / EXPIRED)           │
│         │                            │
│         ▼                            │
│  OrbitPropagator (ACL)               │
│         │                            │
│         ▼                            │
│      Orekit                          │
│ (SGP4 + Frame Transforms)            │
└────────────────────┬─────────────────┘
                     │
              Async Refresh
                     │
                     ▼
             CelesTrak API
             (TLE Source)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Integrating Orekit with Spring Boot
&lt;/h2&gt;

&lt;p&gt;Orekit isn't like most Java libraries. It needs external data files — leap seconds, Earth orientation parameters, ephemerides — loaded from the filesystem. These aren't bundled in the JAR.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@Configuration&lt;/span&gt;
&lt;span class="nd"&gt;@Slf4j&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;OrekitConfig&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nd"&gt;@Value&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"${orekit.data-path}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;orekitDataPath&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="nd"&gt;@PostConstruct&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;File&lt;/span&gt; &lt;span class="n"&gt;orekitDataDir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;File&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;orekitDataPath&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;DataProvidersManager&lt;/span&gt; &lt;span class="n"&gt;manager&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DataContext&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getDefault&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;getDataProvidersManager&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
        &lt;span class="n"&gt;manager&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;addProvider&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;DirectoryCrawler&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;orekitDataDir&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
        &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;info&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Orekit data loaded successfully from: {}"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;orekitDataDir&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getAbsolutePath&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I initially tried loading files from the classpath, but Orekit's DirectoryCrawler only works with real directories — it can't read inside a JAR. This broke my Docker deployment.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;manager.addProvider(new DirectoryCrawler(orekitDataDir));&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The fix: volume mount the data directory and configure the path via environment variables. In production, the data files live outside the container, and orekit.data-path points to the mount. This also makes updates easy — no image rebuild.&lt;/p&gt;

&lt;p&gt;Orekit throws its own types everywhere: AbsoluteDate, PVCoordinates, Frame. I wrapped all of it in an OrbitPropagator class — the only place in the codebase that imports Orekit types. It accepts Orekit objects but returns primitive arrays: double[] with latitude, longitude, altitude, velocity. The domain layer converts those to clean Java records.&lt;/p&gt;

&lt;p&gt;This isolation means if Orekit's API changes or I need to swap it out, I only update one file. The rest of the application doesn't care how position gets calculated — it just gets numbers.&lt;/p&gt;
&lt;h2&gt;
  
  
  From TLE to Real-Time Position
&lt;/h2&gt;

&lt;p&gt;Here's the propagation pipeline: TLE → SGP4 algorithm → position/velocity → coordinate transformation → latitude/longitude.&lt;/p&gt;

&lt;p&gt;Orekit uses SGP4, the standard model for converting TLEs into positions. It accounts for Earth's oblateness, atmospheric drag, and other perturbations that simple Keplerian orbits ignore.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;SpacecraftState&lt;/span&gt; &lt;span class="nf"&gt;propagate&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="no"&gt;TLE&lt;/span&gt; &lt;span class="n"&gt;tle&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;AbsoluteDate&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;TLEPropagator&lt;/span&gt; &lt;span class="n"&gt;propagator&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TLEPropagator&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;selectExtrapolator&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tle&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;propagator&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;propagate&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="nf"&gt;getCurrentPositionAndVelocity&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="no"&gt;TLE&lt;/span&gt; &lt;span class="n"&gt;tle&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;AbsoluteDate&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;SpacecraftState&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;propagate&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tle&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="nc"&gt;PVCoordinates&lt;/span&gt; &lt;span class="n"&gt;pv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getPVCoordinates&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;itrf&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="nc"&gt;GeodeticPoint&lt;/span&gt; &lt;span class="n"&gt;geoPoint&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;earth&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;transform&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getPosition&lt;/span&gt;&lt;span class="o"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;itrf&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;velocity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getVelocity&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;getNorm&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;1000.0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt;&lt;span class="o"&gt;[]{&lt;/span&gt;
        &lt;span class="nc"&gt;Math&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toDegrees&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;geoPoint&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getLatitude&lt;/span&gt;&lt;span class="o"&gt;()),&lt;/span&gt;
        &lt;span class="nc"&gt;Math&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toDegrees&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;geoPoint&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getLongitude&lt;/span&gt;&lt;span class="o"&gt;()),&lt;/span&gt;
        &lt;span class="n"&gt;geoPoint&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getAltitude&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;1000.0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;velocity&lt;/span&gt;
    &lt;span class="o"&gt;};&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The key step is transforming from ECI (Earth-Centered Inertial — fixed to the stars) to ITRF (International Terrestrial Reference Frame — rotates with Earth). That's where you get latitude and longitude.&lt;/p&gt;

&lt;p&gt;Propagation is expensive. Each calculation involves multiple transformations and operations. I added PostgreSQL caching with intelligent invalidation — satellite data is cached for 24 hours before refresh, and position calculations are computed on-demand. This keeps the API responsive while still near-real-time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I began this project thinking satellite tracking was a visualization problem. It turned out to be a data freshness problem disguised as a physics problem.&lt;/p&gt;

&lt;p&gt;The orbital mechanics were challenging. But what surprised me most was this: the gap between a mathematical model and a production service is often larger than the gap between an idea and a prototype. Orekit gave me the physics in a few lines of code. Everything else—the state machine, the caching layer, the refresh strategy, the failure handling—took weeks.&lt;/p&gt;

&lt;p&gt;That's where Vigilance actually lives. Not in the SGP4 algorithm. In the decisions about when to refresh, how to lock concurrent requests, what to do when CelesTrak is unreachable.&lt;/p&gt;

&lt;p&gt;Sometimes the best way to understand a black box is to replace it.&lt;/p&gt;

</description>
      <category>java</category>
      <category>springboot</category>
      <category>systemdesign</category>
      <category>backend</category>
    </item>
  </channel>
</rss>
