Skip to content

kaifansariw/GameHub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

366 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

GameHub Logo

GameHub: Cosmic Edition

Experience the next generation of browser gaming. High-performance, low-latency, and stunning cosmic aesthetics.

Stars Forks License Issues

PWA Google OAuth JWT

Live Demo

About โ€ข Technical Docs โ€ข Quick Start โ€ข API โ€ข Contribute โ€ข Request Feature


GameHub Cosmic Edition Screenshot
The Cosmic Neon Library Interface


Protocol Guidelines (ECWoC26)

Important

  • Star the Repo: Your contribution only counts if you've starred the repository. โญ
  • Documentation: Proper docs are required for every new feature. Share them via mail.
  • Meaningful Issues: Only high-impact issues will be considered.
  • Leaderboard Priority: Priority is given to contributors with lower ranks.

Table of Contents


๐Ÿ’ก About GameHub

GameHub is an elite, open-source collection of classic and modern browser games. Re-imagined with a Cosmic Blue Neon aesthetic, it combines the nostalgia of retro gaming with the performance of industry-standard web tech.

Originally a Vanilla JS project, GameHub has been upgraded to a React + Django REST Framework hybrid architecture supporting massive scalability, premium animations, a global leaderboard system, full JWT authentication, Google OAuth 2.0, PWA installability, and a password reset flow.


โœจ Features

Feature Description
๐Ÿš€ Modern Engine Built with React 19 + Vite 7 for sub-millisecond responsiveness.
๐ŸŽจ Cosmic UI High-end Glassmorphism and Neon design system with Framer Motion animations.
๐Ÿ•น๏ธ 50+ Titles Instant play library including retro classics and modern games.
๐Ÿ† Leaderboards Global competition powered by a Django REST backend.
๏ฟฝ Full Auth JWT login/register + Google OAuth 2.0 (id_token flow).
๐Ÿ”‘ Password Reset Secure email-based forgot/reset password flow.
๐Ÿ“ฑ PWA Ready Installable as a native app on any device. Dismiss-once prompt.
๐Ÿ› ๏ธ Modular Code Clean architecture designed for easy open-source contribution.

๐Ÿ› ๏ธ Tech Stack

Tier Technology Notes
Frontend React 19, Framer Motion SPA with file-based routing
Styling Tailwind CSS 4, Lucide Icons Cosmic Neon design tokens
Backend Django 4+ REST Framework JWT via djangorestframework-simplejwt
Auth JWT + Google OAuth 2.0 google-auth library for id_token verification
State Zustand Persistent auth store
Build Vite 7 (Ultra-fast HMR) PWA via vite-plugin-pwa
API Docs drf-spectacular OpenAPI 3.0 + Swagger UI at /api/schema/swagger-ui/

๐Ÿ“ Project Structure

GameHub/
โ”œโ”€โ”€ frontend/                   # React Application (Vite)
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ api/                # Axios instance + JWT interceptor
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ GoogleAuth/     # GoogleAuthButton (id_token flow)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Navbar/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Footer/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ SEO/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ PWAInstallPrompt.jsx  # Smart one-time install banner
โ”‚   โ”‚   โ”œโ”€โ”€ pages/              # Login, Register, Profile, Gamesโ€ฆ
โ”‚   โ”‚   โ”œโ”€โ”€ data/               # games.js registry
โ”‚   โ”‚   โ””โ”€โ”€ store/              # Zustand auth store
โ”‚   โ”œโ”€โ”€ public/                 # Static assets & game files
โ”‚   โ”œโ”€โ”€ .env                    # VITE_GOOGLE_CLIENT_ID
โ”‚   โ””โ”€โ”€ vite.config.js          # PWA + proxy + COOP headers
โ”‚
โ”œโ”€โ”€ backend/                    # Django REST API
โ”‚   โ”œโ”€โ”€ accounts/
โ”‚   โ”‚   โ”œโ”€โ”€ views.py            # All API endpoints incl. Google OAuth
โ”‚   โ”‚   โ”œโ”€โ”€ models.py           # Profile, GameScore, UserMessage
โ”‚   โ”‚   โ””โ”€โ”€ urls.py             # API route definitions
โ”‚   โ”œโ”€โ”€ gamehub_project/
โ”‚   โ”‚   โ””โ”€โ”€ settings.py         # CORS, JWT, Google Client ID, COOP
โ”‚   โ”œโ”€โ”€ .env                    # GOOGLE_CLIENT_ID + SECRET_KEY
โ”‚   โ””โ”€โ”€ requirements.txt
โ”‚
โ”œโ”€โ”€ DOCS.md                     # Technical Deep-Dive
โ””โ”€โ”€ README.md                   # This file

