How minhkhang2222/smartbox-lastmiledelivery works
SmartLocker provides parcel drop-off and pickup through a React client, Spring Boot business API, persisted order/locker state, MQTT-controlled hardware, and face recognition. The principal workflow is order creation and locker assignment, device unlock/deposit confirmation, then recipient pickup by face authentication or OTP. The README documents PostgreSQL, MQTT, Raspberry Pi, and FastAPI integrations; sampled sources confirm key order, enrollment, and face-unlock behavior. Several controllers, schedulers, and hardware details are represented at their exact tree paths but were not sampled, so undocumented links are omitted.
Main entry points: App.jsx React application · controller REST controllers · repository Persistence repositories · FaceAuthenticationService.java Face unlock orchestration
Components 22
Web client
- React application
frontend/src/App.jsx - Orders and dashboard
frontend/src/components - Face enrollment UI
frontend/src/components/FaceEnrollment.jsx - Administration UI
frontend/src/components/Admin.jsx
Business backend
- Login and JWT
src/main/java/smartlocker/smartlocker/controller/AuthController.java - REST controllers
src/main/java/smartlocker/smartlocker/controller - Order lifecycle
src/main/java/smartlocker/smartlocker/service/OrderService.java - OTP pickup
src/main/java/smartlocker/smartlocker/service/PickupOtpService.java - Face unlock orchestration
src/main/java/smartlocker/smartlocker/service/FaceAuthenticationService.java - Embedding registration
src/main/java/smartlocker/smartlocker/service/FaceAuthRegService.java - MQTT command publisher
src/main/java/smartlocker/smartlocker/service/MqttCommandPublisher.java - MQTT event handling
src/main/java/smartlocker/smartlocker/service/MqttEventListener.java - Order timeout schedulers
src/main/java/smartlocker/smartlocker/schedule - Order and locker state
src/main/java/smartlocker/smartlocker/model/Order.java - Persistence repositories
src/main/java/smartlocker/smartlocker/repository
Locker hardware
- Raspberry Pi gateway
HardwareCode/raspberry_gateway/app.py - Camera and face client
HardwareCode/raspberry_gateway/camera.py
Face recognition
- Embedding service
microservice/ApiLayer/app.py
Other components
- Locker user
- PostgreSQL
- MQTT broker
- ESP32 locker device
Connections 27
- Locker user → React application: uses
README.md - React application → REST controllers: HTTP requests
README.md - React application → Login and JWT: logs in
frontend/src/App.jsx - React application → Orders and dashboard: routes to
frontend/src/App.jsx - React application → Face enrollment UI: routes to
frontend/src/App.jsx - React application → Administration UI: routes to
frontend/src/App.jsx - REST controllers → Order lifecycle: handles orders
- Order lifecycle → Persistence repositories: reads and writes
src/main/java/smartlocker/smartlocker/service/OrderService.java - Order lifecycle → MQTT command publisher: publishes commands
src/main/java/smartlocker/smartlocker/service/OrderService.java - MQTT command publisher → MQTT broker: publishes MQTT
README.md - MQTT broker → ESP32 locker device: dispatches commands
README.md - ESP32 locker device → MQTT broker: reports events
README.md - MQTT event handling → Persistence repositories: updates state
- Order timeout schedulers → Persistence repositories: checks timeouts
src/main/java/smartlocker/smartlocker/repository/OrderLockerRepository.java - Persistence repositories → PostgreSQL: persists entities
README.md - REST controllers → OTP pickup: handles OTP pickup
- OTP pickup → MQTT command publisher: publishes unlock
src/main/java/smartlocker/smartlocker/service/PickupOtpService.java - Raspberry Pi gateway → Camera and face client: uses camera
HardwareCode/raspberry_gateway/app.py - Raspberry Pi gateway → Face unlock orchestration: sends embedding
README.md - REST controllers → Face unlock orchestration: handles face auth
- Face unlock orchestration → MQTT command publisher: publishes unlock
src/main/java/smartlocker/smartlocker/service/FaceAuthenticationService.java - Face unlock orchestration → Persistence repositories: loads orders
src/main/java/smartlocker/smartlocker/service/FaceAuthenticationService.java - Face enrollment UI → REST controllers: submits enrollment
- REST controllers → Embedding registration: registers faces
- Embedding registration → Embedding service: requests embeddings
README.md - Embedding registration → Persistence repositories: stores vectors
src/main/java/smartlocker/smartlocker/service/FaceAuthRegService.java - Face unlock orchestration → Embedding service: matches vectors