Skip to content

Game Hub — a React-based e-commerce web app for browsing and purchasing games with a modern, responsive UI.

Notifications You must be signed in to change notification settings

naheel0/gamehub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 

Repository files navigation

gamehub

The ultimate open-source storefront template for digital goods and games.

Build Issues Contributions License


📚 Table of Contents


⭐ Overview

gamehub is a highly interactive, full-stack simulation e-commerce platform designed as a modern boilerplate for digital storefronts, specializing in games and digital media. It provides a complete, production-ready frontend solution that covers every critical aspect of the modern shopping experience, from browsing and authentication to complex payment processing flows.

The Problem

Prototyping and launching modern, feature-rich digital storefronts—especially for digital products like games—is complex and time-consuming. Developers often spend significant effort building core, repetitive infrastructure like authentication, cart management, and administrative dashboards from scratch. This redundant work slows innovation and delays time-to-market. Furthermore, ensuring a clean separation of concerns between the user-facing interface and administrative backend requires thoughtful, scalable architecture from day one.

The Solution

gamehub eliminates the boilerplate burden by providing a complete, ready-to-run Component-based Architecture solution. It offers a fully realized user experience, including robust user authentication, dynamic shopping carts, persistent wishlists, detailed product pages, and a dedicated administrative panel for managing inventory and orders. By utilizing specialized React contexts (CartContext, WishlistContext, AuthContext), gamehub ensures optimal state management and performance across the application.

This solution allows developers to focus immediately on integration and unique product features, drastically accelerating development time. The clear organizational pattern, featuring separate areas for Auth, Main user pages, and Admin functionalities, ensures long-term scalability and maintainability.

Architecture Overview

The core foundation of gamehub is built upon a robust Component-based Architecture using React. This approach maximizes component reusability and maintainability, ensuring that complex features—such as the multi-step checkout process or dynamic product filtering—are cleanly isolated and easy to manage.

While the frontend is powered by Vite and React for blazing-fast performance, the project includes a powerful local development capability using json-server to simulate a fully functional REST API. This setup allows for immediate, interactive testing of all features, including product management and user state persistence, without requiring external database or server infrastructure during development.


✨ Key Features

The primary focus of gamehub is delivering a seamless, feature-rich, and high-performance digital shopping experience. Every feature is designed to empower users and streamline administrative tasks.

🛒 Comprehensive User E-commerce Workflow

gamehub implements the full lifecycle of a digital purchase, ensuring users have control and clarity at every step:

  • Product Discovery: Users can browse products (Products.jsx) and view extensive details on individual items (ProductDetails.jsx).
  • Persistent Shopping Cart Management: The CartContext ensures users can add, remove, and update quantities of items efficiently. Changes persist across sessions for a reliable shopping experience.
  • Wishlist Functionality: Users can save items for later using the Wishlist.jsx page and the centralized WishlistContext, enhancing long-term engagement.
  • Multi-Step Checkout Flow: A dedicated PaymentMethods component directory (PaymentPage.jsx, AddressSection.jsx, PaymentFormSection.jsx, OrderSummary.jsx) simulates a professional, structured payment and order review process.
  • Order Confirmation: Clear feedback and final details provided via OrderConfirmation.jsx, completing the transaction loop.

🔒 Robust User Authentication and Profile Management

Security and personalization are handled via dedicated sections, ensuring private user data is managed effectively:

  • Modular Authentication: Separate Login.jsx and Signup.jsx pages handle user entry, backed by the central AuthContext for global session management.
  • User Profile Access: A dedicated Profile.jsx page allows users to view and potentially manage their personal details and order history.

⚙️ Dedicated Administrative Control Panel

The entire e-commerce operation is manageable through a secure, protected administrative portal, accessible only via a ProtectedAdminRoute.jsx:

  • Centralized Dashboard: AdminDashboard.jsx provides high-level overviews, likely utilizing the integrated recharts dependency for data visualization.
  • Product Management: Admins can effortlessly list (AdminProducts.jsx) and create new digital items (AdminAddProducts.jsx), enabling rapid catalog expansion.
  • Order and User Management: Dedicated views for viewing all orders (AdminOrders.jsx) and managing user accounts (AdminUserDetails.jsx).
  • Utility Components: Includes specialized admin tools like SearchBar.jsx and Switches.jsx for efficient data filtering and status toggling within the admin views.

