A comprehensive database system for managing fitness clubs, including members, trainers, memberships, workout schedules, and attendance tracking. This project includes a complete MySQL database schema and a RESTful API built with Node.js and Express.
- Member Management: Track member information, contact details, and emergency contacts
- Trainer Management: Manage trainer profiles, specializations, and certifications
- Club Management: Handle multiple fitness club locations
- Membership System: Support for different membership tiers (Basic, Premium, VIP)
- Workout Scheduling: Create and manage workout schedules across different clubs
- Attendance Tracking: Monitor member participation in scheduled workouts
- RESTful API: Complete API for all database operations
The database includes the following tables:
- clubs - Fitness club locations and information
- members - Club members/participants
- trainers - Fitness trainers and their qualifications
- memberships - Member subscriptions and status
- workout_types - Catalog of available workout classes
- workout_schedule - Scheduled workout sessions
- attendance - Member attendance records
For detailed information about each table, see SHORT.md.
- MySQL 5.7+
- Node.js 14+
- npm
- Clone the repository
git clone <repository-url>
cd 222- Install dependencies
npm install- Set up the database
mysql -u root -p
CREATE DATABASE fitness_club_db;
exit
mysql -u root -p fitness_club_db < schema.sql- Configure environment
cp .env.example .env
# Edit .env with your database credentials- Start the API server
npm startThe API will be available at http://localhost:3000
For detailed setup instructions, see SETUP.md.
GET /api/members- Get all membersGET /api/members/:id- Get specific memberPOST /api/members- Create new memberPUT /api/members/:id- Update memberDELETE /api/members/:id- Delete member
GET /api/trainers- Get all trainersGET /api/trainers/:id- Get specific trainerGET /api/trainers/:id/schedule- Get trainer's schedule
GET /api/clubs- Get all clubsGET /api/clubs/:id/trainers- Get club's trainersGET /api/clubs/:id/members- Get club's members
GET /api/memberships- Get all membershipsGET /api/memberships/active- Get active membershipsPOST /api/memberships- Create new membership
GET /api/workouts/types- Get workout typesGET /api/workouts/schedule- Get workout scheduleGET /api/workouts/schedule/upcoming- Get upcoming workoutsPOST /api/workouts/schedule- Create workout session
GET /api/attendance- Get all attendance recordsPOST /api/attendance- Record attendance (check-in)DELETE /api/attendance/:id- Cancel check-in
clubs (1) ────┐
├──> (N) trainers
├──> (N) memberships <──── (1) members
└──> (N) workout_schedule
│
├──> (1) workout_types
├──> (1) trainers
└──> (N) attendance <──── (1) members
The database comes pre-loaded with sample data:
- 3 fitness clubs in different locations
- 5 members with complete profiles
- 4 trainers with various specializations
- 5 memberships (active and expired)
- 6 workout types (HIIT, Yoga, CrossFit, etc.)
- 6 scheduled workouts
- 9 attendance records
# Get all members
curl http://localhost:3000/api/members
# Get upcoming workouts
curl http://localhost:3000/api/workouts/schedule/upcoming
# Create a new member
curl -X POST http://localhost:3000/api/members \
-H "Content-Type: application/json" \
-d '{
"first_name": "Jane",
"last_name": "Doe",
"email": "jane@example.com",
"registration_date": "2024-11-10"
}'Navigate to http://localhost:3000 to see the API documentation and available endpoints.
- SETUP.md - Detailed setup and installation guide
- SHORT.md - Database table descriptions
- schema.sql - Complete database schema with sample data
- Database: MySQL
- Backend: Node.js, Express.js
- Database Driver: mysql2
- Middleware: CORS, dotenv
This database system can be used for:
- Fitness Club Management: Manage multiple club locations
- Member Registration: Track member information and memberships
- Class Scheduling: Schedule and manage workout classes
- Attendance Tracking: Monitor member participation
- Trainer Assignment: Assign trainers to specific classes
- Membership Billing: Track membership types and expiration dates
- Never commit the
.envfile to version control - Use strong passwords for database access
- In production, implement proper authentication and authorization
- Validate all user inputs
- Use HTTPS in production environments
This is a template/example project for fitness club database management. Feel free to fork and modify it for your specific needs.
MIT
Documentation is available in English.
Built with ❤️ for fitness club management