Skip to content

๐Ÿ“ˆ PeakLog is a lightweight athlete performance and training tracker for coaches and teams. Built with React, Firebase, and TailwindCSS โ€” optimized for real-world use in endurance and watersports teams.

Notifications You must be signed in to change notification settings

alexlibe95/PeakLog

Repository files navigation

๐Ÿ”๏ธ PeakLog

PeakLog Icon

A comprehensive training management and performance tracking platform designed for sports teams and coaches. Built for endurance sports like canoe/kayak, rowing, swimming, and running, with advanced features for athlete management, training scheduling, performance testing, and progress tracking!

๐ŸŒ Live Demo: https://peaklog-a10b4.web.app

๐Ÿ› ๏ธ Tech Stack

  • Frontend: React 18 + Vite 7
  • UI Framework: ShadCN UI + TailwindCSS v4
  • Backend: Firebase (Auth + Firestore + Analytics)
  • Authentication: Firebase Auth (Email/Password + Passwordless Magic Links)
  • Database: Cloud Firestore
  • Routing: React Router DOM v6
  • Form Handling: React Hook Form
  • Icons: Lucide React
  • Code Quality: ESLint + Prettier
  • Deployment: Netlify

โœจ Features

๐Ÿ” Authentication & Security

  • ๐Ÿช„ Passwordless Magic Link Login - Secure, password-free authentication via email links
  • ๐Ÿ”‘ Traditional Email/Password - Classic login option available
  • ๐Ÿ‘ฅ Multi-Level Role-Based Access Control - Super Admin, Club Admin, and Athlete permissions
  • ๐Ÿ›ก๏ธ Firebase Security Rules - Comprehensive server-side data protection
  • ๐Ÿ”’ Environment Variable Protection - Secure API key management

๐Ÿ“… Training Scheduling & Management

  • ๐Ÿ“† Interactive Training Calendar - Monthly calendar view with attendance tracking
  • ๐Ÿ–๏ธ Vacation & Cancellation Management - Pre-schedule training cancellations with reasons
  • โฐ Weekly Schedule Management - Set recurring training days and times
  • ๐Ÿ“ฑ Quick Attendance - One-click attendance marking for coaches
  • ๐Ÿ“Š Training History - Complete log of past training sessions and attendance

๐Ÿ† Performance Testing & Tracking

  • ๐Ÿ“ Test Limits System - Record athlete performance peaks for specific training days
  • ๐Ÿ“Š Performance Categories - Manage custom categories (Bench Press, 1000m Time, etc.)
  • ๐Ÿ“ˆ Progress Charts - Visual progress tracking with line graphs for each category
  • ๐ŸŽฏ Goal Integration - Automatic goal updates based on test performance
  • ๐Ÿ… Personal Best Tracking - Automatic PB updates from test results

๐Ÿ‘ฅ Athlete Management

  • ๐Ÿ‘ค Member Management - Add, remove, and manage club members
  • ๐Ÿ“‹ Personal Records & Goals - Track individual athlete performance and objectives
  • ๐Ÿ“ฑ Mobile-Optimized Views - Responsive card layouts for mobile devices
  • ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Family Accounts - Multiple athletes per account support
  • ๐Ÿ“Š Performance Analytics - Individual athlete progress tracking

๐Ÿ’ฌ Communication & Messaging

  • ๐Ÿ“ข Club Announcements - Coaches can post messages visible to all athletes
  • ๐Ÿ  Dashboard Integration - Messages displayed on athlete dashboard
  • ๐Ÿ“… Training Notifications - Cancelled training alerts with reasons
  • โฐ Today's Training Status - Real-time training state (upcoming/in-progress/completed)

๐ŸŽจ User Experience

  • ๐ŸŒŸ Modern UI - Beautiful, responsive design with ShadCN components
  • ๐Ÿ“ฑ Mobile-First - Optimized for all device sizes and screen orientations
  • โšก Fast Performance - Vite-powered development and optimized builds
  • ๐Ÿ”„ Real-time Updates - Live data synchronization with Firestore
  • ๐ŸŽญ Professional Design - Clean, intuitive interface for athletes and coaches
  • ๐ŸŒ“ Dark/Light Theme Ready - Extensible theming system

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 20+
  • Firebase project with Authentication and Firestore enabled
  • Git

1. Clone and Install

git clone https://github.com/alexlibe95/PeakLog.git
cd PeakLog
npm install