⚡ Enhanced Performance and Visual Appeal

The frontend stack is optimized for speed and a superior aesthetic presentation:

  • Fluid Interactions: Integration of advanced animation libraries like framer-motion and @react-spring/web ensures smooth transitions and highly engaging interactive elements.
  • Modern Design System: Leveraging @mui/material and tailwindcss (configured via tailwind.config.js) provides access to a comprehensive, customizable, and professionally designed UI component library.
  • Rich Media Handling: The inclusion of swiper allows for powerful, modern carousels and sliders, essential for presenting game screenshots or product previews effectively.
  • Professional Typography: Utilizing @fontsource/orbitron indicates a focus on specific, high-quality, genre-appropriate typography suitable for a gaming storefront.

🛠️ Tech Stack & Architecture

gamehub is built on a foundation of modern, industry-leading technologies, ensuring high performance, scalability, and developer experience.

Technology Category Purpose Why it was Chosen
React Frontend Framework The primary library for building the interactive, component-based user interface. Chosen for its declarative views, strong ecosystem, virtual DOM for performance, and ability to handle complex state management necessary for e-commerce.
Vite Build Tool Used for lightning-fast module bundling, development server startup, and optimized production builds. Provides a next-generation frontend toolchain that significantly improves the developer experience and hot-module replacement speeds.
Component-based Architecture Architecture Pattern Structural approach that divides the UI into reusable, self-contained components. Essential for managing the complexity of a large application like a digital storefront, ensuring high code reusability (e.g., Logo.jsx) and easy maintenance.
React Router DOM Routing Manages client-side routing, enabling navigation between Home, Products, Profile, and the protected Admin pages. Provides dynamic, powerful routing capabilities necessary for a Single Page Application (SPA) with distinct user journeys.
json-server Data Simulation (Local) Used via the npm run server script to simulate a full REST API, reading and writing data to db.json. Crucial for rapid local development, allowing the frontend to fully function and interact with simulated persistent data without needing a full external backend.
Framer Motion UI/UX Library Provides high-performance, production-ready declarative animations and gestures. Used to create polished, modern, and engaging user interactions, enhancing the overall visual experience of the storefront.
Material UI (MUI) UI Component Library Provides pre-built, accessible, and customizable React components based on Material Design principles. Accelerates UI development and ensures consistent, professional design across all pages (Auth, Main, Admin).

📁 Project Structure

The project employs a highly organized, modular structure designed for clarity, scalability, and separation of concerns across user-facing, administrative, and core service layers.

