Design and Implementation of an Online Gym Management System
A full-stack web application for comprehensive gym operations management. This is a final year school project demonstrating modern full-stack development with React, Node.js, Express, and MongoDB.
Gym Management System is a complete digital solution designed to streamline gym administration and enhance member experience. The application provides separate portals for administrators and members, enabling efficient management of classes, memberships, trainers, payments, and member enrollment.
Tech Stack: React + Vite | Node.js | Express.js | MongoDB | JWT Authentication | Tailwind CSS
- β Dashboard with real-time statistics and charts
- β Member management (create, read, update, delete)
- β Class scheduling and management
- β Trainer assignment and management
- β Payment tracking and revenue monitoring
- β Member search and filtering
- β Class capacity management
- β Member growth analytics
- β Dashboard with personal statistics
- β Browse available classes
- β Enroll in classes
- β View upcoming classes
- β Track fitness progress
- β Payment history
- β Profile management
- β Class enrollment management
- Node.js (v14 or higher)
- MongoDB (local or MongoDB Atlas)
- npm or yarn
git clone https://github.com/mafindijr/gym-management-system.git
cd gym-management-systemcd backend
npm installCreate a .env file in the backend directory:
PORT=5000
MONGO_URI=mongodb://localhost:27017/gym-management
JWT_SECRET=your-super-secret-jwt-key-here
NODE_ENV=developmentStart the backend server:
npm run devBackend will run on: http://localhost:5000
cd frontend
npm installCreate a .env file in the frontend directory:
VITE_API_URL=http://localhost:5000/apiStart the frontend development server:
npm run devFrontend will run on: http://localhost:5173
gym-management-system/
βββ backend/
β βββ src/
β β βββ config/
β β β βββ db.js
β β βββ controllers/
β β β βββ authController.js
β β β βββ memberController.js
β β β βββ classController.js
β β β βββ paymentController.js
β β β βββ studentController.js
β β β βββ dashboardController.js
β β βββ middlewares/
β β β βββ authMiddleware.js
β β βββ models/
β β β βββ User.js
β β β βββ Class.js
β β β βββ Trainer.js
β β β βββ Payment.js
β β βββ routes/
β β β βββ authRoutes.js
β β β βββ memberRoutes.js
β β β βββ classRoutes.js
β β β βββ studentRoutes.js
β β β βββ dashboardRoutes.js
β β βββ server.js
β βββ .env
β βββ package.json
β βββ README.md
β
βββ frontend/
β βββ src/
β β βββ Components/
β β β βββ modal.jsx
β β β βββ search-input.jsx
β β β βββ student-payment-form.jsx
β β βββ pages/
β β β βββ student-dashboard.jsx
β β β βββ student-classes.jsx
β β β βββ student-billing.jsx
β β β βββ members.jsx
β β β βββ classes.jsx
β β β βββ trainers.jsx
β β β βββ payments.jsx
β β β βββ admin-dashboard.jsx
β β βββ App.jsx
β β βββ main.jsx
β βββ .env
β βββ package.json
β βββ vite.config.js
β βββ README.md
β
βββ README.md (root)
http://localhost:5000/api
POST /auth/register
Body: { fullName, email, password }
POST /auth/login
Body: { email, password }
Response: { user, token, refreshToken }
GET /auth/me
Headers: Authorization: Bearer <token>
GET /members?search=john
Headers: Authorization: Bearer <token>
POST /members
Headers: Authorization: Bearer <token>
Body: { fullName, email, password, membership, status }
PUT /members/:id
Headers: Authorization: Bearer <token>
Body: { fullName, email, membership, status }
DELETE /members/:id
Headers: Authorization: Bearer <token>
GET /classes?status=Scheduled&upcoming=true
Headers: Authorization: Bearer <token>
POST /classes
Headers: Authorization: Bearer <token>
Body: { name, instructor, dateTime, status, capacity, description }
PUT /classes/:id
Headers: Authorization: Bearer <token>
Body: { name, instructor, dateTime, status, capacity, description }
DELETE /classes/:id
Headers: Authorization: Bearer <token>
GET /student/classes?upcoming=true
Headers: Authorization: Bearer <token>
POST /student/classes/:id/enroll
Headers: Authorization: Bearer <token>
GET /student/payments
Headers: Authorization: Bearer <token>
POST /student/payments
Headers: Authorization: Bearer <token>
Body: { amount, paymentMethod, description }
GET /student/dashboard
Headers: Authorization: Bearer <token>
Response: { enrolledClasses, totalSpent, upcomingClass }
GET /dashboard
Headers: Authorization: Bearer <token>
Response: { totalMembers, activeClasses, totalTrainers, memberGrowth, classAttendance }
- Admin: Full access to all admin features and management endpoints
- Member/Student: Limited access to student routes and personal features only
Tokens are stored in localStorage on the client side. Include the token in the Authorization header for protected routes:
Authorization: Bearer <your-jwt-token>- React 18 - UI library
- Vite - Build tool and dev server
- Tailwind CSS - Utility-first CSS framework
- Lucide React - Icon library
- Axios/Fetch API - HTTP client
- Express.js - Web framework
- MongoDB - NoSQL database
- Mongoose - ODM for MongoDB
- JWT - Authentication
- bcryptjs - Password hashing
- CORS - Cross-origin resource sharing
{
fullName: String,
email: String (unique),
password: String (hashed),
role: String ('admin' | 'member'),
membership: String ('Basic' | 'Premium' | 'VIP'),
isActive: Boolean,
lastLogin: Date,
createdAt: Date,
updatedAt: Date
}{
name: String,
instructor: String,
dateTime: Date,
status: String ('Scheduled' | 'Ongoing' | 'Completed' | 'Cancelled'),
capacity: Number,
enrolledMembers: [ObjectId],
description: String,
trainerId: ObjectId,
createdAt: Date,
updatedAt: Date
}{
memberId: ObjectId,
memberName: String,
classId: ObjectId,
className: String,
amount: Number,
paymentMethod: String,
status: String ('Paid' | 'Pending' | 'Failed'),
description: String,
createdAt: Date,
updatedAt: Date
}- Login with admin credentials
- View dashboard with statistics
- Manage members (add, edit, delete)
- Schedule classes and assign trainers
- Track payments and revenue
- Monitor member growth and class attendance
- Register or login with credentials
- View personal dashboard
- Browse available classes
- Enroll in classes of interest
- View upcoming classes
- Track fitness progress
- Make payments for memberships
- View payment history
- Title: Design and Implementation of an Online Gym Management System
- Objective: Create a comprehensive digital solution for gym administration and member management
- Scope: Full-stack web application with separate admin and member portals
-
Payment Processing
- Uses local mock payment processing
- No real payment gateway integration (Stripe, Paystack, etc.)
- Basic payment validation
-
Email Notifications
- Email service not fully implemented
- No automated password reset emails
- No class reminder notifications
-
Data Management
- No backup and disaster recovery system
- Limited data retention policies
- No comprehensive audit logging
-
Scalability
- Database queries not optimized for large datasets
- No caching mechanism (Redis)
- API rate limiting not implemented
-
Real-time Features
- No WebSocket support
- No live notifications
- Class updates not pushed in real-time
-
Analytics & Reporting
- Limited reporting capabilities
- No advanced analytics dashboard
- Basic statistics only
-
File Handling
- No profile picture upload
- Class images hardcoded
- No image optimization
-
Testing
- No automated unit tests
- No integration tests
- Limited error scenario coverage
-
Documentation
- No Swagger/OpenAPI documentation
- Minimal code comments
-
Performance
- No request caching
- Database queries not indexed
- Large dataset handling may be slow
- Integration with real payment gateways (Stripe, Paystack)
- Email notifications with Nodemailer/SendGrid
- Real-time features using WebSockets
- Advanced analytics and reporting dashboard
- Profile picture and document uploads
- Comprehensive unit and integration testing
- Swagger/OpenAPI documentation
- Database optimization and indexing
- Caching strategies implementation
- Comprehensive logging and monitoring
PORT=5000
MONGO_URI=mongodb://localhost:27017/gym-management
JWT_SECRET=your-secret-key
NODE_ENV=developmentVITE_API_URL=http://localhost:5000/apiCurrently, the project lacks automated tests. To run manual testing:
- Backend: Use Postman or Insomnia for API testing
- Frontend: Test through browser dev tools
- Integration: Test workflows end-to-end
- Jest (unit testing)
- React Testing Library (component testing)
- Supertest (API testing)
- Cypress (E2E testing)
For detailed information:
- See
/backend/README.mdfor backend API documentation - See
/frontend/README.mdfor frontend setup details - Check code comments and structure for implementation details
This project is created for educational purposes as part of a final year school project.
Project Title: Design and Implementation of an Online Gym Management System
- Project Type: Final Year School Project
- Development Period: 2024
- Stack: MERN (MongoDB, Express, React, Node.js)
- Status: Complete and functional
Last Updated: 2024