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.
- ๐ฐ 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.
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) โ๏ธ
Hereโs how you can set up GameSite for yourself:
git clone https://github.com/your-username/gamesite.git
cd gamesiteCreate 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- The
fetch_games.pyscript will automatically create tables (if they donโt exist) and populate them with game data. - Run the script:
python fetch_games.py
Build the Docker image:
sudo docker build -t gamesite-image .Run the container:
sudo docker run --name gamesite -p 5000:5000 gamesite-imageOpen your browser and navigate to http://<your-app-url>:5000
Replace <your-app-url> with the actual URL where the app is hosted.
Each genre has its own table, sharing the same schema. Here's the structure:
| 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 |
The same structure applies to all genre-specific tables:
adventure_gamesearlyaccess_gamesfree_gamesindie_gamesmmo_gamesrpg_gamessimulation_gamessports_gamesstrategy_games
The fetch_games.py script is the backbone of data management in GameSite. It performs the following functions:
- Automatically creates tables for each genre if they donโt already exist in the database.
- Uses the SteamSpy API to fetch genre-specific game data.
- Retrieves detailed game information (title, image, price, etc.) using the Steam API.
- Populates or updates records in the corresponding genre tables using the
ON DUPLICATE KEY UPDATEquery to avoid duplicate entries.
- Ensure your
.envfile 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.
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:
- Set up a host service (e.g., AWS EC2, Google Cloud, Azure, or local hosting).
- Install Docker on the host.
- Follow the steps to build and run the Docker container.
- Configure your database and environment variables appropriately.
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:
On your server (e.g., AWS EC2):
sudo apt update
sudo apt install nginxCreate a configuration file for your Flask app:
sudo nano /etc/nginx/sites-available/gamesiteAdd 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 nginxUse Certbot to obtain a free SSL certificate:
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.comFollow the prompts to complete the process.
Access your site using HTTPS:
https://your-domain.comThis app relies on the following key resources and tools:
-
APIs for Game Data:
- Steamspy - The primary source for fetching game data by genre, including game titles, descriptions, images, and pricing details.
-
Frameworks and Libraries:
-
Containerization:
- Docker - Used for application packaging and deployment, ensuring consistency across environments.
-
Hosting:
-
Development Tools:
-
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.
-
Additional Resources:
- Flask Documentation - Comprehensive guides and references for Flask.
- Docker Hub - For managing and sharing Docker images.
- AWS Free Tier - Information about free-tier resources for AWS.
โญ If you enjoy this project, star the repository and share it with your friends! โญ