📂 naheel0-gamehub-73c98d0/
├── 📄 README.md
└── 📂 project/                                     # Root application directory
    ├── 📄 index.html                               # Main HTML entry point
    ├── 📄 package.json                             # Project dependencies and scripts
    ├── 📄 db.json                                  # Local data store used by json-server
    ├── 📄 vite.config.js                           # Vite build configuration
    ├── 📄 tailwind.config.js                       # Tailwind CSS configuration
    ├── 📄 vercel.json                              # Vercel deployment configuration
    ├── 📄 .gitignore
    ├── 📄 package-lock.json
    ├── 📄 eslint.config.js
    └── 📂 src/                                     # Source code core directory
        ├── 📄 main.jsx                             # Application entry point (React renderer)
        ├── 📄 App.jsx                              # Root component for routing and layout
        ├── 📂 contexts/                            # Centralized application state management
        │   ├── 📄 WishlistContext.jsx              # Context for managing user wish list state
        │   ├── 📄 CartContext.jsx                  # Context for managing shopping cart state
        │   └── 📄 AuthContext.jsx                  # Context for managing user authentication state
        ├── 📂 styles/                              # Global styling definitions
        │   └── 📄 index.css                        # Main CSS file
        ├── 📂 assets/                              # Static assets storage
        │   └── 📄 favicon.svg                      # Application icon
        ├── 📂 Services/                            # External service interactions (e.g., API calls)
        │   └── 📄 api.jsx                          # Centralized API service wrapper
        ├── 📂 components/                          # Reusable UI components
        │   ├── 📂 common/
        │   │   └── 📄 Logo.jsx                     # Simple, reusable logo component
        │   ├── 📂 PaymentMethods/                  # Specialized components for the checkout flow
        │   │   ├── 📄 PaymentPage.jsx              # The main view for payment details
        │   │   ├── 📄 OrderSummary.jsx             # Component for displaying final order costs
        │   │   ├── 📄 AddressSection.jsx           # Component for capturing user address details
        │   │   └── 📄 PaymentFormSection.jsx       # Component for handling payment input forms
        │   └── 📂 layout/                          # Structural components applied across pages
        │       ├── 📄 Contact.jsx                  # Contact information or modal
        │       ├── 📄 Footer.jsx                   # Global application footer
        │       └── 📄 NavBar.jsx                   # Main navigation bar component
        └── 📂 pages/                               # High-level page components mapped to routes
            ├── 📂 Main/                            # Core user-facing e-commerce pages
            │   ├── 📄 ProductDetails.jsx           # Detailed view for a single product
            │   ├── 📄 Wishlist.jsx                 # Page displaying the user's saved items
            │   ├── 📄 Home.jsx                     # Landing page/main feed
            │   ├── 📄 OrderConfirmation.jsx        # Post-checkout success page
            │   ├── 📄 Products.jsx                 # Product listing and filtering page
            │   ├── 📄 About.jsx                    # Information about the company/project
            │   ├── 📄 Cart.jsx                     # Shopping cart review page
            │   └── 📄 Profile.jsx                  # User account and settings page
            ├── 📂 Auth/                            # Authentication-related pages
            │   ├── 📄 Signup.jsx                   # User registration page
            │   └── 📄 Login.jsx                    # User sign-in page
            └── 📂 Admin/                           # Dedicated, protected administrative interface
                ├── 📄 AdminHome.jsx                # Admin portal landing page
                ├── 📄 ProtectedAdminRoute.jsx      # Route wrapper to enforce admin privileges
                ├── 📄 AdminAddProducts.jsx         # Form/page for adding new items
                ├── 📄 AdminProducts.jsx            # List view for managing all products
                ├── 📄 AdminUserDetails.jsx         # Details and management of specific users
                ├── 📄 AdminOrders.jsx              # List and management of all customer orders
                ├── 📄 AdminDashboard.jsx           # High-level analytics and summary view
                ├── 📂 contexts/
                │   └── 📄 AdminContext.jsx         # Context for admin state management
                └── 📂 components/
                    ├── 📄 SearchBar.jsx            # Reusable search bar for admin lists
                    └── 📄 Switches.jsx             # Reusable toggle/switch components for status updates

🚀 Getting Started

To set up and run gamehub locally, you will need to establish both the frontend development server and the mock API server concurrently.

Prerequisites

While no specific environment variables or external API keys were detected, the project relies on a standard Node.js environment due to its heavy reliance on the React and Vite ecosystem.

  • Node.js: A recent stable version of Node.js is required to manage dependencies and run the development scripts.
  • Package Manager: While not explicitly listed in requirements, npm (or an equivalent like Yarn/pnpm) is necessary to install dependencies based on the package.json.

Installation

Follow these steps to get a copy of the project up and running on your local machine.

  1. Clone the Repository:

    git clone [repository-url] naheel0-gamehub
    cd naheel0-gamehub/project
  2. Install Dependencies: Use your preferred package manager to install all required dependencies (listed in package.json):

    npm install
    # OR
    yarn install

Running the Application (Dual Server Setup)

gamehub requires two concurrent processes to run: the Vite frontend development server and the JSON mock API server (json-server) that reads data from db.json.

  1. Start the Mock API Server: Open the first terminal window and execute the dedicated server script. This server will provide product, user, and order data via a RESTful interface, reading from db.json and listening on port 3001.

    npm run server
    # Server will start on http://localhost:3001
  2. Start the Frontend Development Server: Open a second terminal window (keep the first one running) and start the Vite development server.

    npm run dev
    # Frontend will start on http://localhost:5173 (or similar port)

The application will now be running and connected to the local mock data source, allowing full interactive testing of the e-commerce flow.


🔧 Usage

gamehub functions as a full-featured web application (web_app) offering distinct user journeys that mirror a real-world digital storefront.

User Flow (Main Pages)

