How jaronlee-stack/switch_project works
This is a posture-monitoring and coaching web application. Users submit camera frames for pose analysis; the server classifies posture, applies rules, stores detections, and exposes live status, history, and analytics. Authentication and role-protected rule administration are separate capabilities. The graph follows the documented Express routes and sampled posture-controller calls. Frontend request wiring and the camera/pose-service implementation are not shown, so those links are omitted; the bundled Python virtual environment is excluded as third-party tooling.
Main entry points: app.js Express routes · postureController.js Frame ingestion · api.js Browser API · dbConfig.js PostgreSQL pool
Components 20
Web application
- Express routes
src/app.js - Dashboard
src/public/Dashboard.js - Live coach
src/public/LiveCoach.js - History view
src/public/HIstory.js - Analytics view
src/public/Analytics.js - Browser API
src/public/api.js
Posture monitoring
- Frame ingestion
src/controller/postureController.js - Pose service
src/services/poseService.js - Camera capture
src/camera/camera.py - Posture rules
src/controller/rulesController.js - Analytics endpoints
src/controller/analyticsController.js - Coaching poller
src/services/ollamaService.js
Identity and access
- Authentication
src/controller/authController.js - JWT authorization
src/middleware/auth.js
Persistence
- Detection records
src/models/postureModel.js - Rule records
src/models/rulesModel.js - User records
src/models/authModel.js - Analytics data
src/models/analyticsModel.js - PostgreSQL pool
dbConfig.js
Other components
- User
Connections 24
- User → Dashboard: uses
- User → Express routes: requests
src/app.js - Express routes → Authentication: routes auth
src/app.js - Express routes → JWT authorization: protects routes
src/app.js - Express routes → Frame ingestion: routes frames
src/app.js - Express routes → Posture rules: routes rules
src/app.js - Express routes → Analytics endpoints: routes analytics
src/app.js - Frame ingestion → Pose service: detects pose
src/controller/postureController.js - Frame ingestion → Detection records: stores and reads
src/controller/postureController.js - Frame ingestion → Rule records: finds rule
src/controller/postureController.js - Authentication → User records: reads and writes
src/controller/authController.js - Posture rules → Rule records: reads and writes
src/controller/rulesController.js - Analytics endpoints → Analytics data: queries
src/controller/analyticsController.js - Detection records → PostgreSQL pool: queries
src/models/postureModel.js - Rule records → PostgreSQL pool: queries
src/models/rulesModel.js - User records → PostgreSQL pool: queries
src/models/authModel.js - Analytics data → PostgreSQL pool: queries
- Camera capture → Express routes: submits frames
- Pose service → Camera capture: uses camera input
- Dashboard → Browser API: uses requests
- Live coach → Browser API: uses requests
- History view → Browser API: uses requests
- Analytics view → Browser API: uses requests
- Express routes → Coaching poller: starts poller
src/app.js