GPS Fleet Tracking API, Laravel to Go

The Problem #

A GPS fleet tracking system handling real-time vehicle tracking was built on Laravel (PHP) with MySQL. As the number of devices and location data volume grew, the system experienced bottlenecks:

The Solution #

Full backend conversion from Laravel → Go using Clean Architecture pattern, with a database migration from MySQL → PostgreSQL + TimescaleDB.

Architecture #

Request → Controller → UseCase → Repository → PostgreSQL/TimescaleDB
                       ↕
                    Gateway → External API / Kafka

Each layer has clear responsibilities:

Tech Stack #

Component Technology
Language Go 1.24
HTTP Framework GoFiber v2
Database PostgreSQL + TimescaleDB (hypertable for device data)
ORM/Driver pgx/v5 (raw SQL performance)
Messaging Apache Kafka (Sarama)
Cache Ristretto (in-memory)
Migration golang-migrate
Validation go-playground/validator
Auth JWT + unified auth

Key Features #

Results #

Lessons Learned #

  1. Clean Architecture enables gradual migration: each endpoint could be converted one by one without breaking changes, allowing v2 (Laravel) and v3 (Go) to run in parallel during the transition
  2. pgx/v5 > ORM for high-throughput: full control over SQL queries delivers more predictable performance compared to ORM abstractions
  3. TimescaleDB is a game-changer: hypertable + continuous aggregate replaced reporting queries that previously took minutes with sub-second results