Live device tracking
Markers move on the map as Socket.IO position updates arrive, without the page polling for them.
A case study in combining REST, Socket.IO and Firebase Cloud Messaging into one map-based interface for watching, managing and getting alerts from tracker devices.

SafeGuard Tracking is a real-time GPS tracking dashboard I built in React and TypeScript for monitoring and managing tracker devices through a responsive, map-based interface.
Live positions arrive over Socket.IO and move the markers as they come in. History, device settings and the account come through REST APIs. Alerts, including geofence entry and exit, reach the user through Firebase Cloud Messaging, with a service worker picking them up when the dashboard is closed. Route history, direction mapping and device controls share the same interface.
Underneath, the application is modular: shared state in the Context API, socket subscriptions and data fetching wrapped in custom React hooks, and every request routed through one central API layer. That structure is what let screens such as geofencing be added without reaching into the internals of the map.
A GPS tracker is only as useful as the screen that reads it, and its owner wants to know where it is, where it has been, and whether anything needs attention.
If the position on the map is a minute stale, or a boundary alert only shows up the next time the owner opens the page, the device has not done its job.
Those answers come from data with very different timing. A current position changes every few seconds. A route history over the last day is a large, settled dataset. An alert is rare and urgent, and it matters most when the dashboard is not even open. The task was to build one frontend that handled all three without making the user think about where each piece of information came from.
| Before SafeGuard Tracking | With SafeGuard Tracking |
|---|---|
| Polling an endpoint and still seeing stale positions | Markers that move as Socket.IO updates arrive |
| Alerts that wait until the page is opened again | Firebase push notifications, even with the dashboard closed |
| A day of raw coordinates | Route history with direction mapping for a chosen time range |
| A device list and a map that disagree | One shared tracker state behind every screen |
The brief I set myself
I built the SafeGuard Tracking frontend application in React and TypeScript, from the live map and alerts to device management and the full authentication flow.
That meant the map interface and live markers, route history and direction mapping, the alerts and notification centre, tracker management screens, the geofencing UI, and login, signup and OTP verification. The client talks to a backend through REST APIs and a Socket.IO connection, and receives push notifications through Firebase Cloud Messaging.
My part was the client side of that contract: deciding how each channel feeds the interface, where shared state lives, and how a component gets the data it needs without knowing which channel delivered it.
| Map | The map interface, live markers, route history and direction mapping. |
|---|---|
| Alerts | The alerts and notification centre, Firebase push and unread tracking. |
| Devices | Tracker management for status, battery level and settings, plus the geofencing UI. |
| Authentication | Login, signup, OTP verification and a session persisted in Local Storage. |
| Architecture | Context API state, custom hooks and a central API layer for REST and Socket.IO. |
A session moves from signing in to watching devices live, looking back over their routes, and being alerted when a tracker crosses a boundary, even with the dashboard closed.
Step 1
A new user signs up and verifies with a one-time password. The session is kept in Local Storage, so a refresh or a return visit does not ask for another login.
Step 2
The initial device list comes over REST, then Socket.IO position updates move each marker on the map as they arrive.
Step 3
Pick a time range and the movement history is drawn as a route with direction mapping, so the order of travel is clear.
Step 4
When a tracker enters or leaves a geofence, the alert arrives as a push notification and lands in the in-app notification list as unread.
Everything a tracker owner checks sits on one screen: the live position, the route behind it, the state of each device, and every alert.
Data channels
3
Each kind of data reaches the dashboard over the channel that suits its timing, and all three feed the same shared state.
Markers move on the map as Socket.IO position updates arrive, without the page polling for them.
A past journey reads as a path with a clear heading, not a scatter of points.
Pick a range and see where a device went in that window, so a short range answers a specific question.
Boundaries that raise an alert when a tracker enters or leaves them.
Firebase Cloud Messaging delivers alerts even with the dashboard closed, and the app tracks which ones are unread.
Device status, battery level and settings for each tracker, kept in step with the map.
Login, signup and OTP verification, with a session that persists across refreshes.
Context API state, custom hooks and centralised API handling, so each screen only deals with display.
Four decisions shaped the frontend: which channel carries which data, how alerts reach a closed tab, where shared state lives, and how every request is made.
Realtime
Polling an endpoint every few seconds for every device would waste requests and still lag behind. Location updates come in over a Socket.IO connection and move the marker as they arrive. Data that is fetched once and then read, such as movement history for a chosen time range, device settings and the account, stays on ordinary REST calls, which are simpler to cache, retry and reason about.
On the server side of real-time work, I used Socket.io for live chat and notifications in the Cyborg Gaming backend. Working on the client here meant handling the same kind of event stream from the receiving end.
Alerts
A socket only helps while the page is open. A tracker crossing a geofence at night still needs to reach its owner, so alerts are also delivered as Firebase push notifications, and a service worker receives them when the dashboard is closed or in a background tab. Inside the app, the same alerts land in a notification list with unread tracking.
State
The state that many screens share is small and well defined: the session, the list of trackers and their latest status, and the notifications. React Context holds those, and custom hooks wrap the socket subscriptions and data fetching, so a map or a device card asks a hook for data and only deals with displaying it.
Data
All requests go through a central API layer that attaches the session, handles errors in one place and keeps endpoint paths out of components. The session itself persists in Local Storage, so a refresh or a returning visit does not force another login.
| Technology | What it does in SafeGuard Tracking |
|---|---|
| React.js | The whole client: the map, device panels, alerts and authentication screens. |
| TypeScript | Typed device, position and notification data across components and hooks. |
| Context API | Shared state for the session, the tracker list with latest status, and notifications. |
| Custom React Hooks | Socket subscriptions and data fetching, kept out of the display components. |
| Socket.IO | Live position updates that move markers as they arrive. |
| Firebase Cloud Messaging | Push delivery for alerts, including geofence entry and exit. |
| REST APIs | Movement history, device settings and account data, through one central API layer. |
| Local Storage | The persisted session, so a refresh does not force a new login. |
| Service Workers | Receiving push notifications when the dashboard is closed or in a background tab. |
Three of the hard parts: two channels describing one device, an alert the user has already seen, and a route history that stays readable.
Problem
A device card can be fed by a REST response when the page loads and by socket events after that. If the two are kept in separate places, the battery level in the list and the marker on the map can disagree about the same tracker.
Solution
Both sources write into the same shared tracker state held in Context. The initial REST load fills it, socket updates patch it, and every component reads from that single copy, so the list and the map always show the same device.
Problem
The same geofence event can surface as a push notification, as a live event in the open app and as an entry in the notification list. Counting it as unread in all three places would make the badge meaningless.
Solution
Unread status is tracked per notification in one place, and the badge is derived from that list. Opening the notification centre or the alert itself marks it read, whichever way the user first met it.
Problem
A day of position reports is a long list of coordinates. Drawn naively, a route turns into a tangle that tells the user little about where the device actually went.
Solution
History is requested for a time range the user picks and drawn as a route with direction mapping, so the order of travel is visible and a short range answers a specific question quickly.
SafeGuard Tracking gives a tracker owner one screen for the live position, the route behind it, the state of each device and every alert.
Notifications still arrive when the dashboard is closed, and the list, the map and the badge all read from the same state. The modular structure, with state in Context, logic in hooks and requests in one API module, kept new screens such as geofencing from reaching into the internals of the map. A similar split between screens and shared data runs through MedSalve, my pharmacy dashboard frontend, though there the data is mock rather than live.
Possible next steps include richer geofence shapes and exporting movement history, though these are ideas rather than committed plans.
Short answers to the questions people ask most about SafeGuard Tracking and how its live tracking and alerts work.
SafeGuard Tracking is a real-time GPS tracking dashboard for monitoring and managing tracker devices on a map. It shows live positions, route and movement history, device status and battery level, and geofence alerts in one interface.
React and TypeScript, with the Context API and custom React hooks for state, Socket.IO for live updates, REST APIs for settled data, Firebase Cloud Messaging and service workers for push alerts, and Local Storage for the session.
Position updates come in over a Socket.IO connection and move the device marker on the map as they arrive, instead of the page polling an endpoint every few seconds.
Yes. Alerts are delivered as Firebase push notifications, and a service worker receives them when the dashboard is closed or in a background tab. Inside the app, the same alerts appear in a notification list with unread tracking.
Yes. The geofencing UI raises an alert when a tracker enters or leaves a boundary, and those alerts go through the same push and in-app notification path as every other alert.
No. SafeGuard Tracking is a private project with no public link, so this case study describes how the frontend works rather than linking to it.
Muhammad Abdullah Awais, a full-stack developer based in Pakistan. I built the frontend application, and I am available for freelance and full-time work on real-time dashboards like it.
A Next.js gym management dashboard with member, trainer and admin workspaces, built as a frontend demo on mock data.
Read the case studyAn editorial LMS frontend in Next.js 16 with a reading-room lesson player and 13 hand-built UI primitives.
Read the case studyA frontend-only pharmacy management system UI with inventory, prescriptions, billing and a live role switcher.
Read the case studyI work remotely with teams in the US, Canada, the UK, Europe and the Gulf, and with clients across Pakistan. Based in Pakistan (PKT, UTC+5), available for freelance and full-time roles.