2. Firebase Setup

  1. Create a new Firebase project at Firebase Console
  2. Enable Authentication:
    • Go to Authentication โ†’ Sign-in method
    • Enable "Email/Password" provider
    • Enable "Email link (passwordless sign-in)"
    • Add your domain to authorized domains (localhost, your-domain.com)
  3. Create Firestore Database:
    • Go to Firestore Database โ†’ Create database
    • Start in test mode (we'll add security rules later)
  4. Copy your Firebase config from Project Settings โ†’ General โ†’ Your apps

3. Environment Configuration

cp .env.example .env

Edit .env with your Firebase configuration:

VITE_FIREBASE_API_KEY=your_api_key_here
VITE_FIREBASE_AUTH_DOMAIN=your-project-id.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your-project-id
VITE_FIREBASE_STORAGE_BUCKET=your-project-id.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your_messaging_sender_id
VITE_FIREBASE_APP_ID=your_app_id
VITE_FIREBASE_MEASUREMENT_ID=your_measurement_id

4. Firestore Security Rules

Copy the contents of firestore.rules to your Firebase Console > Firestore Database > Rules:

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    // Users can read/write their own user document
    match /users/{userId} {
      allow read, write: if request.auth != null && request.auth.uid == userId;
      allow read: if request.auth != null && 
        exists(/databases/$(database)/documents/users/$(request.auth.uid)) &&
        get(/databases/$(database)/documents/users/$(request.auth.uid)).data.role == 'admin';
    }
  }
}

5. Run Development Server

npm run dev

Visit http://localhost:5180 to see the app!

๐Ÿ“ Project Structure

src/
โ”œโ”€โ”€ components/          # Reusable UI components
โ”‚   โ”œโ”€โ”€ ui/             # ShadCN UI components (Button, Input, Card, etc.)
โ”‚   โ”œโ”€โ”€ features/       # Feature-specific components (Goals, Records, etc.)
โ”‚   โ”œโ”€โ”€ Navigation.jsx  # Global navigation with responsive burger menu
โ”‚   โ”œโ”€โ”€ PasswordlessLogin.jsx  # Magic link authentication
โ”‚   โ”œโ”€โ”€ ProtectedRoute.jsx     # Route protection wrapper
โ”‚   โ”œโ”€โ”€ TrainingCalendar.jsx   # Interactive monthly training calendar
โ”‚   โ”œโ”€โ”€ VacationManager.jsx    # Training cancellation management
โ”‚   โ”œโ”€โ”€ AdminMessageManager.jsx # Club announcement system
โ”‚   โ””โ”€โ”€ icons/          # Custom SVG icon components
โ”œโ”€โ”€ pages/              # Route components
โ”‚   โ”œโ”€โ”€ Dashboard.jsx   # Main dashboard with role-based views
โ”‚   โ”œโ”€โ”€ Training.jsx    # Athlete training interface
โ”‚   โ”œโ”€โ”€ TrainingLogs.jsx # Training history and logging
โ”‚   โ”œโ”€โ”€ TrainingManagement.jsx # Admin training management
โ”‚   โ”œโ”€โ”€ AthleteManagement.jsx # Athlete performance management
โ”‚   โ”œโ”€โ”€ CategoryManagement.jsx # Performance category management
โ”‚   โ”œโ”€โ”€ Testing.jsx     # Performance testing interface
โ”‚   โ”œโ”€โ”€ MyProgress.jsx  # Athlete progress charts
โ”‚   โ”œโ”€โ”€ Login.jsx       # Authentication page
โ”‚   โ”œโ”€โ”€ Register.jsx    # User registration
โ”‚   โ”œโ”€โ”€ Settings.jsx    # User profile and settings
โ”‚   โ”œโ”€โ”€ AuthCallback.jsx # Email link verification handler
โ”‚   โ””โ”€โ”€ SuperAdminPage.jsx # Super admin dashboard
โ”œโ”€โ”€ context/            # React context providers
โ”‚   โ””โ”€โ”€ AuthContext.jsx # Authentication and user state management
โ”œโ”€โ”€ services/           # API and data services
โ”‚   โ”œโ”€โ”€ clubService.js          # Club and member management
โ”‚   โ”œโ”€โ”€ trainingService.js      # Training data operations
โ”‚   โ”œโ”€โ”€ athletePerformanceService.js # Performance tracking
โ”‚   โ”œโ”€โ”€ performanceCategoryService.js # Category management
โ”‚   โ””โ”€โ”€ testService.js          # Performance testing operations
โ”œโ”€โ”€ lib/                # Configuration and utilities
โ”‚   โ”œโ”€โ”€ firebase.js     # Firebase initialization
โ”‚   โ””โ”€โ”€ utils.js        # Utility functions
โ”œโ”€โ”€ hooks/              # Custom React hooks
โ””โ”€โ”€ styles/             # Global styles
    โ””โ”€โ”€ index.css       # TailwindCSS + custom styles

