Module 12 · Lesson 1
Application Architecture
The capstone is a web application that shows where a satellite is, draws its ground track and predicts its passes. This lesson sets out its requirements, components, data contracts and test strategy.
Learning objectives
After this lesson you will be able to:
- Write verifiable requirements for a satellite tracking application, including what it must not be used for
- Decompose the application into components joined by explicit data contracts that state units, frames and time scales
- Decide what runs in the browser and what runs on a server, and plan how each component will be tested
The project brief
The capstone is a web application that answers three questions about one satellite:
- Where is it now?
- What path does it trace over the ground?
- When will it next pass over a place the user chooses?
Answering them draws on most of the course: element sets and SGP4 from Module 04, time scales and frames from Module 03, ground tracks and look angles from Module 05, simulation practice from Module 10 and the habits of Module 11. This lesson designs the application. The next two build it.
Requirements first
Module 01 described a verifiable requirement as one that states a measurable condition, the circumstances in which it applies and a limit. Applied here:
| ID | Requirement | Verified by |
|---|---|---|
| R1 | The application shall display the latitude, longitude and altitude of the selected satellite, updated at least once per second. | Test |
| R2 | The application shall draw the ground track from 90 minutes before to 90 minutes after the current time. | Test |
| R3 | The application shall list every pass above a 10 degree elevation mask over a chosen location for the next 48 hours, giving rise, culmination and set times in UTC. | Test |
| R4 | Pass times shall agree within 2 seconds with a reference SGP4 implementation given the same element set. | Test |
| R5 | The application shall display the age of the element set and warn when it exceeds 7 days. | Test |
| R6 | The application shall request data for a satellite from its public source no more than once every 2 hours. | Inspection, test |
| R7 | The pass list shall be available as a text table that is usable without the map. | Demonstration |
R4 is worded with care. It claims agreement with a reference implementation of the same model, which is testable. It does not claim agreement with where the satellite really is, which depends on the quality of the element set and is outside the application's control. The application should also state plainly that its predictions are not for operational or safety decisions. Lesson 3 returns to that.
Where orbital data comes from
The elements that SGP4 needs are called general-perturbations element sets, or GP data. The U.S. Space Force publishes them for most tracked objects through Space-Track.org, which requires a registered account and acceptance of its user agreement. CelesTrak, a long-running public service, redistributes GP data without a login.
Three points shape the design.
- Terms of use apply. Free does not mean unlimited. CelesTrak's usage policy states that GP data is updated once every two hours and asks users to download it only once per update, and to stop and investigate when a request returns anything other than success. Read the current policy of whichever source you use.
- Prefer the newer formats. The two-line element set from Module 04 has a five-digit field for the catalog number. CelesTrak reports that those numbers ran out in July 2026, and that newer objects are published only in formats based on the CCSDS Orbit Mean-Elements Message, or OMM, which carries the same elements as named fields in XML, JSON or CSV.
- The elements are mean elements. Whatever the format, they are meant for SGP4 and no other propagator.
Components and contracts
| Component | Responsibility | Produces |
|---|---|---|
| Orbit data source | Fetch, validate and cache element sets | Element set |
| Propagator | Run SGP4 and convert frames | Propagated state |
| Pass predictor | Search a time span for passes | List of passes |
| Map or globe view | Draw position and track | Pixels |
| User interface | Selection, location, table, warnings | User input |
The contracts between them are worth more attention than any single component. The first group describes the data.
/** A general-perturbations element set, as held by the application. */
interface ElementSet {
noradId: number; // catalog number - six digits or more for newer objects
name: string;
epoch: string; // ISO 8601 UTC - the instant the elements describe
fetchedAt: string; // ISO 8601 UTC - when the application retrieved them
source: string; // where the data came from, shown as attribution
elements:
| { format: 'omm'; fields: Record<string, string | number> } // OMM keywords as received
| { format: 'tle'; line1: string; line2: string }; // legacy two-line form
}
/** Where the satellite is at one instant. */
interface PropagatedState {
time: string; // ISO 8601 UTC
latitudeDeg: number; // geodetic, -90 to 90, north positive
longitudeDeg: number; // -180 to 180, east positive
altitudeKm: number; // above the reference ellipsoid
elementAgeDays: number; // time minus element set epoch
}
/** One pass of the satellite over an observer. */
interface Pass {
rise: string; // ISO 8601 UTC - elevation climbs through the mask
culmination: string; // ISO 8601 UTC - time of maximum elevation
set: string; // ISO 8601 UTC - elevation falls through the mask
maxElevationDeg: number; // degrees above the horizon
riseAzimuthDeg: number; // degrees clockwise from true north
setAzimuthDeg: number; // degrees clockwise from true north
}
The second group is the seam between the user interface and the orbit code.
interface Observer {
latitudeDeg: number; // geodetic, north positive
longitudeDeg: number; // east positive
altitudeKm: number; // above the reference ellipsoid
minElevationDeg: number; // elevation mask that defines a pass
}
type TrackerError =
| { kind: 'stale-elements'; ageDays: number }
| { kind: 'propagation-failed'; code: number };
type Result<T> = { ok: true; value: T } | { ok: false; error: TrackerError };
/** The seam between the user interface and the orbit code. */
interface Tracker {
stateAt(elements: ElementSet, time: Date): Result<PropagatedState>;
groundTrack(elements: ElementSet, from: Date, minutes: number, stepSeconds: number): Result<PropagatedState[]>;
passes(elements: ElementSet, observer: Observer, from: Date, hours: number): Result<Pass[]>;
}
Several decisions are visible. Units are part of every field name, which is the Mars Climate Orbiter lesson applied. Conventions that cause silent errors, such as east-positive longitude and azimuth measured from north, are written down. Times cross boundaries as UTC strings and are converted to local time only for display. The orbit library works in radians, and the conversion to degrees happens once, inside the propagator. Failures are values in the contract, so the interface cannot forget to handle a stale element set. ElementSet carries both epoch and fetchedAt, because they answer different questions.
Browser or server
SGP4 is an analytical model. A browser can evaluate it thousands of times in a few milliseconds, so computing power does not decide the split.
- Everything in the browser. Hosting is simplest. But every user's browser contacts the public source directly, the application cannot control the request rate, and it depends on that source allowing cross-origin requests.
- A small server for data, the browser for computation. A scheduled job fetches each element set at most once per update, validates it and serves it from the application's own origin. The browser propagates locally and updates every second with no network traffic. This suits the capstone.
- Propagation on the server. This is worthwhile when many satellites are involved, when other programs consume the results, or when every client must see identical answers.
In every case the Tracker implementation should have no access to the network, the display or the system clock. It can then run in a browser, a worker, a server or a test.
A test strategy
| Component | How it is tested |
|---|---|
| Propagator | Fixed element set and times compared with stored reference outputs, within a tolerance |
| Pass predictor | A stub propagator with known rise and set times; checks that rise precedes culmination precedes set |
| Data source | Recorded responses, including malformed and error cases; never the live service |
| Time-dependent logic | An injected clock, as in Module 10 |
| User interface | A few end-to-end tests with a fixed clock and a fixed element set |
Each test traces to a requirement, as Module 11 described.
A practical example: reviewing a first design
A teammate proposes a first version. The page downloads a two-line element set from the public source when it loads and again every 10 seconds, computes position using the system clock directly, and lists passes in the browser's local time.
A review against this lesson produces four findings. Element sets change at most every two hours, so polling every 10 seconds adds no accuracy and breaks R6 and the source's policy. Reading the system clock inside the orbit code makes R3 and R4 untestable, so the clock should be injected. Unlabeled local times invite misreading, so the contract carries UTC and the display labels its time zone. Nothing shows the age of the data, so R5 is unmet. Each finding points to a requirement or a contract, which turns a matter of taste into something that can be checked.
The next lesson implements the propagator and the pass predictor against these contracts, using an open-source SGP4 library.
Key takeaways
- The project is specified before it is built. Each requirement carries a number, a unit and a verification method, and accuracy is stated against a reference implementation, not against the truth.
- General-perturbations element sets are published publicly, for example through CelesTrak, under usage policies that the application must respect. New applications should read the OMM-based formats, because the TLE format cannot hold catalog numbers above 99999.
- Data contracts carry units in field names, times as UTC strings, and failures as explicit values. The element set's epoch, not the time it was downloaded, determines how far predictions can be trusted.
- Fetching and caching orbital data belongs on a server. Propagation is cheap enough to run in the browser, in a module with no network or display dependencies so that it can be tested alone.
Knowledge check
Check your understanding. These questions are not graded and you can retry as often as you like.
0 of 3 questions answered.
Glossary
General-perturbations element set
A set of mean orbital elements for one object, produced for use with the SGP4 propagator. Often abbreviated GP data, and traditionally distributed as a two-line element set.
Orbit Mean-Elements Message
A CCSDS standard message carrying the same mean elements as a two-line element set as named fields, without the fixed-width limits of the older format. Abbreviated OMM.
Element set epoch
The instant that a set of orbital elements describes. Prediction error grows with the time between the epoch and the moment being predicted.
Elevation mask
The minimum elevation above the horizon at which a satellite is counted as visible or usable from a location.
Data contract
An agreed, explicit definition of the data passed between two components, including field names, types, units and conventions.
Pass
One continuous interval during which a satellite is above an observer's elevation mask, described by its rise, culmination and set.
References and further reading
Finished this lesson?
Loading your progress…
Lesson version 1.0.0.