Skip to content

Knightrider650/GymFlow-NextJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

45 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’ͺ GymFlow - Professional Gym Management System v2.0

A modern, feature-rich gym management system built with Next.js, React, and Tailwind CSS

πŸ“‹ Overview

GymFlow is a complete, production-ready gym management system designed to streamline all operations for gym businesses. It provides a sleek, modern interface built with Next.js and shadcn/ui components, offering comprehensive functionality for managing members, tracking attendance, processing payments, scheduling classes, and generating detailed analytics.

Status: βœ… Production Ready
Version: 2.0.0
Last Updated: April 2026


🎯 Key Features

πŸ‘₯ Member Management

  • Comprehensive Profiles: Store personal details, contact info, emergency contacts
  • Membership Types: Basic, Premium, Elite, Trial
  • Status Tracking: Active, Expired, Pending, Cancelled
  • Search & Filter: Quick member lookup by name, email, phone
  • Bulk Operations: Edit or delete multiple members at once
  • Import/Export: CSV support for data migration

πŸ“… Attendance Tracking

  • Real-time Check-in/Check-out: Log member visits with timestamps
  • Attendance History: View detailed records with notes
  • Daily Reports: Track gym traffic patterns
  • Duration Calculation: Automatic workout duration tracking
  • Batch Check-in: Check in multiple members quickly

πŸ’° Billing & Payment Processing

  • Automated Invoicing: Create invoices for memberships, services, products
  • Multiple Payment Methods: Cash, Card, Bank Transfer, Cheque
  • Payment Status Tracking: Paid, Pending, Overdue, Partial
  • Revenue Reports: Monthly and custom period reports
  • Payment Reminders: Automatic notifications for pending payments
  • Invoice Management: Create, edit, track, and archive invoices

πŸ‹οΈ Class Scheduling

  • Class Management: Create and manage fitness classes
  • Instructor Assignment: Assign trainers to classes
  • Capacity Control: Prevent overbooking with limits
  • Member Enrollment: Track class attendance
  • Schedule Management: Recurring and custom schedules
  • Notification System: Alert members of class updates

πŸ“¦ Inventory Management

  • Stock Tracking: Monitor equipment, supplements, merchandise
  • Low Stock Alerts: Automatic notifications when items need reordering
  • Categorization: Equipment, Consumables, Services, Merchandise
  • Cost Tracking: Monitor inventory costs and value
  • Usage Reports: Track inventory consumption trends

πŸ‘¨β€πŸ’Ό Staff & HR Management

  • Staff Profiles: Manage trainers, receptionists, maintenance staff
  • Role-based Access: Admin, Staff, Trainer roles
  • Payroll Tracking: Salary and employment details
  • Performance Metrics: Track staff-related statistics
  • Contact Management: Store and manage staff information

πŸ“Š Advanced Analytics & Reporting

  • Interactive Dashboard: Real-time overview of key metrics
  • 8+ Report Types:
    • Revenue Analysis (daily/weekly/monthly)
    • Member Retention Analysis
    • Attendance Trends
    • Staff Performance
    • Inventory Status
    • Conversion Rates
    • Class Popularity
    • Equipment Usage
  • Export Functionality: Download reports as CSV/PDF
  • Trend Analysis: Visual charts and graphs
  • Custom Date Ranges: Filter reports by any period

πŸ”” Real-time Notifications

  • Membership Expiry Alerts: Notify before expiration
  • Low Stock Warnings: Alert when inventory is low
  • Payment Reminders: Remind members of pending payments
  • Class Updates: Notify of schedule changes
  • System Notifications: Important gym events

πŸ› οΈ Technology Stack

Frontend (Next.js + React)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Next.js 14 (App Router)                     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ React 18 (Hooks, Context)                   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Tailwind CSS 3 (Styling)                    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ shadcn/ui (Component Library)               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Zustand (State Management)                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ React Hook Form (Form Management)           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Recharts (Data Visualization)               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Axios (HTTP Client)                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ date-fns (Date Manipulation)                β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Lucide React (Icons)                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Backend (Node.js + Express)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Node.js v18+ & Express.js v4.18+            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Authentication: JWT + refresh tokens        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Security: bcrypt, helmet, CORS, rate limit  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Real-time: Socket.io (WebSockets)           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Database: PostgreSQL (production)           β”‚
β”‚           JSON file (development)           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Validation: express-validator               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ DevOps: PM2, Docker, AWS deployment-ready   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Infrastructure

  • Hosting: AWS Elastic Beanstalk (backend) + S3 + CloudFront (frontend)
  • Database: PostgreSQL (AWS RDS)
  • Containerization: Docker support
  • CI/CD: GitHub Actions ready
  • Monitoring: CloudWatch integration