๐Ÿ”ง Available Scripts

# Development
npm run dev          # Start development server (localhost:5180)
npm run build        # Build for production
npm run preview      # Preview production build

# Code Quality
npm run lint         # Run ESLint
npm run lint:fix     # Fix ESLint errors
npm run format       # Format code with Prettier
npm run format:check # Check code formatting
npm run type-check   # TypeScript type checking

๐ŸŽฏ User Roles

๐Ÿ‘ค Athlete

  • ๐Ÿ“Š Dashboard Access - Personal dashboard with training status and messages
  • ๐Ÿ“ Training Logging - Log training sessions with type, duration, and notes
  • ๐Ÿ† Personal Records - Track PRs and view performance history
  • ๐ŸŽฏ Goal Management - Set and track personal performance goals
  • ๐Ÿ“ˆ Progress Charts - View performance trends with interactive charts
  • ๐Ÿ“… Attendance Tracking - View training attendance and schedule
  • ๐Ÿ’ฌ Message Center - Receive coach announcements and updates

๐Ÿ‘จโ€๐Ÿซ Club Admin (Coach)

  • ๐Ÿ‘ฅ Member Management - Add/remove athletes, manage club membership
  • ๐Ÿ“… Training Calendar - Interactive calendar with attendance management
  • ๐Ÿ–๏ธ Vacation Planning - Schedule training cancellations with reasons
  • โฐ Schedule Management - Set weekly training schedules
  • ๐Ÿ“Š Performance Testing - Record athlete test results and manage categories
  • ๐Ÿ“‹ Athlete Oversight - View all athlete data, records, and goals
  • ๐Ÿ“ข Communication - Post messages and announcements for athletes
  • ๐Ÿ“ˆ Team Analytics - Monitor team performance and attendance trends

๐Ÿ‘‘ Super Admin

  • ๐Ÿข Multi-Club Management - Access and manage multiple clubs
  • ๐Ÿ‘ค User Administration - Manage user roles and permissions across clubs
  • ๐Ÿ“Š System Analytics - View system-wide statistics and usage data
  • โš™๏ธ System Configuration - Configure system settings and defaults
  • ๐Ÿ”ง Administrative Tools - Advanced system management features

๐Ÿ” Security

  • Role-based access control
  • Firestore security rules
  • Environment variable protection
  • Firebase Authentication

๐ŸŽฎ Authentication Demo

Magic Link Login

  1. Visit the login page
  2. Click "Sign in with Magic Link" (recommended)
  3. Enter your email address
  4. Check your email and click the magic link
  5. Automatically signed in - no password required!

Traditional Login

  • Standard email/password authentication also available
  • Registration page with sport selection and user details

๐Ÿ”ง Development Guidelines

Code Standards

  1. Code Style: Follow existing patterns and ESLint/Prettier rules
  2. Components: Use functional components with hooks
  3. Styling: Use ShadCN UI components + TailwindCSS classes (no inline styles)
  4. Architecture: Keep components small, reusable, and well-documented
  5. Security: Follow Firebase security best practices
  6. Testing: Test both authentication methods before commits

Development Workflow

git checkout -b feature/your-feature
npm run lint:fix && npm run format
npm run build  # Test production build
git commit -m "feat: your feature description"
git push origin feature/your-feature

Development Best Practices

  • ๐Ÿ”ง Pre-commit Hooks - Run lint and format before committing
  • ๐Ÿ“ฑ Mobile Testing - Test all features on mobile devices
  • ๐ŸŽฏ Feature Flags - Use feature flags for gradual rollouts
  • ๐Ÿ“Š Performance Monitoring - Monitor bundle size and loading times
  • ๐Ÿงช Error Handling - Implement comprehensive error boundaries
  • โ™ฟ Accessibility - Ensure WCAG compliance for all components
  • ๐Ÿ”’ Security First - Follow Firebase security best practices

๐Ÿ“‹ Roadmap

