Skip to content

TrixIts/leagueup

Repository files navigation

LeagueUp - Sports League Management Platform

LeagueUp is a comprehensive web application for managing sports leagues and pickup games. Built with Next.js, MongoDB, and modern web technologies, it provides a platform for players to connect, organize games, and track their sports activities.

Features

Phase 1: User Authentication and Profiles βœ…

  • βœ… User registration and login with JWT authentication
  • βœ… User profile management and dashboard
  • βœ… Responsive design with Tailwind CSS
  • βœ… Protected routes with JWT middleware
  • βœ… Password hashing with bcrypt

Phase 2: Pickup Game Functionality βœ…

  • βœ… Create and manage pickup games with full form
  • βœ… Browse pickup games with advanced filtering
  • βœ… Join/leave games with waitlist support
  • βœ… Real-time player count updates
  • βœ… Game status management (upcoming, completed, cancelled)
  • βœ… Location-based game discovery

Phase 3: League & Team Management (Paid Feature) 🚧

  • Stripe integration for league creation payments
  • League creation and management
  • Team creation and player management

Phase 4: Scheduling & Game Management 🚧

  • Automatic round-robin schedule generation
  • Referee portal for game management
  • Real-time stats tracking

Phase 5: Stats & Analytics 🚧

  • Game results and statistics
  • League standings and leaderboards
  • Player performance tracking

Technology Stack

  • Frontend: Next.js 15 with React 19, TypeScript, Tailwind CSS
  • Backend: Next.js API Routes with Node.js
  • Database: Supabase (PostgreSQL)
  • Authentication: JWT (JSON Web Tokens)
  • Payments: Stripe integration
  • Styling: Tailwind CSS with responsive design

Database Schema

User Model

  • Personal information (name, email, age, contact)
  • Sports interests and preferences
  • Team memberships

PickupGame Model

  • Game details (location, date/time, competitiveness)
  • Player management (join/leave functionality)
  • Creator information

League Model

  • League organization and management
  • Team associations
  • Schedule management

Team Model

  • Team information and captain
  • Player roster management
  • League association

Game Model

  • Game scheduling and management
  • Team matchups
  • Referee assignments

GameStats Model

  • Detailed game statistics
  • Goals, assists, and cards tracking
  • Referee notes

Getting Started

Prerequisites

  • Node.js 18+
  • Supabase account (free tier available at https://supabase.com)
  • npm or yarn package manager

Installation

  1. Clone the repository

    git clone <repository-url>
    cd leagueup
  2. Install dependencies

    npm install
  3. Set up Supabase

    • Create a new project at https://supabase.com
    • Go to Project Settings > API to get your URL and anon key
    • In the SQL Editor, run the migration script from supabase-migration.sql to create the tables
  4. Set up environment variables Copy the example environment file and update the values:

    cp env.example .env.local

    Or create a .env.local file manually in the root directory:

    # Supabase Configuration
    NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
    NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
    
    # JWT - Generate a secure random string for production
    JWT_SECRET=your-super-secret-jwt-key-change-this-in-production-please-make-it-long-and-random
    
    # Stripe (add your keys when ready for payment features)
    STRIPE_SECRET_KEY=your_stripe_secret_key
    STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_key
    
    # Next.js
    NEXTAUTH_URL=http://localhost:3000
    NEXTAUTH_SECRET=your-nextauth-secret-make-this-random-too
  5. Run the development server

    npm run dev
  6. Open your browser Navigate to http://localhost:3000

Database Setup

The project uses Supabase (PostgreSQL) as the database. After creating your Supabase project, run the SQL migration script located at supabase-migration.sql in your Supabase SQL Editor to create all necessary tables and indexes.

Tables Created:

  • users: User accounts with authentication details
  • pickup_games: Pickup game listings with location and player management
  • leagues: League organization (coming soon)
  • teams: Team management (coming soon)
  • games: Scheduled games (coming soon)
  • game_stats: Game statistics tracking (coming soon)

Current Application Status

πŸŽ‰ The application is fully functional! All core features are implemented and working:

  • Homepage: Beautiful landing page with navigation
  • Authentication: Working registration and login system
  • Pickup Games: Create, browse, filter, and join games
  • Dashboard: User dashboard with game statistics
  • API: Complete REST API with all endpoints functional

Available Pages

  • / - Homepage with features overview
  • /login - User login page
  • /register - User registration page
  • /pickup - Browse all pickup games with filtering
  • /pickup/create - Create new pickup games
  • /dashboard - User dashboard (shows mock data for now)

Quick Test

  1. Visit the homepage at http://localhost:3000
  2. Click "Sign Up" to register a new account
  3. Browse pickup games at /pickup
  4. Create a new game at /pickup/create
  5. View your dashboard at /dashboard

API Endpoints

Authentication βœ…

  • POST /api/auth/register - User registration with validation
  • POST /api/auth/login - User login with JWT token
  • GET /api/auth/me - Get current user profile (protected)
  • PUT /api/auth/me - Update user profile (protected)

Pickup Games βœ…

  • GET /api/pickup - Get all pickup games with filtering
  • POST /api/pickup - Create new pickup game (protected)
  • GET /api/pickup/[id] - Get specific pickup game details
  • PUT /api/pickup/[id] - Update pickup game (creator only)
  • DELETE /api/pickup/[id] - Delete pickup game (creator only)
  • POST /api/pickup/[id]/join - Join pickup game or waitlist
  • DELETE /api/pickup/[id]/join - Leave pickup game or waitlist

Health Check βœ…

  • GET /api/health - API health status

Leagues (Coming Soon)

  • GET /api/leagues - Get all leagues
  • POST /api/leagues - Create league
  • GET /api/leagues/[id] - Get league details

Teams (Coming Soon)

  • GET /api/teams - Get all teams
  • POST /api/teams - Create team
  • GET /api/teams/[id] - Get team details

Games (Coming Soon)

  • GET /api/games - Get all games
  • POST /api/games/[id]/stats - Update game stats

Project Structure

leagueup/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/                 # API routes
β”‚   β”‚   β”‚   β”œβ”€β”€ auth/           # Authentication endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ pickup/         # Pickup game endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ leagues/        # League endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ teams/          # Team endpoints
β”‚   β”‚   β”‚   └── games/          # Game endpoints
β”‚   β”‚   β”œβ”€β”€ dashboard/          # User dashboard
β”‚   β”‚   β”œβ”€β”€ login/              # Login page
β”‚   β”‚   β”œβ”€β”€ register/           # Registration page
β”‚   β”‚   β”œβ”€β”€ profile/            # User profile page
β”‚   β”‚   β”œβ”€β”€ pickup/             # Pickup games pages
β”‚   β”‚   └── page.tsx            # Homepage
β”‚   └── lib/
β”‚       β”œβ”€β”€ models/             # Mongoose models
β”‚       └── utils/              # Utility functions
β”œβ”€β”€ public/                     # Static assets
β”œβ”€β”€ package.json
└── README.md

Development Roadmap

Completed βœ…

  • Project setup with Next.js 15 and TypeScript
  • Supabase database integration with PostgreSQL
  • Complete JWT authentication system with bcrypt password hashing
  • User registration and login with validation
  • User dashboard with game statistics
  • Pickup game creation with comprehensive form
  • Pickup game browsing with filtering (sport, skill level, location)
  • Join/leave pickup games with waitlist functionality
  • Beautiful responsive UI with Tailwind CSS and dark mode
  • Complete API endpoints for auth and pickup games
  • Error handling and form validation
  • Navigation and routing between all pages

In Progress 🚧

  • Stripe payment integration
  • League creation and management
  • Team management system
  • Automatic schedule generation
  • Referee portal
  • Game statistics tracking

Planned πŸ“‹

  • Real-time notifications
  • Mobile app development
  • Advanced analytics
  • Social features
  • Tournament management

Contributing

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

License

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

Support

For support, email support@leagueup.com or join our Discord community.

Acknowledgments

  • Built with Next.js and React
  • Styled with Tailwind CSS
  • Database powered by Supabase (PostgreSQL)
  • Authentication with JWT
  • Payments processed by Stripe

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors