Skip to content

Aflon Mark

Full Stack Engineering

I built an Expo QR scanner that queues offline check-ins and check-outs in AsyncStorage. The Next.js API replays scans using their original capture time, applies the same campus schedule rules to QR and RFID, and enforces one MongoDB attendance record per staff member and campus date.

How it’s built

Aflon Mark · Staff attendance system with QR mobile check-in, RFID hardware endpoints and admin reports

Aflon Mark records daily staff attendance from a mobile QR scanner and RFID card readers, with an admin dashboard for staff, schedules and reports. I built a Next.js API with 18 route files and 21 handlers, 3 MongoDB models, 7 admin screens, CSV exports, and an Expo app with an offline scan queue. All 31 commits across both repos are mine, with 144 automated tests.

API handlers in 18 route files
21
web pages (7 admin)
11
mobile screens
8
automated tests (109 backend Jest + 35 mobile)
144
lines of JS/TS in backend / mobile app
10,148 / 5,394

Technology and what it does here

Next.js 16 (App Router)
API route handlers and the admin dashboard in one app
MongoDB + Mongoose 9
User, Attendance and Settings models with a unique userId+date index
Expo 57 + React Native
Staff mobile app with Expo Router auth and staff groups
expo-camera
Scans the rotating QR code for check-in and check-out
AsyncStorage
Persists the offline scan queue and failed-scan log
x-api-key endpoints
Authenticate RFID readers for card signup and attendance
date-fns
Schedule windows, late cutoffs and report date ranges
Recharts / react-native-chart-kit
Attendance charts on web dashboard and mobile stats
qrcode / qrcode.react
Generates the attendance QR shown on the admin QR page
Nodemailer
Password reset emails
Jest
Schedule, report, register and offline sync logic tests
Vercel
Hosts the backend at aflon-mark-backend.vercel.app

Implementation details

  • AttendanceSchema.index({ userId: 1, date: 1 }, { unique: true }) enforces one record per staff member per day.
  • Offline scans are stored with the ISO timestamp captured at scan time and replayed later, separating retryable errors from permanent rejections.
  • Schedules define checkInEnd, checkInClose, checkOutStart, checkOutEnd with a Friday override applied to both QR and RFID.
  • The export route returns a grouped attendance report or a monthly register as CSV, or JSON for the printable view.

System architecture

Mobile QR scans and RFID readers use the same attendance rules. When connectivity drops, the mobile app keeps a scan with its original capture time for later sync.

Drag to rotate

Mobile QR check-in

  1. Passes to the next component: Scan and capture time
  2. Passes to the next component: Ordered retry
  3. Passes to the next component: Validated event

RFID check-in

  1. Passes to the next component: RFID event

Attendance review

System connections

Decision branches

  • Expo QR scanner

    Connectivity is unavailable

    Queue the scan locally and retry with its original capture time.

Component details

Results and testing

  • 35 passing offline checks

    The mobile suite runs the queue code with simulated storage and API responses. It passed checks for timestamp preservation, replay order, retries, and the handling of scans already recorded by the server.

  • Schedule and replay fixtures

    Backend fixtures cover campus dates around midnight, weekday overrides, duplicate check-ins, and absence totals calculated from scheduled working days.

  • Next engineering milestone

    Bind attendance writes to authenticated staff sessions, restrict exports to authorized administrators, and give each RFID reader its own credentials. Test those permissions with separate staff, administrator, and reader accounts.

Mobile Capture and Offline Sync

When the network is down, staff still need to record a scan and see its status. The time the phone reconnects should have no bearing on whether that scan was on time.

  • Preserve the original scan

    I added an AsyncStorage queue for check-ins and check-outs. A repeat scan for the same action and day keeps the original timestamp. The app caches attendance history and the schedule so staff can see useful information while offline.

  • Show pending and rejected scans

    I built a sync view with pending and rejected entries. It sends older scans first so a check-in can arrive before its check-out, retains entries after connection or server failures, and displays the reason when the server permanently rejects a scan.

Attendance Rules and Reporting

The scanner, hardware reader, and reporting dashboard need to agree on what counts as attendance. That requires a consistent campus calendar and a clear distinction between an absence and a missed check-out.

  • Share rules across QR and RFID

    I added RFID endpoints and moved attendance decisions into a shared server function. It applies the campus timezone and weekday-specific windows. The database schema defines one record per staff member and date, and the check-in path handles an index collision by returning the existing record.

  • Build a usable attendance register

    I added schedule controls, a department filter, and staff-level reports with printable and CSV views. The register uses configured working days to calculate absences and marks a missing check-out separately from a day with no attendance record.

Technologies

  • Expo
  • React Native
  • TypeScript
  • AsyncStorage
  • Next.js
  • MongoDB
  • Mongoose

Next project · Quant Trader

Sigmant

Portfolio assistant

Gabriel’s projects, experience, and research