MLB Fan Hub is a Flask-based web application that provides fans of Major League Baseball (MLB) with comprehensive information about teams, players, and game schedules. The application is designed to deliver dynamic content using APIs, interactive features, and a user-friendly interface.
- Home Page:
- Displays the featured game of the day.
- Provides a countdown to the next scheduled game.
- Lists upcoming and past games with pagination.
- Teams Page:
- Lists MLB teams with details such as team name, location, league, and division.
- Players Page:
- Allows users to search for player details based on team and player name.
- Displays comprehensive player information, including headshot, position, age, birthplace, height, weight, and MLB debut date.
- Countdown timer for the next game.
- “Load More” functionality for viewing additional upcoming and past games.
mlb_fan_coach/
│
├── app.py # Main Flask app handling routes and logic
├── templates/ # HTML templates for rendering web pages
│ ├── home.html # Home page layout
│ ├── teams.html # Teams information page
│ ├── players.html # Player search page
│
├── static/ # Static files
│ ├── css/ # CSS styling folder
│ │ └── style.css # Main CSS file
│ ├── script.js # JavaScript for interactivity
│
├── utils/ # Utility functions
│ └── api_utils.py # Functions to interact with MLB APIs
│
└── requirements.txt # Python dependencies
- Python 3.9 or above
- pip (Python Package Installer)
-
Clone the repository:
git clone https://github.com/yourusername/mlb-fan-hub.git cd mlb-fan-hub -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Run the Flask application:
python app.py
-
Open the application in your browser:
- Navigate to
http://127.0.0.1:5000.
- Navigate to
/api/upcoming-games:- Fetches upcoming games with pagination.
- Query Parameters:
start: Starting index (default: 0).limit: Number of games to fetch (default: 10).
/api/past-games:- Fetches past games with pagination.
- Query Parameters:
start: Starting index (default: 0).limit: Number of games to fetch (default: 10).
- Back-End: Flask, Python
- Front-End: HTML, CSS, JavaScript (Vanilla)
- APIs: MLB Stats API
- Version Control: Git, GitHub
- Containerization: Docker (Optional)
This project is licensed under the MIT License. See the LICENSE file for details.
- Author: Amaan Ahmad
- Email: ahmadamaan082@gmail.com
- GitHub: amaan025