๐ŸŽฏ Core Features (Implemented)

  • Multi-Level Authentication - Magic link + traditional login with Super Admin/Admin/Athlete roles
  • Interactive Training Calendar - Monthly calendar with attendance tracking and vacation management
  • Performance Testing System - Test limits recording with automatic PB/goal updates
  • Progress Visualization - Interactive charts with Recharts library
  • Communication System - Club announcements and training notifications
  • Mobile-Responsive Design - Optimized for all device sizes
  • Real-time Data Sync - Live updates with Firestore
  • Comprehensive Athlete Management - Records, goals, and performance tracking
  • Category Management - Custom performance categories with unit handling
  • Training Scheduling - Weekly schedules with cancellation support

๐Ÿš€ Future Enhancements

  • Advanced Analytics Dashboard - Team performance trends and comparative analysis
  • Data Export/Import - CSV/PDF export and bulk data operations
  • Mobile App - React Native companion app for iOS/Android
  • Training Plan Templates - Pre-built workout programs and progression plans
  • Team Communication - Direct messaging between coaches and athletes
  • Offline Support - PWA capabilities for offline training logging
  • Integration APIs - Connect with fitness devices and external systems
  • Advanced Reporting - Custom reports and performance insights
  • Team Challenges - Create and track team-wide performance challenges
  • Nutrition Tracking - Dietary logging and nutrition goal setting

๐Ÿ› ๏ธ Technical Highlights

Modern React Patterns

  • Context API for global state management with multi-role authentication
  • Custom Hooks for reusable logic across components
  • Component Composition with ShadCN UI component library
  • TypeScript-Ready architecture with type-safe patterns
  • Responsive Design with mobile-first approach and TailwindCSS

Advanced UI/UX Features

  • Interactive Calendar - Custom calendar component with date manipulation
  • Data Visualization - Recharts integration for performance tracking
  • Real-time Messaging - Live communication between coaches and athletes
  • Role-Based UI - Dynamic interfaces based on user permissions
  • Progressive Web App Ready - Service worker and offline capabilities

Firebase Integration

  • Firebase v9+ SDK - Latest modular Firebase implementation
  • Real-time Data - Live updates with Firestore subscriptions
  • Advanced Security Rules - Multi-level access control for clubs and users
  • Cloud Storage - Profile picture uploads with automatic cleanup
  • Batch Operations - Efficient data operations with Firestore batches

Performance Optimizations

  • Vite Build Tool - Lightning-fast development and optimized production builds
  • Code Splitting - Automatic chunking for faster loading times
  • Tree Shaking - Minimal bundle size with unused code elimination
  • Optimized Builds - Fast loading with Vite build optimization
  • Image Optimization - Efficient image handling and lazy loading

Developer Experience

  • Hot Module Replacement - Instant development feedback
  • ESLint + Prettier - Automated code quality and formatting
  • Version Control - Git-based development workflow
  • Environment Management - Secure credential handling with Vite
  • Comprehensive Error Handling - Robust error boundaries and user feedback

๐Ÿ—๏ธ Architecture Overview

Key Components

  • ๐Ÿ”„ AuthContext - Centralized authentication state with role management
  • ๐Ÿ“… TrainingCalendar - Interactive calendar with attendance and scheduling
  • ๐Ÿ“Š MyProgress - Athlete progress visualization with Recharts
  • ๐Ÿงช Testing System - Performance testing with automatic PB updates
  • ๐Ÿ’ฌ MessageManager - Real-time communication system
  • ๐Ÿ“ฑ Responsive Navigation - Mobile-first navigation with role-based menus

Data Flow Patterns

  • Real-time Subscriptions - Firestore listeners for live data updates
  • Optimistic Updates - Immediate UI feedback with server sync
  • Batch Operations - Efficient bulk data operations
  • Error Boundaries - Graceful error handling and user feedback
  • Loading States - Comprehensive loading indicators and skeleton screens

Security Architecture

  • Role-Based Access Control - Multi-level permissions (Super Admin โ†’ Admin โ†’ Athlete)
  • Firestore Security Rules - Server-side data validation and access control
  • Input Validation - Client and server-side validation
  • Secure File Uploads - Safe profile picture handling with cleanup
  • Environment Security - Protected API keys and configuration

๐Ÿ“„ License

This is a private portfolio project. All rights reserved.


๐Ÿ”๏ธ Built with โค๏ธ for the sports community

๐Ÿ’ก Showcasing modern web development practices with React, Firebase, and comprehensive training management features

About

๐Ÿ“ˆ PeakLog is a lightweight athlete performance and training tracker for coaches and teams. Built with React, Firebase, and TailwindCSS โ€” optimized for real-world use in endurance and watersports teams.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages