4Point Hoops Dashboard 4Point Hoops is an advanced NBA analytics platform that turns raw basketball statistics into actionable, narrative-driven insights. By scraping Basketball-Reference in real time and routing context-rich prompts to Perplexity’s Sonar Pro model, it helps fans, analysts, and fantasy players understand the “why” and “what’s next” – not just the numbers.

Features

  • Player Analytics with season & playoff splits, shot-type breakdowns, and performance radar for any NBA player
  • Cross-Era Comparisons enabling side-by-side stat comparisons (e.g., Michael Jordan ‘97 vs. Stephen Curry ‘22)
  • Team Dashboards with standings, playoff-probability Sankey flows, and auto-refreshing KPI tiles
  • AI Explain & Similar Players providing one-click Sonar explanations of stat lines and AI-picked comparable athletes
  • Basketball AI Chat allowing users to ask an expert LLM about NBA history, rosters, or projections
  • Credit-Based SaaS System with Firebase Auth, Google login, credit wallets, and admin tooling

Prerequisites

  • Node.js 16+ and npm
  • Python 3.8+ and pip
  • Firebase project setup
  • Perplexity API key (Sonar Pro)
  • Basketball-Reference access

Installation

# Clone the frontend repository
git clone https://github.com/rapha18th/hoop-ai-frontend-44.git
cd hoop-ai-frontend-44
npm install

# Clone the backend repository
git clone https://github.com/rapha18th/4Point-Hoops-Server.git
cd 4Point-Hoops-Server
pip install -r requirements.txt

Configuration

Create .env file in the backend directory:
PERPLEXITY_API_KEY=your_sonar_pro_api_key
FIREBASE_PROJECT_ID=your_firebase_project_id
FIREBASE_PRIVATE_KEY=your_firebase_private_key
FIREBASE_CLIENT_EMAIL=your_firebase_client_email

Usage

  1. Start Backend:
    cd 4Point-Hoops-Server
    python app.py
    
  2. Start Frontend:
    cd hoop-ai-frontend-44
    npm run dev
    
  3. Access Application: Open the frontend URL and explore NBA analytics with AI-powered insights
  4. Use AI Features: Click “AI Explain” on any player or stat to get intelligent analysis powered by Perplexity Sonar

Code Explanation

  • Frontend: React with shadcn/ui components and Recharts for data visualization
  • Backend: Python Flask API serving Basketball-Reference data and managing Perplexity API calls
  • Data Pipeline: BRScraper for real-time data collection with Firebase caching
  • AI Integration: Perplexity Sonar Pro for intelligent basketball analysis and explanations
  • Authentication: Firebase Auth with Google login and credit-based access control
  • Deployment: Frontend on Netlify, backend on Hugging Face Spaces with Docker