How phatcharanun/project1 works
This repository implements a browser-based geofence and QR-session checking app, served with its API by an Express backend. The principal flow is camera-based QR scanning, session extraction, GPS acquisition, and a POST check whose PostGIS result is shown in the browser. Separate capabilities include local biometric authentication and face scanning, a legacy client-side location check, and PWA installation/offline asset caching. The excerpts support the main API and scanner calls; the README is unreadable, and database schema details and page wiring were not sampled.
Main entry points: camera.js Camera workflow · Geofence.js Session geofence check · scanner.js QR decode and results · Node.js Geofence API
Components 20
Browser app
- App interface
Frontend/index.html - Camera workflow
Frontend/js/camera.js - QR scanner API
Frontend/qr-code-scanner/index.js - QR decode and results
Frontend/qr-code-scanner/scanner.js - Scanner settings
Frontend/qr-code-scanner/config.js - Session geofence check
Frontend/js/Geofence.js - Legacy local geofence
Frontend/js/location.js - Biometric authentication
Frontend/js/webauthn.js
API service
- Geofence API
Backend/Node.js
Geospatial data
- PostgreSQL connection pool
Backend/database.js - Geofence schema
Backend/init.sql
PWA support
- PWA manager
Frontend/pwa/pwa.js - Service worker
Frontend/sw.js
Other components
- App user
- Browser geolocation
- Browser camera
- Platform authenticator
- Browser cache
- PostgreSQL with PostGIS
- jsQR decoder
Connections 17
- Camera workflow → Browser camera: opens
Frontend/js/camera.js - Camera workflow → QR scanner API: starts
Frontend/js/camera.js - QR scanner API → QR decode and results: delegates
Frontend/qr-code-scanner/index.js - QR decode and results → Scanner settings: reads settings
Frontend/qr-code-scanner/scanner.js - QR decode and results → jsQR decoder: decodes with
Frontend/qr-code-scanner/scanner.js - Camera workflow → Session geofence check: passes QR result
Frontend/js/camera.js - Session geofence check → Browser geolocation: requests position
Frontend/js/Geofence.js - Session geofence check → Geofence API: POSTs coordinates
Frontend/js/Geofence.js - Geofence API → PostgreSQL connection pool: queries
Backend/Node.js - PostgreSQL connection pool → PostgreSQL with PostGIS: connects
Backend/database.js - Geofence API → App interface: serves static files
Backend/Node.js - Biometric authentication → Platform authenticator: authenticates with
Frontend/js/webauthn.js - PWA manager → Service worker: registers
Frontend/pwa/pwa.js - Service worker → Browser cache: reads and writes
Frontend/sw.js - App user → Camera workflow: initiates
- App user → Session geofence check: requests check
- App user → Biometric authentication: requests authentication