๐Ÿš€ Quick Start

1๏ธโƒฃ Clone the Repo

git clone https://github.com/kaifansariw/GameHub.git
cd GameHub

2๏ธโƒฃ Initialize Frontend

cd frontend
npm install
# Create your .env (copy values from .env.example if present)
npm run dev
# Runs on http://localhost:5173

3๏ธโƒฃ Initialize Backend

cd backend
python -m venv venv
# Windows:
.\venv\Scripts\activate
# Mac/Linux:
source venv/bin/activate

pip install -r requirements.txt
python manage.py migrate
python manage.py runserver
# Runs on http://localhost:8000

๐Ÿ”‘ Environment Variables

frontend/.env

VITE_GOOGLE_CLIENT_ID=your_google_oauth_client_id.apps.googleusercontent.com

backend/.env

SECRET_KEY=your_django_secret_key
DEBUG=True
GOOGLE_CLIENT_ID=your_google_oauth_client_id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your_google_oauth_client_secret

Tip

Get your Google OAuth credentials from console.cloud.google.com/apis/credentials. Add http://localhost:5173 and http://localhost:8000 as an Authorized JavaScript Origin.


๐Ÿ“ก API Reference

Full interactive docs at http://localhost:8000/api/schema/swagger-ui/

Method Endpoint Auth Description
POST /api/auth/login/ โŒ Login with username/email + password
POST /api/auth/register/ โŒ Create a new account
POST /api/auth/google/ โŒ Login/register via Google id_token
POST /api/auth/token/refresh/ โŒ Refresh JWT access token
POST /api/auth/password-reset/ โŒ Send reset email
POST /api/auth/password-reset-confirm/ โŒ Confirm password reset
GET /api/profile/ โœ… Get authenticated user profile
GET /api/leaderboard/ โŒ Global ranked leaderboard
POST /api/add-visit/ โœ… Record a game page visit
POST /api/add-play/ โœ… Record a game play
POST /api/save-score/ โœ… Save/update a game high score
POST /api/send-feedback/ โŒ Submit feedback

๐ŸŽฎ Adding New Games

Registering a new title in the Cosmic Library:

  1. Upload Assets: Place files in frontend/public/games/<game-id>/
  2. Register Metadata: Edit frontend/src/data/games.js:
{
    id: "quantum-racer",
    title: "Quantum Racer",
    description: "Multi-dimensional racing experience.",
    image: "/assets/thumbs/quantum.png",
    file: "/games/quantum/index.html",
    category: "racing"
}

๐ŸŒŸ Contributing

We โค๏ธ our contributors! Whether it's a bug fix or UI polish:

  1. Fork โ†’ Branch (git checkout -b feat/CoolFeature) โ†’ Commit โ†’ Push โ†’ PR.

Note

Every new feature should include a brief description in DOCS.md and follow the existing code style.


โœจ Contributors

The heroes behind the Cosmic Engine:


๐Ÿ“„ License

This project is licensed under the MIT License.


Maintained by Kaif Ansari & the Open Source Community


About

GameHub is a free, open-source collection of classic browser games designed to bring nostalgia, fun, and learning together in one place. Built with modern web technologies and a focus on simplicity, GameHub offers smooth gameplay, responsive design, and clean code that makes it easy for developers to explore, learn, and contribute.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors