Skip to content

Lenhan231/AWS_WS_FE

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Easy Body - Fitness Platform

A modern fitness platform connecting users with gyms and personal trainers.

Next.js TypeScript Spring Boot PostgreSQL


πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Backend API running on http://localhost:8080

Installation

# Clone repository
git clone <repository-url>
cd AWS_WS_FE

# Install dependencies
npm install

# Copy environment variables
cp env.example .env.local

# Run development server
npm run dev

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


πŸ“ Project Structure

AWS_WS_FE/
β”œβ”€β”€ app/                    # Next.js App Router pages
β”‚   β”œβ”€β”€ auth/              # Authentication pages
β”‚   β”œβ”€β”€ dashboard/         # Dashboard pages (admin, gym-staff, pt)
β”‚   β”œβ”€β”€ gyms/              # Gym pages
β”‚   β”œβ”€β”€ trainers/          # Trainer pages
β”‚   β”œβ”€β”€ offers/            # Offer pages
β”‚   └── profile/           # User profile
β”‚
β”œβ”€β”€ components/            # React components
β”‚   β”œβ”€β”€ ui/               # Reusable UI components
β”‚   β”œβ”€β”€ layout/           # Layout components (Header, Footer)
β”‚   β”œβ”€β”€ landing/          # Landing page components
β”‚   β”œβ”€β”€ gyms/             # Gym-specific components
β”‚   β”œβ”€β”€ trainers/         # Trainer-specific components
β”‚   └── offers/           # Offer-specific components
β”‚
β”œβ”€β”€ lib/                   # Utility libraries
β”‚   β”œβ”€β”€ api.ts            # API service layer
β”‚   β”œβ”€β”€ cognito.ts        # AWS Cognito integration
β”‚   β”œβ”€β”€ aws.ts            # AWS SDK utilities
β”‚   └── utils.ts          # Helper functions
β”‚
β”œβ”€β”€ store/                 # State management (Zustand)
β”‚   β”œβ”€β”€ authStore.ts      # Authentication state
β”‚   β”œβ”€β”€ searchStore.ts    # Search state
β”‚   └── uiStore.ts        # UI state
β”‚
β”œβ”€β”€ types/                 # TypeScript type definitions
β”‚   └── index.ts          # All type definitions
β”‚
β”œβ”€β”€ docs/                  # Documentation
β”‚   β”œβ”€β”€ api/              # API documentation
β”‚   β”œβ”€β”€ frontend/         # Frontend guides
β”‚   β”œβ”€β”€ backend/          # Backend guides
β”‚   β”œβ”€β”€ aws/              # AWS documentation
β”‚   └── deployment/       # Deployment guides
β”‚
└── public/               # Static assets

πŸ› οΈ Tech Stack

Frontend

  • Framework: Next.js 14 (App Router)
  • Language: TypeScript
  • Styling: Tailwind CSS
  • State Management: Zustand
  • Forms: React Hook Form + Zod
  • HTTP Client: Axios
  • Authentication: AWS Cognito
  • Icons: Lucide React

Backend

  • Framework: Spring Boot 3
  • Language: Java 21
  • Database: PostgreSQL 15 + PostGIS
  • Authentication: JWT (AWS Cognito)
  • Storage: AWS S3
  • API Documentation: Swagger/OpenAPI

🌟 Features

For Users

  • πŸ” Search gyms and trainers by location
  • πŸ“ Geo-location based search (radius)
  • πŸ’° Browse offers and deals
  • ⭐ Rate and review gyms/trainers
  • 🚩 Report inappropriate content
  • πŸ‘€ User profile management

For Gym Staff

  • 🏒 Register and manage gym
  • πŸ’Ό Create gym offers
  • πŸ‘₯ Assign personal trainers
  • πŸ“Š View analytics

For Personal Trainers

  • πŸ’ͺ Create PT profile
  • πŸ“ List specializations and certifications
  • πŸ’΅ Set hourly rates
  • 🎯 Create PT offers
  • πŸ‹οΈ Associate with gyms

For Admins

  • πŸ›‘οΈ Moderate offers
  • πŸ“‹ Review reports
  • βœ… Approve/reject content
  • πŸ‘₯ Manage users

πŸ”§ Configuration

Environment Variables

Create .env.local file:

# API Configuration
NEXT_PUBLIC_API_BASE_URL=http://localhost:8080/api/v1

# AWS Cognito
NEXT_PUBLIC_AWS_REGION=us-east-1
NEXT_PUBLIC_COGNITO_USER_POOL_ID=your-pool-id
NEXT_PUBLIC_COGNITO_CLIENT_ID=your-client-id

# AWS S3 (for media upload)
NEXT_PUBLIC_S3_BUCKET=easybody-media
NEXT_PUBLIC_S3_REGION=us-east-1

πŸ“š Documentation

Comprehensive documentation is available in the docs/ folder:


πŸš€ Development

Run Development Server

npm run dev

Build for Production

npm run build
npm start

Lint Code

npm run lint

🎨 Performance Optimizations

This project has been heavily optimized for performance:

  • βœ… 60 FPS on all devices
  • βœ… Removed heavy animations (glow, neon, 3D effects)
  • βœ… Optimized font loading (9 weights β†’ 3 weights)
  • βœ… Simplified transitions (500ms β†’ 150ms)
  • βœ… Removed backdrop-blur effects
  • βœ… Responsive design (mobile-first)
  • βœ… Lazy loading images
  • βœ… Code splitting

Result: 2-3x faster performance! πŸŽ‰


πŸ” Authentication Flow

  1. User signs up via AWS Cognito
  2. Email verification (OTP)
  3. Login to get JWT token
  4. Register user in backend database
  5. JWT token used for all API calls

πŸ“± API Integration

Example: Search Offers

import { api } from '@/lib/api';

const results = await api.search.searchOffers({
  latitude: 40.7128,
  longitude: -74.0060,
  radiusKm: 10,
  offerType: 'GYM_OFFER',
  minRating: 4.0,
  page: 0,
  size: 20
});

Example: Upload Image

// Get presigned URL
const { data } = await api.media.getPresignedUrl('offers', 'jpg');

// Upload to S3
await fetch(data.uploadUrl, {
  method: 'PUT',
  body: file,
  headers: { 'Content-Type': file.type }
});

// Use public URL
const imageUrl = data.publicUrl;

πŸ§ͺ Testing

Backend API

  • Swagger UI: http://localhost:8080/swagger-ui/index.html
  • API Docs: http://localhost:8080/v3/api-docs

Test Accounts

Admin:      [email protected] / Password123
Gym Staff:  [email protected] / Password123
PT User:    [email protected] / Password123
Client:     [email protected] / Password123

🀝 Contributing

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

πŸ“„ License

This project is proprietary and confidential.


πŸ“ž Support

For questions or issues:


Built with ❀️ by the Easy Body Team

About

Easybody

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 96.9%
  • PLpgSQL 1.9%
  • Other 1.2%