# harshraj001/price-prawl architecture

> Architecture diagram of the GitHub repository harshraj001/price-prawl, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harshraj001/price-prawl
- Repository: https://github.com/harshraj001/price-prawl

## Overview

##### Project type and purpose
- PricePrawl is a full-stack, PHP-based web application for tracking product prices across multiple e-commerce sites, storing historical price data, and sending email alerts when prices drop.

##### File structure
- Top-level PHP pages (e.g., index.php, product.php, search.php, wishlist.php) act as controllers/views.
- The includes/ folder holds shared code: config.php (app settings), db_connect.php (DB access), auth_check.php (auth middleware), activity_logger.php, header/footer templates.
- js/ and css/ folders contain client-side scripts (navigation.js, wishlist.js, product-data-parser.js) and styles (dark-mode.css, loader.css).
- Vendor/ includes PHPMailer and any other composer-managed libraries.
- SQL schema defines MySQL tables for users, price_history, alerts, wishlist, tokens, etc.

##### README for additional insights
- Technologies: Frontend (HTML, JS, Tailwind CSS, Alpine.js, Highcharts), Backend (PHP 7.4+), Database (MySQL), Email (PHPMailer), External API (BuyHatke).
- Features: user registration/OTP, product search, wishlist, price-drop alerts, historical charts.
- Integration points: URL processor, product parser, external price API.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        Browser["Client Browser"]:::frontend
        CSSAssets["CSS/JS Assets"]:::frontend
    end

    %% Application Layer
    subgraph "Application Layer"
        subgraph "Controllers"
            index["index.php"]:::backend
            product["product.php"]:::backend
            priceDrops["price-drops.php"]:::backend
            trending["trending.php"]:::backend
            account["account.php"]:::backend
            updateProfile["update_profile.php"]:::backend
            privacy["privacy-policy.php"]:::backend
            cookie["cookie-policy.php"]:::backend
            terms["terms-of-service.php"]:::backend
            searchPage["search.php"]:::backend
            wishlistPage["wishlist.php"]:::backend
        end

        subgraph "AJAX Endpoints"
            searchProc["search_processor.php"]:::backend
            searchFuncs["search_functions.php"]:::backend
            supportedSites["supported-sites.php"]:::backend
            wishlistAct["wishlist_actions.php"]:::backend
            removeWish["remove_from_wishlist.php"]:::backend
            alertAct["alert_actions.php"]:::backend
            toggleAlert["toggle_alert.php"]:::backend
            deleteAlert["delete_alert.php"]:::backend
            urlProc["url_processor.php"]:::backend
            shortUrl["short_url_resolver.php"]:::backend
        end

        subgraph "Authentication Module"
            authCheck["includes/auth_check.php"]:::backend
            register["register.php"]:::backend
            registerProc["register_process.php"]:::backend
            login["login.php"]:::backend
            loginProc["login_process.php"]:::backend
            logout["logout.php"]:::backend
            forgot["forgot-password.php"]:::backend
            forgotProc["forgot_password_process.php"]:::backend
            reset["reset_password.php"]:::backend
            resetProc["reset_password_process.php"]:::backend
            resend["resend_otp.php"]:::backend
            verify["verify_otp.php"]:::backend
            verifyProc["verify_otp_process.php"]:::backend
        end

        subgraph "Shared Includes"
            config["includes/config.php"]:::backend
            dbConnect["includes/db_connect.php"]:::backend
            headerTpl["includes/header.php"]:::backend
            footerTpl["includes/footer.php"]:::backend
            logger["includes/activity_logger.php"]:::backend
            activityPage["activity.php"]:::backend
        end
    end

    %% Data and External Services
    DB["MySQL Database"]:::database
    externalAPI["BuyHatke API"]:::external
    SMTP["SMTP Server (PHPMailer)"]:::external

    %% Connections
    Browser -->|HTTP GET/POST| index
    Browser -->|HTTP GET/POST| product
    Browser -->|HTTP GET/POST| priceDrops
    Browser -->|HTTP GET/POST| trending
    Browser -->|HTTP GET/POST| account
    Browser -->|HTTP GET/POST| updateProfile
    Browser -->|HTTP GET/POST| privacy
    Browser -->|HTTP GET/POST| cookie
    Browser -->|HTTP GET/POST| terms
    Browser -->|HTTP GET/POST| searchPage
    Browser -->|HTTP GET/POST| wishlistPage

    Browser -->|AJAX| searchProc
    Browser -->|AJAX| wishlistAct
    Browser -->|AJAX| alertAct

    CSSAssets --> Browser

    %% Application to Database
    dbConnect -->|SQL Queries| DB

    %% Application to External Services
    urlProc -->|HTTP Requests| externalAPI
    registerProc -->|Send OTP Email| SMTP
    alertAct -->|Send Alert Email| SMTP

    %% AJAX JSON Responses
    searchProc -->|JSON price data| Browser

    %% Click Events
    click config "https://github.com/harshraj001/price-prawl/blob/main/includes/config.php"
    click dbConnect "https://github.com/harshraj001/price-prawl/blob/main/includes/db_connect.php"
    click authCheck "https://github.com/harshraj001/price-prawl/blob/main/includes/auth_check.php"
    click register "https://github.com/harshraj001/price-prawl/blob/main/register.php"
    click registerProc "https://github.com/harshraj001/price-prawl/blob/main/register_process.php"
    click login "https://github.com/harshraj001/price-prawl/blob/main/login.php"
    click loginProc "https://github.com/harshraj001/price-prawl/blob/main/login_process.php"
    click logout "https://github.com/harshraj001/price-prawl/blob/main/logout.php"
    click forgot "https://github.com/harshraj001/price-prawl/blob/main/forgot-password.php"
    click forgotProc "https://github.com/harshraj001/price-prawl/blob/main/forgot_password_process.php"
    click reset "https://github.com/harshraj001/price-prawl/blob/main/reset_password.php"
    click resetProc "https://github.com/harshraj001/price-prawl/blob/main/reset_password_process.php"
    click resend "https://github.com/harshraj001/price-prawl/blob/main/resend_otp.php"
    click verify "https://github.com/harshraj001/price-prawl/blob/main/verify_otp.php"
    click verifyProc "https://github.com/harshraj001/price-prawl/blob/main/verify_otp_process.php"
    click headerTpl "https://github.com/harshraj001/price-prawl/blob/main/includes/header.php"
    click footerTpl "https://github.com/harshraj001/price-prawl/blob/main/includes/footer.php"
    click logger "https://github.com/harshraj001/price-prawl/blob/main/includes/activity_logger.php"
    click activityPage "https://github.com/harshraj001/price-prawl/blob/main/activity.php"
    click index "https://github.com/harshraj001/price-prawl/blob/main/index.php"
    click product "https://github.com/harshraj001/price-prawl/blob/main/product.php"
    click priceDrops "https://github.com/harshraj001/price-prawl/blob/main/price-drops.php"
    click trending "https://github.com/harshraj001/price-prawl/blob/main/trending.php"
    click account "https://github.com/harshraj001/price-prawl/blob/main/account.php"
    click updateProfile "https://github.com/harshraj001/price-prawl/blob/main/update_profile.php"
    click privacy "https://github.com/harshraj001/price-prawl/blob/main/privacy-policy.php"
    click cookie "https://github.com/harshraj001/price-prawl/blob/main/cookie-policy.php"
    click terms "https://github.com/harshraj001/price-prawl/blob/main/terms-of-service.php"
    click searchPage "https://github.com/harshraj001/price-prawl/blob/main/search.php"
    click searchProc "https://github.com/harshraj001/price-prawl/blob/main/search_processor.php"
    click searchFuncs "https://github.com/harshraj001/price-prawl/blob/main/search_functions.php"
    click supportedSites "https://github.com/harshraj001/price-prawl/blob/main/supported-sites.php"
    click wishlistPage "https://github.com/harshraj001/price-prawl/blob/main/wishlist.php"
    click wishlistAct "https://github.com/harshraj001/price-prawl/blob/main/wishlist_actions.php"
    click removeWish "https://github.com/harshraj001/price-prawl/blob/main/remove_from_wishlist.php"
    click alertAct "https://github.com/harshraj001/price-prawl/blob/main/alert_actions.php"
    click toggleAlert "https://github.com/harshraj001/price-prawl/blob/main/toggle_alert.php"
    click deleteAlert "https://github.com/harshraj001/price-prawl/blob/main/delete_alert.php"
    click urlProc "https://github.com/harshraj001/price-prawl/blob/main/url_processor.php"
    click shortUrl "https://github.com/harshraj001/price-prawl/blob/main/short_url_resolver.php"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#000,stroke-width:1px
    classDef database fill:#FFA500,stroke:#000,stroke-width:1px
    classDef external fill:#DDA0DD,stroke:#000,stroke-width:1px
```
