Skip to content

Frontend application for gym management with facial recognition check-in, member management, subscriptions, payments, and analytics. Built with React, TypeScript, and Vite.

License

Notifications You must be signed in to change notification settings

SanAfaGal/powergym-front

Repository files navigation

πŸ’ͺ PowerGym - Gym Management System

PowerGym Logo React TypeScript Vite License

Complete gym management system with facial recognition, member management, subscriptions, payments, and real-time analytics.

Features β€’ Tech Stack β€’ Installation β€’ Usage β€’ Structure


✨ Features

🎯 Complete Member Management

  • πŸ“ Full client registration with advanced validation
  • πŸ‘€ Detailed profiles with biometric information
  • πŸ” Facial recognition for quick and secure check-in
  • πŸ“Š Complete membership and subscription history
  • πŸ“± Contact and payment method management

πŸ’³ Subscriptions & Payments

  • πŸ“… Flexible membership plan management
  • πŸ”„ Automatic subscription renewal
  • πŸ’° Partial and full payment tracking
  • πŸ“ˆ Debt and payment status monitoring
  • 🎁 Attendance-based rewards system
  • πŸ“„ Complete transaction history

🎫 Attendance Control

  • πŸ€– Facial recognition check-in in real-time
  • πŸ“Š Detailed attendance reports by hour, day, and week
  • πŸ“ˆ Frequency and attendance pattern analytics
  • ⏰ Automatic entry and exit logging
  • 🚫 Access control based on subscription status

πŸ“¦ Inventory Management

  • 🏷️ Complete product and stock control
  • πŸ“Š Automatic low stock and overstock alerts
  • πŸ“ Entry and exit movement logging
  • πŸ’° Daily sales reports by employee
  • πŸ“ˆ Inventory analysis and valuation

πŸ“Š Dashboard & Analytics

  • πŸ“ˆ Real-time business metrics
  • πŸ’° Financial analysis and revenue reports
  • πŸ‘₯ Membership statistics and new client tracking
  • πŸ“… Attendance analysis by periods
  • 🎯 Customizable and exportable KPIs

🎨 User Experience

  • 🎨 Modern and responsive design with Tailwind CSS
  • ✨ Smooth animations with Framer Motion
  • πŸ“± Mobile and tablet optimized interface
  • ⚑ Performance optimized with lazy loading
  • πŸŒ™ Dark mode ready (coming soon)

πŸ› οΈ Tech Stack

Frontend

  • React 18.3 - Modern UI library
  • TypeScript 5.9 - Static typing
  • Vite 7.1 - Ultra-fast build tool
  • Tailwind CSS 3.4 - Utility-first styling
  • Framer Motion 12 - Advanced animations

State & Data

  • TanStack Query 5.9 - Server state management
  • React Query Persist - Cache persistence
  • React Hook Form 7.6 - Performant forms
  • Zod 4.1 - Schema validation

Routing & Navigation

  • React Router 6.3 - Declarative navigation
  • Protected Routes - Authentication and authorization

UI Components

  • Lucide React - Modern and consistent icons
  • Custom components - Own UI component library

Testing

  • Vitest 4.0 - Fast testing framework
  • React Testing Library - Component testing
  • JSDOM - Testing environment

Development Tools

  • ESLint 9 - Code linting
  • TypeScript ESLint - TypeScript rules
  • PostCSS - CSS processing

πŸ“‹ Prerequisites

  • Node.js >= 18.0.0
  • npm >= 9.0.0 (or yarn/pnpm)
  • Git to clone the repository

πŸš€ Installation

1. Clone the repository

git clone <repository-url>
cd frontend

2. Install dependencies

npm install

3. Configure environment variables

Create a .env file in the project root:

# API Configuration
VITE_API_BASE_URL=http://localhost:8000/api/v1

# Authentication
VITE_DISABLE_AUTH=false

# Development
VITE_USE_MOCK_API=true  # Use mock API in development

4. Start development server

npm run dev

The application will be available at http://localhost:5173


πŸ“– Usage

Available Scripts

# Development
npm run dev              # Start development server with hot reload

# Build
npm run build            # Create production build
npm run preview          # Preview production build

# Testing
npm run test             # Run tests once
npm run test:watch       # Run tests in watch mode
npm run test:coverage    # Generate coverage report
npm run test:ui          # Open Vitest UI (auto port)
npm run test:ui:port     # Open Vitest UI on port 3001

# Code Quality
npm run lint             # Run ESLint
npm run typecheck        # Verify TypeScript types

Application Access

  1. Landing Page: / - Landing page with system information
  2. Login: /login - User authentication
  3. Dashboard: /dashboard - Main panel (requires authentication)
  4. Clients: /dashboard#clients - Member management
  5. Attendances: /dashboard#attendances - Attendance control
  6. Inventory: /dashboard#inventory - Product management

