← All projects

Fleet trackingLive

GeoGuard

Draw geofences on a map, track vehicles, and get an alert the moment one enters or leaves a zone. PostGIS does the geometry; alerts reach the dashboard live over WebSocket.

GeoGuard screenshot

Overview

Draw virtual boundaries (geofences) on a map, track vehicles, and get an alert the moment a vehicle enters or leaves a zone, especially a restricted one.

A Go API checks each location update against PostGIS, works out which zones a vehicle entered or left, stores the events, and pushes alerts to the dashboard over WebSocket once the database commit lands.

Technologies used

GoPostgreSQL + PostGISReactTypeScriptLeafletWebSocketDockerGitHub Actions

Key features

  • Draw geofences on the map, and click it to move a vehicle.
  • Entry and exit detection, with restricted-zone entries always raising an alert.
  • Live toasts and an alert feed over WebSocket, plus a filterable, paginated violation history.
  • Alert rules per geofence, per vehicle and per event type.
  • Per-IP rate limiting on location updates, optional API-key auth, and pagination on every list.

How it's built

  • Point-in-polygon in PostGIS (ST_Covers with a GIST index), so a point on the border counts as inside and lookups stay fast with many zones.
  • Each vehicle's row is locked while its ping is processed, so two pings arriving together can't create duplicate entry events.
  • A ping older than the last one processed goes into history only, so out-of-order delivery never fakes an exit or entry.
  • Alerts are pushed only after the commit, so clients never hear about an event that was rolled back; one hub goroutine owns the client list and drops slow clients.
  • Tests run against PostGIS in CI, and the backend ships as a Docker image with its migrations built in.