SatTrack is a lightweight full‑stack web app for tracking satellites above your sky, visualizing orbits in 3D, and sharing community observations. It combines accurate orbital data (TLE), server-side pass predictions, and a collaborative observations feed (likes, replies, nested comments).
Explore the Features »
- Interactive 3D globe (Cesium) with satellite markers.
- Personal watchlist: add/remove satellites, share/import watchlists.
- Pass predictions tailored to your location (server-side propagation).
- Observations feed with: public posts, likes, nested replies/comments.
- Robust CSRF protection and session security
- Server-side geocoding using Nominatim (change location from UI).
- Responsive dashboard and helpful guide modal for new users.
| Page | Description |
|---|---|
Landing / Home (index.php) |
Project landing and quick actions (intro, login/register, demo link). |
Dashboard (dashboard.php) |
User dashboard with the interactive globe, watchlist, upcoming passes, and observations feed. |
Login (login.php) / Register (register.php) |
User authentication and account creation. |
Observations (observations.php) |
Community feed to post observations, like, and reply (nested comments supported). |
Pass Predictions (passes.php) |
Server-side pass predictions personalized to user location and watchlist. |
Profile (profile.php) |
Manage account details, location, and watchlist import/export. |
Watchlist API (api/add_watchlist.php, api/remove_watchlist.php) |
AJAX endpoints to add/remove satellites from a personal watchlist. |
About (about.php) / Help (help.php) |
Project information, guides, and UI help. |
Developer/Test (test.php) |
Misc developer/testing utilities (not part of user-facing UI). |
| Technology | Purpose |
|---|---|
| HTML5 / CSS3 / Tailwind (CDN) / CesiumJS / satellite.js | Frontend structure and design |
| Vanilla JS | Client-side interactivity |
| PHP(mysqli) | Backend logic and data handling |
| MySQL | Database management (migrations in migrations/ and database/schema.sql) |
| Git & GitHub | Version control and collaboration |
| Other libs | Three.js (visuals), Nominatim (geocoding), N2YO/CelesTrak for seeding |
- PHP 8+, MySQL, and a local webserver (XAMPP/Apache recommended on Windows)
- Composer is not required for core app code but may be helpful for tooling
- Clone the repository
git clone https://github.com/marzafiee/SatTrack.git
- Create a database and apply migrations (or import
database/schema.sql).
- Using MySQL CLI or phpMyAdmin: import
database/schema.sqland then run migration SQL files inmigrations/if needed. - Open phpMyAdmin
- Create a new database (e.g., attendance_db)
- Import the .sql file located in the /database folder
-
Copy the example
.envand set values (create.envinsattrack/):DB_HOST=localhost DB_NAME=sattrack DB_USER=root DB_PASS= N2YO_API_KEY= CESIUM_TOKEN=
-
Seed satellite data (optional):
- Use
database/seed_satellites.phpif you want to import a sample dataset for development.
- Run the project
- Start your local server (e.g., XAMPP or WAMP)
- Visit http://localhost/sattrack/ (or your webserver's configured path)
- Schema files:
database/schema.sql - Migrations directory:
migrations/(contains SQL to add likes/comments, parent comment support, etc.)
Tip: For small changes or testing, use phpMyAdmin or mysql CLI:
mysql -u root -p sattrack < database/schema.sql
mysql -u root -p sattrack < migrations/add_parent_to_observation_comments.sqlThese are used by the front-end JavaScript and are located in api/:
api/get_tle_data.php— fetch TLE for watchlist satellitesapi/add_watchlist.php— add satellite to watchlistapi/remove_watchlist.php— remove from watchlistapi/update_location.php— resolve location (Nominatim) and save lat/lngapi/add_observation.php— create an observation (CSRF-protected)api/add_comment.php— add comment/reply to an observation (supportsparent_comment_id)api/get_comments.php— get nested comments for an observationapi/toggle_like.php— like/unlike an observation
All write endpoints require login and CSRF token (hidden input[name="csrf"] in forms). Successful AJAX actions return csrf_new to rotate tokens and avoid stale-token errors.
- Observations feed supports nested replies (unbounded depth) and in-place updates.
- The globe shows colored markers for satellites even if TLEs are temporarily missing (placeholder markers), and shows orbits when TLEs are available.
- Sidebar help button is pinned to the bottom of the watchlist regardless of length.
- Sessions use
HttpOnly,SameSite=Strict, andSecurewhen HTTPS is present. - CSRF tokens are stored server-side in
csrf_tokenstable; a session fallback is used if DB writes fail (to avoid "invalid CSRF token" issues during development). - In production, serve over HTTPS and set secure cookie flags.
-
If you see "invalid csrf token" when submitting forms:
- Ensure PHP sessions are working (session cookie present) and DB is reachable.
- The system now falls back to session-stored tokens if DB insert fails.
- After successful AJAX writes, the server returns
csrf_new— the client updates the token automatically.
-
If the globe is empty:
- Confirm
api/get_tle_data.phpreturns satellite data for your watchlist. - Placeholder markers are shown if TLEs are missing; orbits require valid TLEs.
- Confirm
- Fork the repo, create a branch, and open a PR describing the change.
- Tests: manual UI/UX testing is used; aim to add regression checks for critical behaviors (CSRF, comment nesting, watchlist add/remove).
- If adding DB migrations, place them in
migrations/and includeALTER TABLEstatements for incremental updates.
- Contributors: see repo blame/commits
- Libraries & services: CesiumJS, satellite.js, Three.js, OpenStreetMap/Nominatim, N2YO/CelesTrak APIs.
- Distributed under the MIT License.
- See LICENSE for more information.
- GitHub Repository: SatTrack Repo
- View Live Site here: Demo SatTrack