πŸ“ Project Structure

frontend/
β”œβ”€β”€ public/                 # Static files
β”‚   β”œβ”€β”€ favicon.svg
β”‚   └── logo.svg
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/         # Reusable components
β”‚   β”‚   β”œβ”€β”€ ui/            # Base components (Button, Input, Card, etc.)
β”‚   β”‚   β”œβ”€β”€ auth/          # Authentication components
β”‚   β”‚   └── biometrics/    # Facial recognition components
β”‚   β”œβ”€β”€ features/          # Feature-based modules
β”‚   β”‚   β”œβ”€β”€ auth/         # Authentication
β”‚   β”‚   β”œβ”€β”€ clients/      # Client management
β”‚   β”‚   β”œβ”€β”€ subscriptions/# Subscriptions and payments
β”‚   β”‚   β”œβ”€β”€ attendances/  # Attendance control
β”‚   β”‚   β”œβ”€β”€ inventory/    # Inventory management
β”‚   β”‚   β”œβ”€β”€ dashboard/    # Dashboard and analytics
β”‚   β”‚   └── rewards/      # Rewards system
β”‚   β”œβ”€β”€ pages/            # Main pages
β”‚   β”œβ”€β”€ shared/           # Shared code
β”‚   β”‚   β”œβ”€β”€ api/          # API client
β”‚   β”‚   β”œβ”€β”€ hooks/        # Shared hooks
β”‚   β”‚   β”œβ”€β”€ lib/          # Libraries (QueryClient, etc.)
β”‚   β”‚   β”œβ”€β”€ types/        # Shared types
β”‚   β”‚   └── utils/        # Utilities (logger, etc.)
β”‚   β”œβ”€β”€ test/             # Test configuration
β”‚   └── main.tsx          # Entry point
β”œβ”€β”€ .gitignore
β”œβ”€β”€ eslint.config.js      # ESLint configuration
β”œβ”€β”€ package.json
β”œβ”€β”€ tailwind.config.js     # Tailwind configuration
β”œβ”€β”€ tsconfig.json          # TypeScript configuration
└── vite.config.ts        # Vite configuration

πŸ—οΈ Architecture

Feature-Based Organization

The project is organized by features, where each module contains:

  • api/ - API functions and backend calls
  • components/ - Module-specific components
  • hooks/ - Custom hooks for reusable logic
  • types/ - TypeScript type definitions
  • utils/ - Utilities and helpers
  • constants/ - Constants and configurations

Path Aliases

Uses @/ alias for absolute imports:

import { Button } from '@/components/ui/Button';
import { useAuth } from '@/features/auth';

State Management

  • TanStack Query: For server state (fetching, caching, mutations)
  • React Hook Form: For form state
  • Local State: useState for simple local state

Code Quality

  • βœ… Strict TypeScript with well-defined types
  • βœ… ESLint configured with strict rules
  • βœ… No any types (using unknown when necessary)
  • βœ… Unit and integration tests
  • βœ… Conditional logger (development only)

🎨 Design & Styling

Color System

  • Primary: #f60310 (PowerGym Red)
  • Success: Green for successful actions
  • Warning: Yellow for warnings
  • Error: Red for errors
  • Info: Blue for information

Typography

  • Font Family: Inter (system-ui fallback)
  • Sizes: Responsive with Tailwind

UI Components

Own component library with:

  • Buttons with variants and states
  • Inputs with visual validation
  • Cards with animations
  • Badges for status
  • Modals and dialogs
  • Loading spinners
  • Toast notifications

πŸ§ͺ Testing

Running Tests

# Tests in watch mode
npm run test:watch

# Tests with coverage
npm run test:coverage

# Visual test interface
npm run test:ui

Test Structure

  • Unit Tests: For utilities and helpers
  • Component Tests: For UI components
  • Integration Tests: For hooks and complete flows

Coverage

The project maintains coverage thresholds:

  • Lines: 70%
  • Functions: 75%
  • Branches: 65%
  • Statements: 70%

🚒 Build & Deployment

Production Build

npm run build

The build is generated in dist/ ready for deployment.

Netlify Deployment

The project is configured for Netlify with netlify.toml. You just need:

  1. Connect your repository to Netlify
  2. Configure environment variables
  3. Automatic deployment on each push

Required Environment Variables

VITE_API_BASE_URL=https://api.yourdomain.com/api/v1
VITE_DISABLE_AUTH=false

🀝 Contributing

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

Code Conventions

  • Commits: Use conventional commits (feat:, fix:, docs:, etc.)
  • Branches: feature/, fix/, refactor/
  • TypeScript: Strict types, no any
  • ESLint: Pass all rules before commit

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ”— Useful Links

About

Frontend application for gym management with facial recognition check-in, member management, subscriptions, payments, and analytics. Built with React, TypeScript, and Vite.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages