Fleet Tracker

Setup guide

About 20 minutes, no coding, and free for a small fleet. You need a Google account (for Firebase, which stores the live locations) and an email address (for Netlify, which puts the app online).

Want to see it first? Do step 7 (Netlify) right away without changing anything. The map will show simulated demo trucks moving around Metro Manila.

Part 1 · Create the Firebase database

Firebase menus move around from time to time. If you can't find a menu item, type its name into the search box at the top of the Firebase console.

  1. Create a project. Go to console.firebase.google.com, sign in with Google, and click Create a project. Name it, for example fleet-tracker. Google Analytics isn't needed, so you can turn it off.
  2. Create the Realtime Database. In the left menu open Realtime Database (under Databases & Storage or Build) and click Create Database.
    • Location: Singapore (asia-southeast1), the closest one to the Philippines.
    • Security: choose Start in locked mode, then Enable.
  3. Paste the security rules. On the Realtime Database page open the Rules tab. Delete everything in the box, paste the whole contents of the file database.rules.json from this folder (open it with Notepad or TextEdit), and click Publish.
    These rules make sure only your dispatchers can see the map, and only phones with your fleet code can send locations.
  4. Turn on sign-in. Open Authentication → Get started → Sign-in method tab.
    • Click Email/Password, switch on the first toggle, and click Save. This is for dispatchers.
    • Click Add new provider → Anonymous, switch it on, and click Save. This lets drivers connect without a password.
  5. Get your app settings. Click the gear icon → Project settings → General. Under Your apps, click the web icon </>, enter any nickname, and click Register app. You don't need Firebase Hosting. Firebase then shows a block of code like this:
    const firebaseConfig = {
      apiKey: "AIzaSyB…",
      authDomain: "fleet-tracker-1a2b3.firebaseapp.com",
      databaseURL: "https://fleet-tracker-1a2b3-default-rtdb.asia-southeast1.firebasedatabase.app",
      projectId: "fleet-tracker-1a2b3",
      storageBucket: "fleet-tracker-1a2b3.firebasestorage.app",
      messagingSenderId: "1234567890",
      appId: "1:1234567890:web:abc123"
    };
    Keep this page open for the next step. You can always find it again under Project settings → General → Your apps.

Part 2 · Put your settings in the app

  1. Edit config.js. Open config.js from this folder in Notepad (Windows) or TextEdit (Mac). Replace each PASTE_… value with the matching value from step 5, keeping the quotes. Save the file.
    Check the databaseURL line. If Firebase's code block didn't include it, copy the address shown at the top of the Realtime Database Data tab (it ends in firebasedatabase.app).

    You can also change appName to your company's name. It appears at the top of every page.

    These values aren't secret passwords. Every website that uses Firebase includes them. The security rules from step 3 are what protect your data.

Part 3 · Put it online

  1. Upload to Netlify. Go to app.netlify.com/drop and drag the whole fleet-tracker folder onto the page. In a few seconds you get a web address like https://random-name-123.netlify.app.
    Claim it right away. Sign up for a free Netlify account and claim the site, or Netlify deletes it within an hour. After that you can change the name under the project's configuration, for example to yourcompany-trucks.netlify.app.
  2. Allow your web address in Firebase. In Firebase open Authentication → Settings → Authorized domains → Add domain, and enter your Netlify address without https://, for example yourcompany-trucks.netlify.app.

Part 4 · First run

  1. Become the owner. Do this immediately after step 8. Open https://your-address.netlify.app/dispatch.html, choose First time? Create account, and enter your email and a password. The first account ever created becomes the owner.
  2. Set the fleet code. The Settings panel opens by itself. Type a code or tap Make one for me, then Save code.
  3. Invite drivers. Under Driver link, tap Copy and send the link to your drivers by Viber, Messenger or SMS. Each driver opens it on their phone, enters the plate number and their name, taps Start tracking, and allows location access. The truck appears on your map within seconds.
  4. Add other dispatchers (optional). Under Settings → Dispatchers, add their email. They open dispatch.html, choose Create account, and use that same email.

Daily use

For drivers

What the colours mean on the map

Moving: driving faster than 5 km/h.
Stopped: tracker on, truck parked or in heavy traffic.
Paused: the driver locked the phone or switched to another app.
No signal: nothing received for 3 minutes. Weak signal, phone off, or dead battery.
Offline: the driver stopped tracking.

Route history

Click a truck, then Route today. Pick another date to see an earlier day. History older than 60 days is deleted automatically (change keepHistoryDays in config.js).

Changing settings later

Edit config.js, then in Netlify open your project → Deploys and drag the folder onto the upload box again. Drivers get the update the next time they open the page.

JAX Fleet Tracker app (Android)

Drivers with Android phones can use the JAX Fleet Tracker app instead of the web page. It keeps tracking with the screen locked or while they use Waze or Viber. Trucks using the app show on the same map.

  1. Put JAX-Fleet-Tracker.apk in this folder and upload the folder to Netlify again.
  2. Send drivers the app download link (Settings → JAX Fleet Tracker app) and the driver link.
  3. In the app, the driver pastes the driver link, enters the plate number and name, and taps START TRACKING. Then they work through the app's Set up this phone list.

Limits of the free setup

WhatFree limit (Firebase Spark plan)What it means for you
Phones and screens connected at once100Drivers tracking plus dispatcher screens open. Fine for up to about 90 trucks.
Data sent to dispatcher screens10 GB per monthEnough for about 50 trucks updating every 10 seconds, all day, with a couple of dispatcher screens. For more, set sendEverySeconds to 20 or 30.
Stored history1 GBMany months of routes for a small fleet.

If a free limit is reached, Firebase stops the database until the next month. To grow past these limits, upgrade the Firebase project to the pay-as-you-go Blaze plan.

Tracking needs the page open. A website can't track a locked phone. If you later need true background tracking like Uber's driver app, the same map and database can be used with a native Android app. Only the driver side changes.

Privacy

Tell drivers in writing what is tracked (location and speed, only while they tap Start) and why, and keep their acknowledgment. This follows the spirit of the Data Privacy Act of 2012 (RA 10173). Ask your lawyer for the exact wording.

If something goes wrong

You seeFix
The map still shows demo trucksconfig.js still has PASTE_… values, or you didn't upload the folder again after editing it.
Driver: “The dispatcher system refused this phone”Wrong or old fleet code. The driver stops tracking, taps Change, and enters the current code. Or send them the driver link again.
Driver: “Anonymous sign-in is turned off”Redo step 4 (the Anonymous part).
Driver: “Location permission is blocked”Follow “Location not working?” on the driver page, then reload.
Dispatcher: “No access yet”The owner adds that email under Settings → Dispatchers.
Errors mentioning “permission denied” right after setupThe rules weren't published. Redo step 3.
Sign-in fails with a domain errorRedo step 8 with the exact Netlify address.
Truck often shows PausedThe driver keeps switching to other apps. Remind them to keep the tracker on screen.