How praneethk-002/fitness_tracker works
Fitness Tracker supports account registration and login, then lets authenticated users record, edit, delete, and view workout history. The frontend routes users through protected Home and History pages; page components call a shared API service that sends requests to the Express backend. The backend handles authentication and workout operations, including calorie calculation, and persists users and workouts through MongoDB models. The graph follows explicit imports and calls; database wiring and some unsampled page behavior are represented only where the available references support them.
Main entry points: App.jsx App routing · api.js API client · Home.jsx Workout home · server.js Express server
Components 20
Frontend
- App routing
frontend/src/App.jsx - Auth state
frontend/src/context/AuthContext.jsx - Navigation
frontend/src/components/Navbar.jsx - Login
frontend/src/pages/Login.jsx - Registration
frontend/src/pages/Register.jsx - Workout home
frontend/src/pages/Home.jsx - Workout history
frontend/src/pages/History.jsx - Workout form
frontend/src/components/WorkoutForm.jsx - Workout item
frontend/src/components/WorkoutItem.jsx - API client
frontend/src/services/api.js
Backend API
- Express server
backend/server.js - Auth endpoints
backend/routes/authRoutes.js - Workout endpoints
backend/routes/workoutRoutes.js - JWT middleware
backend/middleware/authMiddleware.js - Workout operations
backend/controllers/workoutController.js
Persistence
- User model
backend/models/User.js - Workout model
backend/models/Workout.js - Database config
backend/config/db.js
Other components
- User
- MongoDB
Connections 27
- User → App routing: uses
frontend/src/App.jsx - App routing → Auth state: provides auth
frontend/src/App.jsx - App routing → Navigation: renders
frontend/src/App.jsx - App routing → Workout home: routes
frontend/src/App.jsx - App routing → Workout history: routes
frontend/src/App.jsx - App routing → Login: routes
frontend/src/App.jsx - App routing → Registration: routes
frontend/src/App.jsx - Login → API client: calls
frontend/src/services/api.js - Registration → API client: calls
frontend/src/services/api.js - Login → Auth state: sets auth
frontend/src/pages/Login.jsx - Registration → Auth state: sets auth
frontend/src/pages/Register.jsx - Navigation → Auth state: reads auth
frontend/src/components/Navbar.jsx - Workout home → API client: loads workouts
frontend/src/pages/Home.jsx - Workout home → Workout form: renders
frontend/src/pages/Home.jsx - Workout home → Workout item: renders
frontend/src/pages/Home.jsx - Workout form → API client: submits workout
frontend/src/components/WorkoutForm.jsx - Workout item → API client: edits or deletes
frontend/src/components/WorkoutItem.jsx - Workout history → API client: loads workouts
frontend/src/pages/History.jsx - API client → Express server: HTTP requests
frontend/src/services/api.js - Express server → Database config: connects
backend/server.js - Express server → Auth endpoints: mounts
backend/server.js - Express server → Workout endpoints: mounts
backend/server.js - Auth endpoints → User model: reads and saves
backend/routes/authRoutes.js - Workout endpoints → JWT middleware: protects routes
backend/routes/workoutRoutes.js - Workout endpoints → Workout operations: dispatches
backend/routes/workoutRoutes.js - Workout operations → Workout model: queries and writes
backend/controllers/workoutController.js - Database config → MongoDB: connects