For gyms, community centers, coworking spaces, and wellness clubs, member check-in is the heartbeat of daily operations. Traditionally, setting up a check-in scanner required purchasing dedicated hardware or forcing staff and members to install native app store applications.
With modern Web APIs, however, you can run a lightning-fast, highly accurate barcode and QR code scanner directly within any web browser.
In this guide, we will walk you through building a client-side member check-in scanner using the browser’s native camera APIs and JavaScript.
Why Choose an In-Browser Scanner?
Running a member scanner directly inside the web browser offers several advantages:
- Zero Installation: Staff can open a secure web page on any smartphone, tablet, or webcam-equipped laptop and start scanning immediately.
- Hardware Agnostic: Works on iOS, Android, macOS, and Windows.
- Instant Database Integration: Captured codes can be immediately cross-referenced with your CRM database over a secure local network or API.
- Lower Costs: Eliminates the need for expensive physical USB scanners.
Step 1: Requesting Camera Access with getUserMedia
The foundation of any web-based scanner is the HTML5 MediaDevices API. We use navigator.mediaDevices.getUserMedia to request permission and stream video from the device’s camera.
Here is how you request access to the rear-facing camera (ideal for scanning codes on mobile devices):
async function startCamera(videoElement) {
try {
const constraints = {
video: {
facingMode: "environment" // Requests the back-facing camera
},
audio: false
};
const stream = await navigator.mediaDevices.getUserMedia(constraints);
videoElement.srcObject = stream;
videoElement.setAttribute("playsinline", true); // Required for iOS Safari
videoElement.play();
} catch (error) {
console.error("Error accessing camera: ", error);
}
}
Step 2: Decoding QR Codes in Real Time
To process the video frames and extract data from a QR code, you can use high-performance open-source libraries like html5-qrcode or jsQR, or utilize the native browser BarcodeDetector API (where supported).
Here is a simplified scanning loop utilizing an image processing library:
import { Html5Qrcode } from "html5-qrcode";
function initializeScanner() {
const html5QrCode = new Html5Qrcode("reader-container-id");
const qrCodeSuccessCallback = (decodedText, decodedResult) => {
handleMemberCheckin(decodedText);
};
const config = {
fps: 10,
qrbox: { width: 250, height: 250 }
};
html5QrCode.start(
{ facingMode: "environment" },
config,
qrCodeSuccessCallback
);
}
Step 3: Verifying Memberships Locally and Securely
Once a barcode or QR code is read, the scanner sends the decoded payload (usually a unique member ID or secure token) to your CRM or local database.
If you are using a local-first approach like MembershipSoft’s offline mode, the verification query runs instantly against an on-device database:
async function handleMemberCheckin(memberId) {
const member = await db.query(
"SELECT name, status, expires_at FROM members WHERE id = ? LIMIT 1",
[memberId]
);
if (!member) {
playAudioFeedback("error");
showStatusAlert("Member Not Found", "red");
return;
}
const today = new Date().toISOString();
if (member.status === "active" && member.expires_at > today) {
playAudioFeedback("success");
showStatusAlert(`Welcome, ${member.name}!`, "green");
await logCheckin(memberId);
} else {
playAudioFeedback("warning");
showStatusAlert("Membership Expired / Inactive", "orange");
}
}
Key Considerations for In-Browser Scanners
- HTTPS is Mandatory: Browsers disable camera access (
navigator.mediaDevices) on unsecure connections. Your application must run on HTTPS (or localhost for development). - Audio and Visual Feedback: Scannings should feel physical. Always play a distinct “beep” sound for successful check-ins and a visual green flash to give immediate feedback to operators.
- Power Consumption: Keeping a camera stream open drains mobile batteries. Ensure you build a sleep timer or auto-turn-off feature when the scanner is idle.
In-Browser Scanning with MembershipSoft
MembershipSoft comes with a native, built-in check-in module that utilizes these technologies. It allows front-desk staff or self-service kiosks to scan digital member cards directly from mobile screens or printed key tags using standard webcams. With local-first OPFS database technology, check-in works seamlessly even when the internet goes offline, syncing data back to the cloud when connections are restored.
Experience Built-in Check-in Scanning with MembershipSoft
Building client-side web tools is simple, but having an all-in-one membership management platform with native camera check-in, offline local storage, and automated member billing is even better.
Discover how MembershipSoft powers lightning-fast member check-ins for gyms, clubs, and venues. Start your free account today or view our transparent pricing plans.