πŸ“¦ Installation & Setup

Prerequisites

  • Node.js v18 or higher
  • npm or yarn
  • Git

1. Clone the Repository

git clone https://github.com/yourusername/gymflow-nextjs.git
cd gymflow-nextjs

2. Install Dependencies

npm install
# or
yarn install

3. Configure Environment

cp .env.local.example .env.local

Edit .env.local:

NEXT_PUBLIC_API_URL=http://localhost:5000
NEXT_PUBLIC_WS_URL=http://localhost:5000
NEXT_PUBLIC_JWT_SECRET=your_secret_key_here

4. Run Development Server

npm run dev
# or
yarn dev

Open http://localhost:3000 in your browser.

5. Connect Backend

  • Ensure the backend server is running on http://localhost:5000
  • The frontend will automatically connect to the API

6. Default Credentials

Email: admin@gym.com
Password: password123

πŸš€ Quick Start Guide

Login

  1. Navigate to http://localhost:3000/login
  2. Enter demo credentials (admin@gym.com / password123)
  3. Click "Sign In"

🧭 Testing

  • Unit tests are located in the tests/ folder. A small suite validates the RBAC helpers in lib/permissions.ts (hierarchy ordering, management checks, route visibility, and helper utilities).
  • Run the tests with:
npm run test

Add Your First Member

  1. Go to Members page
  2. Click "Add Member" button
  3. Fill in member details:
    • Full Name
    • Email
    • Phone
    • Membership Type
    • Join & Expiry dates
  4. Click "Add Member"

Record Check-in

  1. Go to Attendance page
  2. Click "Check-in Member" button
  3. Select member from dropdown
  4. Add optional notes
  5. Click "Check-in"

Create Invoice

  1. Go to Billing page
  2. Click "Create Invoice" button
  3. Select member and amount
  4. Set due date
  5. Click "Create Invoice"

View Dashboard

  1. Navigate to Dashboard
  2. View real-time statistics:
    • Active members count
    • Today's revenue
    • Daily visits
    • Pending payments
  3. Check revenue and attendance charts

πŸ“š Project Structure

gymflow-nextjs/
β”œβ”€β”€ app/                          # Next.js app directory
β”‚   β”œβ”€β”€ layout.tsx               # Root layout
β”‚   β”œβ”€β”€ page.tsx                 # Home/index page
β”‚   β”œβ”€β”€ globals.css              # Global styles
β”‚   β”œβ”€β”€ login/                   # Authentication pages
β”‚   β”‚   └── page.tsx
β”‚   β”œβ”€β”€ register/
β”‚   β”‚   └── page.tsx
β”‚   β”œβ”€β”€ dashboard/               # Main features
β”‚   β”‚   └── page.tsx             # Dashboard home
β”‚   β”œβ”€β”€ members/
β”‚   β”‚   └── page.tsx             # Members management
β”‚   β”œβ”€β”€ attendance/
β”‚   β”‚   └── page.tsx             # Check-in/Check-out
β”‚   β”œβ”€β”€ billing/
β”‚   β”‚   └── page.tsx             # Invoices & payments
β”‚   β”œβ”€β”€ classes/
β”‚   β”‚   └── page.tsx             # Class scheduling
β”‚   β”œβ”€β”€ inventory/
β”‚   β”‚   └── page.tsx             # Stock management
β”‚   β”œβ”€β”€ staff/
β”‚   β”‚   └── page.tsx             # HR management
β”‚   β”œβ”€β”€ notifications/
β”‚   β”‚   └── page.tsx             # Alerts & notifications
β”‚   └── settings/
β”‚       └── page.tsx             # Configuration
β”‚
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ui/                      # shadcn/ui components
β”‚   β”‚   β”œβ”€β”€ button.tsx
β”‚   β”‚   β”œβ”€β”€ card.tsx
β”‚   β”‚   β”œβ”€β”€ input.tsx
β”‚   β”‚   β”œβ”€β”€ label.tsx
β”‚   β”‚   β”œβ”€β”€ badge.tsx
β”‚   β”‚   β”œβ”€β”€ table.tsx
β”‚   β”‚   └── dialog.tsx
β”‚   └── layout/                  # Layout components
β”‚       β”œβ”€β”€ sidebar.tsx          # Navigation sidebar
β”‚       └── protected-layout.tsx # Auth protection wrapper
β”‚
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ api-client.ts           # Axios HTTP client
β”‚   β”œβ”€β”€ store.ts                # Zustand state management
β”‚   └── utils.ts                # Utility functions
β”‚
β”œβ”€β”€ hooks/
β”‚   └── index.ts                # Custom React hooks
β”‚
β”œβ”€β”€ utils/
β”‚   └── format.ts               # Formatting utilities
β”‚
β”œβ”€β”€ types/
β”‚   └── index.ts                # TypeScript types & interfaces
β”‚
β”œβ”€β”€ public/                     # Static assets
β”‚
β”œβ”€β”€ .env.local                  # Environment variables
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
β”œβ”€β”€ next.config.js
β”œβ”€β”€ tailwind.config.ts
β”œβ”€β”€ postcss.config.js
└── README.md                   # This file

