Skip to content

YeabMoges/GameSite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

74 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation


๐ŸŽฎ GameSite - Flask App ๐ŸŽฎ

Welcome to GameSite, your go-to web app for discovering the best deals on video games! ๐Ÿš€ This project, powered by Flask, helps users find and track trending games with the best prices across various platforms. With flexible deployment options, you can run this app using Docker on any service of your choice.


๐ŸŒŸ Features

  • ๐Ÿ’ฐ Game Deals by Genre: Browse and track game deals categorized by genre, from action-packed adventures to strategy-based challenges.
  • ๐Ÿ“ˆ Real-Time Updates: Periodically fetches and updates pricing data via integrated APIs.
  • ๐Ÿ“ฆ Portable Deployment: Run GameSite on any deployment service (AWS EC2, local, or your preferred hosting solution).
  • ๐Ÿ’ป Simple UI: Built with CSS and HTML for an intuitive and responsive design.
  • ๐Ÿ”’ Secure Configuration: Keep your database and API credentials secure using environment variables.

๐Ÿ› ๏ธ Tech Stack

This project is built with:

  • Backend: Python with Flask Framework ๐Ÿ
  • Database: MySQL (AWS RDS recommended for hosting) ๐Ÿ’พ
  • Frontend: CSS and HTML ๐ŸŽจ
  • Containerization: Docker for easy setup and deployment ๐Ÿณ
  • Deployment: Designed for flexibility (AWS EC2, local hosting, or other platforms) โ˜๏ธ

๐Ÿš€ Installation and Setup

Hereโ€™s how you can set up GameSite for yourself:

1. Clone the Repository

git clone https://github.com/your-username/gamesite.git
cd gamesite

2. Set Up the .env File

Create a .env file in the root directory and include the following configuration:

DB_HOST=your-database-host
DB_USER=your-database-username
DB_PASS=your-database-password
DB_NAME=your-database-name

3. Run the Fetch Script

  • The fetch_games.py script will automatically create tables (if they donโ€™t exist) and populate them with game data.
  • Run the script:
    python fetch_games.py

4. Build and Run with Docker

Build the Docker image:

sudo docker build -t gamesite-image .

Run the container:

sudo docker run --name gamesite -p 5000:5000 gamesite-image

5. Access the App

Open your browser and navigate to http://<your-app-url>:5000

Replace <your-app-url> with the actual URL where the app is hosted.


๐Ÿ“Š Database Schema

Each genre has its own table, sharing the same schema. Here's the structure:

Example Table: action_games

Column Name Data Type Description
appid INT Unique identifier for the game (Primary Key)
name VARCHAR(255) Title of the game
header_image TEXT URL to the gameโ€™s header image
short_description TEXT A brief description of the game
price VARCHAR(50) Game price or pricing details
store_link TEXT URL to the game's store page
last_updated TIMESTAMP Time when the data was last updated

Other Genre Tables

The same structure applies to all genre-specific tables:

  • adventure_games
  • earlyaccess_games
  • free_games
  • indie_games
  • mmo_games
  • rpg_games
  • simulation_games
  • sports_games
  • strategy_games

๐Ÿ”„ Fetching Game Data

The fetch_games.py script is the backbone of data management in GameSite. It performs the following functions:

1. Table Creation:

  • Automatically creates tables for each genre if they donโ€™t already exist in the database.

2. Data Fetching:

  • Uses the SteamSpy API to fetch genre-specific game data.
  • Retrieves detailed game information (title, image, price, etc.) using the Steam API.

3. Data Insertion:

  • Populates or updates records in the corresponding genre tables using the ON DUPLICATE KEY UPDATE query to avoid duplicate entries.

How to Run the Script:

  • Ensure your .env file is correctly configured.
  • Run the script:
    python fetch_games.py
  • Automate this process using a scheduler (e.g., cron on Linux or Task Scheduler on Windows) for periodic updates.

๐ŸŒ Flexible Deployment

You can deploy the GameSite app on any service or platform that supports Docker. While we recommend AWS EC2 and AWS RDS for hosting the app and database, you are free to use your preferred solution.

Deployment Steps:

  1. Set up a host service (e.g., AWS EC2, Google Cloud, Azure, or local hosting).
  2. Install Docker on the host.
  3. Follow the steps to build and run the Docker container.
  4. Configure your database and environment variables appropriately.

๐Ÿ”’ Optional: SSL Configuration and Nginx Setup

For users who want to secure their app with SSL, you can configure Nginx as a reverse proxy and obtain an SSL certificate for your domain. Hereโ€™s how:

1. Install Nginx:

On your server (e.g., AWS EC2):

sudo apt update
sudo apt install nginx

2. Set Up Nginx as Reverse Proxy:

Create a configuration file for your Flask app:

sudo nano /etc/nginx/sites-available/gamesite

Add the following configuration (adjust for your domain and Flask app location):

   server {
    listen 80;
    server_name your-domain.com;

    location / {
        proxy_pass http://127.0.0.1:5000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Enable the configuration:

sudo ln -s /etc/nginx/sites-available/gamesite /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

3. Obtain an SSL Certificate:

Use Certbot to obtain a free SSL certificate:

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.com

Follow the prompts to complete the process.

4. Test the Configuration:

Access your site using HTTPS:

https://your-domain.com

๐Ÿ“š Sources

This app relies on the following key resources and tools:

Resources and Tools

  1. APIs for Game Data:

    • Steamspy - The primary source for fetching game data by genre, including game titles, descriptions, images, and pricing details.
  2. Frameworks and Libraries:

    • Flask - A lightweight WSGI web application framework for backend development.
    • MySQL - A relational database system for storing game information.
  3. Containerization:

    • Docker - Used for application packaging and deployment, ensuring consistency across environments.
  4. Hosting:

    • AWS RDS - Provides scalable and managed MySQL database hosting.
    • AWS EC2 - Recommended for deploying and running the Dockerized app.
  5. Development Tools:

    • Python - The core programming language used for backend development.
    • PyCharm or any preferred IDE - For writing, debugging, and managing code.
    • Docker - Used here as both a containerization and development tool.
  6. Frontend Tools:

    • HTML & CSS - For designing and structuring the user interface. Special thanks to Kevin Powell for web design ideas.
    • Bootstrap - For responsive design and enhanced styling.
    • JavaScript - To add interactivity to the user interface.
  7. Additional Resources:


โญ If you enjoy this project, star the repository and share it with your friends! โญ


About

This repository hosts the code and infrastructure for a cloud-based web application that displays trending video games various online API's. Built as a senior year cloud project, the application uses AWS services to create a scalable, serverless architecture.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors