How vanminhdang0405-web/kltn_web_gym_ai works
KOI Fitness is a gym membership and churn-risk management application. Prospective members submit fitness details; the backend requests an AI risk prediction and stores a customer record. Administrators can view, add, delete, and batch-import member records, while users and administrators have separate registration, login, and dashboard views. The sampled sources establish the customer API and its Flask prediction call; unsampled page behavior and prediction-route wiring are not inferred.
Main entry points: App.jsx Page router · server.js Express server · customerRoutes.js Customer routes · customerController.js Customer handlers
Components 22
Web application
- Page router
frontend/src/App.jsx - Landing and signup
frontend/src/pages/LandingPage.jsx - Member management
frontend/src/pages/CustomerManagement.jsx - Login page
frontend/src/pages/Login.jsx - Admin registration
frontend/src/pages/Register.jsx - User registration
frontend/src/pages/UserRegister.jsx - User dashboard
frontend/src/pages/UserDashboard.jsx
Accounts and access
- Account routes
backend/routes/authRoutes.js - Account handlers
backend/controllers/authController.js - User records
backend/models/User.js - Request authentication
backend/middlewares/authMiddleware.js
Member operations
- Express server
backend/server.js - Customer routes
backend/routes/customerRoutes.js - Customer handlers
backend/controllers/customerController.js - Customer records
backend/models/Customer.js
Churn prediction
- Prediction API
ml-api/app.py - Churn model
ml-api/gym_churn_model.pkl - Model training
ml-api/train_model.py - Training data
ml-api/gym_dataset.csv
Other components
- Visitor
- Administrator
- MongoDB
Connections 21
- Visitor → Landing and signup: submits details
frontend/src/pages/LandingPage.jsx - Landing and signup → Express server: posts signup
frontend/src/pages/LandingPage.jsx - Administrator → Member management: manages members
- Member management → Express server: calls customer API
frontend/src/pages/CustomerManagement.jsx - Page router → Landing and signup: routes to
frontend/src/App.jsx - Page router → Login page: routes to
frontend/src/App.jsx - Page router → Admin registration: routes to
frontend/src/App.jsx - Page router → User registration: routes to
frontend/src/App.jsx - Page router → Member management: routes to
frontend/src/App.jsx - Page router → User dashboard: routes to
frontend/src/App.jsx - Express server → Account routes: mounts routes
backend/server.js - Express server → Customer routes: mounts routes
backend/server.js - Account routes → Account handlers: dispatches requests
backend/routes/authRoutes.js - Account handlers → User records: reads and writes
backend/controllers/authController.js - Customer routes → Request authentication: guards routes
backend/routes/customerRoutes.js - Customer routes → Customer handlers: dispatches requests
backend/routes/customerRoutes.js - Customer handlers → Customer records: reads and writes
backend/controllers/customerController.js - Express server → MongoDB: connects to
backend/server.js - Customer handlers → Prediction API: requests prediction
backend/controllers/customerController.js - Prediction API → Churn model: uses model
- Model training → Training data: trains from