Once the application is running, users can interact with the core e-commerce features:

  1. Browse and Discover: Navigate to the /products route (Products.jsx) to see the catalog. Use the ProductDetails.jsx page to drill down into specifics of any digital item.
  2. Manage State: Utilize the interactive UI components to add items to the cart (managed by CartContext) or save them to the wishlist (Wishlist.jsx).
  3. Authentication: Access the Login.jsx or Signup.jsx pages to create or retrieve a session (managed by AuthContext). This enables access to personalized features like the Profile.jsx page.
  4. Checkout Simulation: Proceed to the cart (Cart.jsx) and follow the multi-step process defined in the PaymentMethods components, culminating in the OrderConfirmation.jsx page.

Administrative Usage

The administrative functionalities are isolated and designed for content management:

  1. Access the Admin Portal: Navigate to the admin routes. Access is guarded by the ProtectedAdminRoute.jsx, requiring administrator privileges (simulated via the mock API or context).
  2. View Dashboard: AdminDashboard.jsx provides key metrics, likely utilizing the recharts library for data visualization based on the contents of db.json.
  3. Manage Catalog: Use AdminProducts.jsx to list and modify existing items, or AdminAddProducts.jsx to introduce new digital products to the storefront.
  4. Oversee Operations: Review customer activity, including managing user details (AdminUserDetails.jsx) and processing or tracking orders (AdminOrders.jsx).

🤝 Contributing

We welcome contributions to improve gamehub! Your input helps make this project better for everyone, whether it’s through reporting bugs, suggesting new features, or submitting code changes.

How to Contribute

  1. Fork the repository - Click the 'Fork' button at the top right of this page.
  2. Create a feature branch
    git checkout -b feature/new-payment-integration
  3. Make your changes - Improve code, documentation, or features. Ensure you run both the dev and server scripts locally to test your changes against the mock data.
  4. Test thoroughly - Verify that all integrated features (like Cart and Auth contexts) function as expected after your changes.
    # While no dedicated 'test' script was detected, manually verify all flows:
    npm run dev 
    npm run server
  5. Commit your changes - Write clear, descriptive commit messages following conventional guidelines (e.g., Feat:, Fix:, Refactor:).
    git commit -m 'Feat: Added new sorting logic to AdminProducts view'
  6. Push to your branch
    git push origin feature/new-payment-integration
  7. Open a Pull Request - Submit your changes for review against the main branch.

Development Guidelines

  • ✅ Follow the existing code style and conventions, particularly around component organization and context usage.
  • 📝 Add comments for complex logic, especially within context files (CartContext.jsx, etc.).
  • 📚 Update documentation (including this README, if relevant) for any changed functionality or scripts.
  • 🔄 Ensure backward compatibility with the existing component structure and data format in db.json.
  • 🎯 Keep commits focused and atomic, addressing only one feature or bug fix per pull request.

Ideas for Contributions

We're looking for help with improvements in the following areas:

  • 🐛 Bug Fixes: Report and fix bugs related to state transitions in the cart or wishlist.
  • New Features: Implement advanced filters for the Products.jsx page or new components for the AdminDashboard.jsx.
  • 📖 Documentation: Improve component documentation within the source files.
  • 🎨 UI/UX: Enhance the visual design, especially using the existing framer-motion or MUI dependencies to polish transitions.
  • Performance: Optimize rendering of large lists in the AdminProducts.jsx view.
  • Accessibility: Enhance keyboard navigation and screen reader compatibility across key user flows.

Code Review Process

  • All submissions require review by maintainers before merging.
  • Maintainers will provide constructive feedback focusing on architecture, performance, and adherence to the React component model.
  • Changes may be requested before approval to ensure code quality standards are met.
  • Once approved, your PR will be merged and you'll be credited in the release notes.

Questions?

Feel free to open an issue for any questions or concerns regarding development, feature requests, or architecture. We're here to help!

📝 License

This project is licensed under the MIT License - see the LICENSE file for complete details.

What this means:

  • Commercial use: You can use this project commercially.
  • Modification: You can modify the code to fit your specific needs.
  • Distribution: You can distribute this software.
  • Private use: You can use this project privately.
  • ⚠️ Liability: The software is provided "as is", without warranty of any kind.
  • ⚠️ Trademark: This license does not grant rights to use the project's name or logo.

Made with ❤️ by the gamehub Team

⬆️ Back to Top


About

Game Hub — a React-based e-commerce web app for browsing and purchasing games with a modern, responsive UI.

Topics

Resources

Stars

Watchers

Forks

Languages