Back to projects
iOS & Android API

Smart Attendance App — Mobile API

Geofenced Check-ins, Selfie Verification, Shifts & Leave Management

LaravelPHP 8.2MySQLSanctumFCMS3 Storage
Platforms
iOS + Android
Auth
Sanctumtokens
Real-time
FCM push
Location
Geofencing
iOS & Android · REST APIUI concept
Smart Attendance App — Mobile API — screenshot

Backend for a workforce attendance app. Employees check in and out from their phone only when they are inside an approved location, with a selfie captured at check-in. Managers see live attendance, late arrivals and leave requests, and HR exports monthly reports.

Architecture & System Design

Each office or site is stored with a centre point and radius. On check-in the API validates the device's coordinates against the employee's assigned sites using a distance calculation, stores the selfie in object storage, and links the record to the employee's shift so lateness and overtime are computed on the server.

Request Flow
Mobile App (GPS + Selfie)
Sanctum Auth
Geofence Validation
Shift Matching
Attendance Record
Manager Dashboard
  • Server-side geofence checks so location rules can't be bypassed from the client
  • Shift-aware records calculate late arrivals, early exits and overtime automatically
  • Selfies stored in private object storage with signed URLs for managers
  • Leave requests flow through manager approval with push notifications at each step

Engineering Challenges

Trustworthy Location Checks

Problem

Attendance is only meaningful if staff are actually on site, but phone GPS can be inaccurate indoors.

Solution

Validated coordinates on the server with a configurable radius per site and stored the reported accuracy with each check-in, so borderline cases can be reviewed instead of silently rejected.

Result

Check-ins are enforced against real site boundaries while still handling weak indoor GPS fairly.

Night Shifts Crossing Midnight

Problem

Shifts like 10 PM–6 AM span two calendar days, which broke simple per-day attendance logic.

Solution

Modelled attendance against the shift window instead of the calendar date, so a check-out after midnight closes the shift it belongs to.

Result

Overnight shifts calculate hours worked correctly without special-case reports.

Core Features

Geofenced Check-in/out

Check-in is accepted only inside an assigned site's radius, with location and accuracy recorded.

Clean Code

GeofenceService.php
1public function isInside(Site $site, float $lat, float $lng): bool
2{
3 $earthRadius = 6371000; // metres
4
5 $dLat = deg2rad($lat - $site->lat);
6 $dLng = deg2rad($lng - $site->lng);
7
8 $a = sin($dLat / 2) ** 2
9 + cos(deg2rad($site->lat)) * cos(deg2rad($lat)) * sin($dLng / 2) ** 2;
10
11 $distance = 2 * $earthRadius * asin(sqrt($a));
12
13 return $distance <= $site->radius_m;
14}

Want something like this for your business?

I design and build full stack products end to end. Tell me about your idea and I'll get back to you with a plan.