How dream-programmer-lazy/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 churn prediction and stores the resulting profile. Staff can view, add, batch-import, and delete member records through an admin dashboard, while users and admins have separate registration/login and dashboard routes. The repository also contains a Python prediction API and model-training code. Some page and ML internals were not excerpted, so links involving them are omitted unless the source index or excerpts establish them.
Main entry points: App.jsx Route application · server.js Express server · customerRoutes.js Customer routes · customerController.js Customer controller
Components 21
Web application
- Route application
frontend/src/App.jsx - Public landing
frontend/src/pages/LandingPage.jsx - Member dashboard
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
Identity and access
- Auth routes
backend/routes/authRoutes.js - Auth controller
backend/controllers/authController.js - User model
backend/models/User.js - Auth middleware
backend/middlewares/authMiddleware.js
Member management
- Express server
backend/server.js - Customer routes
backend/routes/customerRoutes.js - Customer controller
backend/controllers/customerController.js - Customer model
backend/models/Customer.js
Churn prediction
- Prediction API
ml-api/app.py - Model training
ml-api/train_model.py - Trained model
ml-api/gym_churn_model.pkl
Other components
- Prospective member
- Staff user
- MongoDB
Connections 22
- Prospective member → Public landing: visits
frontend/src/pages/LandingPage.jsx - Public landing → Express server: submits registration
frontend/src/pages/LandingPage.jsx - Staff user → Login page: signs in
- Staff user → Member dashboard: manages members
- Route application → Public landing: routes to
frontend/src/App.jsx - Route application → Login page: routes to
frontend/src/App.jsx - Route application → Admin registration: routes to
frontend/src/App.jsx - Route application → User registration: routes to
frontend/src/App.jsx - Route application → Member dashboard: routes to
frontend/src/App.jsx - Route application → User dashboard: routes to
frontend/src/App.jsx - Express server → Auth routes: mounts routes
backend/server.js - Express server → Customer routes: mounts routes
backend/server.js - Express server → MongoDB: connects to
backend/server.js - Auth routes → Auth controller: dispatches
backend/routes/authRoutes.js - Auth controller → User model: queries and saves
backend/controllers/authController.js - Customer routes → Auth middleware: guards routes
backend/routes/customerRoutes.js - Customer routes → Customer controller: dispatches
backend/routes/customerRoutes.js - Customer controller → Customer model: reads and writes
backend/controllers/customerController.js - Customer controller → Prediction API: requests prediction
backend/controllers/customerController.js - Member dashboard → Express server: loads and manages records
frontend/src/pages/CustomerManagement.jsx - Prediction API → Trained model: uses model
- Model training → Trained model: produces model