Bridging Hardware and Web: Building an Offline-First NFC Attendance System
Sajeshkumar Adeya
CTO TechSonance
Physical workforce management requires sub-second processing. In high-traffic office settings, employees expect to tap their badges and walk through gates immediately. Any network hiccup or delay halts productivity.
When building the NFC Attendance System, our goal was to bridge physical USB/Ethernet card readers to a central cloud server without introducing single-point-of-failure network bottlenecks.
The Hardware-to-Web Bridge Daemon
Web browsers cannot interface directly with raw USB serial ports natively. We engineered a light background Node.js daemon (Reader Agent) that runs locally on check-in terminal machines. The agent listens to card-scan serial events and writes logs locally before attempting network dispatch:
// Local buffering serial event listener
serialPort.on('data', (rawData) => {
const cardUid = parseCardUid(rawData);
localDb.run('INSERT INTO buffer (card_uid, timestamp) VALUES (?, ?)', [cardUid, Date.now()]);
triggerUploadQueue();
});
Edge SQLite Tables
By deploying edge-optimized **Turso** databases, the attendance system syncs logs between local nodes and central company servers automatically. If the internet goes offline, the system continues logging taps to SQLite, pushing all buffered records seamlessly once the router reconnects.
Keep Reading
Building Scalable Multi-Tenant Architecture for Indian Logistics
An in-depth look at how we engineered Row-Level Security and multi-tenant database isolation to power FreightFlow's national operations.
Why We Chose React 19 and Next.js for SyncServe Retail POS
Discover why offline-first IndexedDB structures and React 19 concurrent features are crucial for modern checkout terminals.