πŸ” Security Features

  • βœ… JWT Authentication with 15-minute token expiry
  • βœ… Password Hashing with bcrypt
  • βœ… Rate Limiting (10 login attempts per 15 minutes)
  • βœ… XSS Protection with sanitize-html
  • βœ… CORS enabled for trusted origins
  • βœ… Secure Headers via helmet
  • βœ… SQL Injection Prevention via prepared statements
  • βœ… Refresh Token Rotation for enhanced security
  • βœ… HTTPS Ready for production
  • βœ… Role-based Access Control (RBAC)

πŸ“ API Integration

The frontend communicates with the backend via RESTful API endpoints:

Key Endpoints

Authentication

  • POST /api/auth/register - Create account
  • POST /api/auth/login - Login
  • POST /api/auth/logout - Logout
  • POST /api/auth/refresh - Refresh token

Members

  • GET /api/members - Get all members
  • POST /api/members - Create member
  • PUT /api/members/:id - Update member
  • DELETE /api/members/:id - Delete member

Attendance

  • GET /api/attendance - Get records
  • POST /api/attendance/checkin - Check in
  • POST /api/attendance/:id/checkout - Check out

Billing

  • GET /api/billing - Get invoices
  • POST /api/billing - Create invoice
  • POST /api/payments - Record payment

And more... (Classes, Inventory, Staff, Settings, Notifications)


🎨 Customization

Change Brand Colors

Edit app/globals.css:

:root {
  --primary: 0 0% 9.0%;  /* Change to your brand color */
  --secondary: 0 0% 96.1%;
  /* ... other colors ... */
}

Add New Pages

  1. Create new folder in app/ (e.g., app/reports/)
  2. Add page.tsx:
'use client'
import { ProtectedLayout } from '@/components/layout/protected-layout'

export default function ReportsPage() {
  return (
    <ProtectedLayout>
      {/* Your content here */}
    </ProtectedLayout>
  )
}
  1. Add navigation item in components/layout/sidebar.tsx

Create New Components

// components/custom/MyComponent.tsx
export function MyComponent() {
  return <div>Custom content</div>
}

Then import and use:

import { MyComponent } from '@/components/custom/MyComponent'

πŸ§ͺ Testing

# Run type checking
npm run type-check

# Build for production
npm run build

# Start production server
npm start

πŸ“Š Analytics & Reporting

The dashboard provides comprehensive analytics:

  1. Real-time Stats: Active members, revenue, daily visits
  2. Revenue Trends: Weekly/monthly revenue charts
  3. Attendance Patterns: Daily visit trends
  4. Member Analytics: Retention, growth, churn
  5. Payment Status: Paid vs pending invoices
  6. Inventory Status: Low stock alerts

Export Reports

Click "Download" on any report to export as CSV.


πŸš€ Deployment

Deploy to Vercel (Recommended for Frontend)

npm install -g vercel
vercel

Deploy Backend to Heroku/AWS

See backend repository for deployment instructions.

Environment Variables for Production

NEXT_PUBLIC_API_URL=https://api.yourdomain.com
NEXT_PUBLIC_WS_URL=https://api.yourdomain.com
NEXT_PUBLIC_JWT_SECRET=your_production_secret

πŸ“ž Support & Documentation


πŸ“„ License

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


🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your 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

πŸ’‘ Roadmap

  • Mobile app (React Native)
  • Advanced analytics dashboard
  • Multi-gym support
  • AI-powered member recommendations
  • Video tutorials integration
  • API documentation (Swagger)
  • Automated backups
  • Two-factor authentication
  • Member app/portal
  • Advanced reporting (PDF generation)

πŸŽ‰ Acknowledgments


⭐ Show Your Support

If you find this project helpful, please give it a star! ⭐


Made with πŸ’ͺ for gym owners and fitness enthusiasts

Last Updated: April 2026 | Version 2.0.0

About

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors