Skip to content

A web-based fitness tracker that lets users log workouts, track progress, and visualize performance over time. Created in CMPS285

License

Notifications You must be signed in to change notification settings

jackson-eason/GymLab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GymLab

A full-stack web application for gym and fitness management, built with ASP.NET Core and React. GymLab provides a comprehensive platform for tracking workouts, managing gym memberships, purchasing fitness products, and connecting with other fitness enthusiasts.

πŸš€ Features

User Management

  • User authentication and authorization with ASP.NET Identity
  • User profiles with personal information (height, weight, date of birth)
  • User-to-user following system
  • Personal gym streak tracking

Gym & Check-ins

  • Gym listing and management
  • Gym tags and categorization (Family, Chain, Athletic, Crossfit)
  • User check-in system to track gym visits
  • Gym operating hours display

Workouts

  • Create and track personal workouts
  • Workout logging with photos
  • Time spent in gym tracking
  • Share workouts with other users
  • Workout descriptions and naming

Achievements

  • Achievement system for fitness goals
  • Track achievements like "Bench press one plate", "Squat two plates", "Do pull-ups"
  • Upload photos of achievement completion
  • User achievement history

Coaching Plans

  • Predefined coaching plans for different fitness goals
  • Skill level requirements (Beginner, Intermediate, Advanced)
  • Goal type categorization (Build Muscle, Lose Fat, Improve Endurance)
  • Users can subscribe to coaching plans

Products & E-commerce

  • Product catalog (supplements, equipment, apparel)
  • Product photos
  • Product ratings and reviews
  • Shopping cart and order management
  • Product filtering by gym

Gym Events

  • Event creation and management
  • Event descriptions and dates
  • Events linked to specific gyms

πŸ› οΈ Technology Stack

Backend

  • Framework: ASP.NET Core 6.0
  • Database: SQL Server with Entity Framework Core 6.0
  • Authentication: ASP.NET Identity with Cookie Authentication
  • API Documentation: Swagger/OpenAPI
  • Key Libraries:
    • IdentityModel 6.0.0
    • Entity Framework Core 6.0.9
    • Swashbuckle.AspNetCore 6.4.0

Frontend

  • Framework: React 18.2.0 with TypeScript 4.9.4
  • UI Library: Mantine 5.9.2 (with hooks, forms, dates, modals, notifications)
  • Routing: React Router DOM 6.4.5
  • HTTP Client: Axios 1.2.3
  • Icons: Font Awesome 6.2.1
  • Date Handling: Day.js 1.11.7
  • Styling: Emotion React 11.10.5

πŸ“‹ Prerequisites

πŸ”§ Installation & Setup

1. Clone the Repository

git clone <repository-url>
cd GymLab

2. Configure Database Connection

Update the connection string in Web/LearningStarter/appsettings.json:

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=localhost;Database=Project-Starter-285-GroupNumber;Trusted_Connection=True"
  }
}

3. Install Backend Dependencies

cd Web/LearningStarter
dotnet restore

4. Install Frontend Dependencies

cd Web/LearningStarter/learning-starter-web
yarn install
# or
npm install

πŸš€ Running the Application

Quick Start (Windows)

Use the provided batch script to start both backend and frontend:

runProject.cmd

Note: Edit runProject.cmd to update the paths to match your project location.

Manual Start

Option 1: Run Backend and Frontend Separately

Backend (Terminal 1):

cd Web/LearningStarter
dotnet run

Frontend (Terminal 2):

cd Web/LearningStarter/learning-starter-web
yarn start

Option 2: Run with Windows Terminal

wt -d <your-path>\Web\LearningStarter dotnet run
wt -d <your-path>\Web\LearningStarter\learning-starter-web yarn start

Access the Application

πŸ—„οΈ Database

Database Initialization

The application uses Entity Framework Code-First approach. On startup, the database will be:

  1. Dropped (if exists)
  2. Recreated with the latest schema
  3. Seeded with sample data

⚠️ Warning: The EnsureDeleted() in Startup.cs (line 112) will drop the database on each run. Remove this in production!

Sample Data

The application seeds the following test data:

  • Users: Admin, Stephen, Ethan, Jackson, Geoffrey
  • Gyms: Planet Fitness, Crossfit Hammond, Downtown Fitness, North Cypress Fitness
  • Products: T-Shirts, Pre-workout, Protein Powder, Gym Equipment
  • Achievements: Various strength and fitness goals
  • Coaching Plans: Different fitness programs
  • Workouts: Sample workout sessions
  • Gym Events: Sample events at various gyms

Default Login Credentials

Username: admin
Password: Password

Additional test users:

  • Username: W | Password: Password123 (Stephen)
  • Username: BigMan20 | Password: PasswordHash (Ethan)
  • Username: JackedDude65 | Password: ThisPassword123 (Jackson)
  • Username: THEMathGuy | Password: Passwords (Geoffrey)

πŸ“ Project Structure

GymLab/
β”œβ”€β”€ Web/
β”‚   β”œβ”€β”€ LearningStarter/               # Backend (ASP.NET Core)
β”‚   β”‚   β”œβ”€β”€ Controllers/              # API Controllers
β”‚   β”‚   β”œβ”€β”€ Entities/                 # Database Models
β”‚   β”‚   β”œβ”€β”€ Data/                     # DbContext
β”‚   β”‚   β”œβ”€β”€ Services/                 # Business Logic
β”‚   β”‚   β”œβ”€β”€ Common/                   # Shared Utilities
β”‚   β”‚   β”œβ”€β”€ learning-starter-web/    # Frontend (React)
β”‚   β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ components/      # React Components
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ pages/           # Page Components
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ routes/          # Route Configuration
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ authentication/  # Auth Logic
β”‚   β”‚   β”‚   β”‚   └── config/          # App Configuration
β”‚   β”‚   β”‚   └── public/              # Static Assets
β”‚   β”‚   β”œβ”€β”€ Program.cs               # Application Entry Point
β”‚   β”‚   β”œβ”€β”€ Startup.cs               # App Configuration & Seeding
β”‚   β”‚   └── appsettings.json         # Configuration Settings
β”‚   └── LearningStarter.sln          # Solution File
└── runProject.cmd                    # Quick Start Script

🎨 Key Features Implementation

API Endpoints

The application provides RESTful APIs for:

  • /api/users - User management
  • /api/gyms - Gym CRUD operations
  • /api/gym-events - Gym events
  • /api/workouts - Workout tracking
  • /api/products - Product catalog
  • /api/coaching-plans - Coaching programs
  • /api/achievements - Achievement system
  • /api/user-check-ins - Check-in tracking
  • /api/authentication - Login/Logout

Frontend Routes

  • /user - User profile page
  • /gyms - Gym listing and management
  • /gym-events - Event listing
  • /products - Product catalog
  • /workouts - Workout management
  • /coaching-plans - Coaching plan listing
  • /tags - Tag management

πŸ” Authentication

The application uses cookie-based authentication with ASP.NET Identity. Users must be authenticated to access most features. Password requirements are configured in Startup.cs:

  • Minimum length: 8 characters
  • No uppercase requirement
  • No lowercase requirement
  • No digit requirement
  • No special character requirement

Note: These are lenient settings for development. Strengthen them for production.

🌐 CORS Configuration

CORS is configured to allow all origins, methods, and headers (see Startup.cs line 124). Restrict this in production environments.

πŸ“ Development Notes

Database Migrations

To create a new migration:

cd Web/LearningStarter
dotnet ef migrations add MigrationName

To update the database:

dotnet ef database update

Frontend Development

The React app runs on port 3001 and proxies API requests to the backend on port 5001 (configured in Startup.cs).

Building for Production

Frontend:

cd Web/LearningStarter/learning-starter-web
yarn build

The production build will be placed in the build folder and served by the ASP.NET Core application.

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the terms specified in the LICENSE file.

πŸ› Known Issues

  • Database is dropped on each application start (remove EnsureDeleted() for persistence)
  • CORS is wide open for all origins (restrict in production)
  • Password requirements are minimal (strengthen for production)

πŸ“§ Support

For issues, questions, or contributions, please open an issue in the repository.


Built with ❀️ by the GymLab Team

About

A web-based fitness tracker that lets users log workouts, track progress, and visualize performance over time. Created in CMPS285

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6

Languages