EV SLA.
A real-time field service tracking and verification system. Location-based task validation and live tracking for operational control.
- Client
- Evrentek · self-initiated
- Year
- 2025
- Stack
- Next.jsFirebaseNode.js
The outcome
Before
Managers couldn't verify when or where field jobs actually started, so job times were disputed and progress was guesswork.
After
A job can only start on-site, managers see progress live, and disputed job-start times dropped to roughly zero.
Under the hood
01 / The Problem
Field operations lack control, verification, and real-time visibility. Managers can't confirm when work starts, where technicians are, or if tasks are completed on time.
02 / The Solution
EV SLA brings location-based task validation and live tracking. Start a job only when on-site. Managers see progress in real time. KPIs and completion data flow automatically.
What EV SLA does
Task assignment
Assign jobs to technicians with deadlines and priority
Live tracking
Real-time visibility of technician location and status
Location verification
Jobs start only when technician reaches the site
How it flows
- Step 01
Manager assigns task
Set location, deadline, and priority
- Step 02
Technician receives job
Sees details and navigation
- Step 03
Location verification
Job starts only when on-site
- Step 04
Completion tracking
Status and KPIs updated in real time
Architecture & Technical Design
The shape of the system
// System flow
TaskCreated
→ AssignedToTechnician
→ LocationVerified (geofence)
→ JobStarted
→ JobCompleted
→ KPIsUpdated
// Tech stack
Next.js · Firebase (Realtime DB) · Node.jsDecisions
Key technical decisions
- 01
Accuracy-aware geofence instead of a strict radius
Rejected: Fixed radius check · Manual supervisor confirmation
Urban GPS fixes can be 30–50 m off. Widening the fence by the reported accuracy (with a hard cap) keeps honest technicians unblocked in dense areas while still rejecting fixes taken from home.
- 02
Task state transitions validated by Firestore security rules
Rejected: Server-side API validation · Client-trusted writes
The state machine (assigned → started → completed) is enforced at the database boundary, so even a modified client cannot skip the location proof. Rules also validate offline writes when they replay after reconnection.
- 03
Firestore realtime listeners for the dispatcher board
Rejected: Polling a REST API · WebSocket server
Dispatchers watch dozens of tasks at once. Firestore snapshots push only deltas, offline persistence comes free, and there is no socket server to operate — the right trade for a small team running production infrastructure.
Code
Real code patterns
Geofence verification with accuracy tolerance
The verification runs client-side for instant feedback, but the captured proof (coordinates, accuracy, timestamp) is stored with the transition and re-checked by security rules.
function canStartJob(task: Task, fix: GeoFix): boolean {
const distanceM = haversine(task.site, fix.coords);
// Widen the fence by GPS accuracy, capped to prevent abuse
const tolerance = Math.min(fix.accuracyM, MAX_ACCURACY_BONUS_M);
return distanceM <= task.radiusM + tolerance;
}
function haversine(a: LatLng, b: LatLng): number {
const R = 6371e3;
const dLat = rad(b.lat - a.lat);
const dLng = rad(b.lng - a.lng);
const h = Math.sin(dLat / 2) ** 2 +
Math.cos(rad(a.lat)) * Math.cos(rad(b.lat)) * Math.sin(dLng / 2) ** 2;
return 2 * R * Math.asin(Math.sqrt(h));
}The state machine lives in security rules
No transition can skip a step, and only the assigned technician can move their own task. The client cannot fabricate a completed task without a verifiable start.
match /tasks/{taskId} {
allow update: if
request.auth.uid == resource.data.assigneeId &&
(
// assigned -> started requires a location proof
(resource.data.status == 'assigned' &&
request.resource.data.status == 'started' &&
request.resource.data.startProof.keys()
.hasAll(['lat', 'lng', 'accuracy', 'at']))
||
// started -> completed
(resource.data.status == 'started' &&
request.resource.data.status == 'completed')
);
}Why It Matters
Field operations become transparent and accountable. No more guessing — managers have real-time control. Technicians follow clear workflows.
Next case study
EV IDWork together
Building something similarLet's talk.
I’m happy to talk through field-operations architecture — get in touch.