How jjhelloo/rf_tracker_backend works
This Node.js backend accepts Android-app and web-interface requests for authentication, users, RF devices, location updates, and geofence boundaries, persists and queries data in MySQL, and returns JSON responses. The main flow is HTTP entry and route dispatch, followed by controllers, SQL access, and database operations. Authentication helpers and token-based device lookup form an internal service layer. The README also describes sending stored data to the web interface; the sampled code shows query endpoints and responses, but not a separate push or delivery mechanism. hold.js is a core-indexed module whose behavior was not sampled.
Main entry points: index.js Express Server · executeSQL.js SQL Executor · authController.js Login and Tokens · deviceController.js RF Devices and Location
Components 17
HTTP and Routing
- Express Server
index.js - Auth Routes
routes/authRoutes.js - Device Routes
routes/deviceRoutes.js - User Routes
routes/userRoutes.js - Geofence Routes
routes/geofenceRoutes.js
Product Operations
- Login and Tokens
controllers/authController.js - RF Devices and Location
controllers/deviceController.js - User Management
controllers/userController.js - Geofence Boundaries
controllers/geofenceController.js
Internal Services
- SQL Executor
middleware/executeSQL.js - Credential and Token Helpers
utils/utils.js - Additional Core Logic
hold.js
Persistence
- MySQL Pool
dbPool.js - Database Config Pool
config/databaseConfig.js
Other components
- Android App
- Web Interface
- MySQL Database
Connections 27
- Android App → Express Server: sends requests
index.js - Web Interface → Express Server: sends requests
index.js - Express Server → Auth Routes: mounts
index.js - Express Server → Device Routes: mounts
index.js - Express Server → User Routes: mounts
index.js - Express Server → Geofence Routes: mounts
index.js - Auth Routes → Login and Tokens: dispatches
routes/authRoutes.js - Device Routes → RF Devices and Location: dispatches
routes/deviceRoutes.js - User Routes → User Management: dispatches
routes/userRoutes.js - Geofence Routes → Geofence Boundaries: dispatches
routes/geofenceRoutes.js - Login and Tokens → SQL Executor: queries
controllers/authController.js - RF Devices and Location → SQL Executor: queries
controllers/deviceController.js - User Management → SQL Executor: queries
controllers/userController.js - Geofence Boundaries → SQL Executor: writes boundary
controllers/geofenceController.js - Login and Tokens → Credential and Token Helpers: checks credentials
controllers/authController.js - RF Devices and Location → Credential and Token Helpers: resolves device
controllers/deviceController.js - Credential and Token Helpers → SQL Executor: queries
utils/utils.js - SQL Executor → MySQL Pool: runs queries
middleware/executeSQL.js - MySQL Pool → MySQL Database: connects
dbPool.js - Database Config Pool → MySQL Database: creates pool
config/databaseConfig.js - Credential and Token Helpers → Database Config Pool: imports pool
utils/utils.js - Login and Tokens → Android App: returns auth result
controllers/authController.js - Login and Tokens → Web Interface: returns auth result
controllers/authController.js - RF Devices and Location → Android App: returns response
controllers/deviceController.js - RF Devices and Location → Web Interface: returns device data
controllers/deviceController.js - User Management → Web Interface: returns response
controllers/userController.js - Geofence Boundaries → Web Interface: returns response
controllers/geofenceController.js