Coupon-Finder

Coupon Finder Web App

This project is a small coupon finder web app with:

Users type a company or store name, and the app:

The app does not attempt checkout and does not brute-force codes.

Current Status

This version is now using live public-page search instead of mock-only data.

Important caveats:

The backend is built to handle these cases and return warnings when live sources are weak or blocked.

Project Structure

backend/
  app.py
  search_sources.py
  extract_codes.py
  rank_codes.py

frontend/
  index.html
  style.css
  script.js

Requirements

Install dependencies:

python -m pip install -r requirements.txt

Run Locally

  1. Start the Flask backend:
python backend/app.py
  1. Open the frontend:

Open frontend/index.html in your browser.

The frontend expects the backend API at:

http://127.0.0.1:5000

API

GET /api/health

Simple health check.

Example:

http://127.0.0.1:5000/api/health

GET /api/search?store=<name>

Searches live public coupon-related pages for the given store.

Example:

http://127.0.0.1:5000/api/search?store=The%20IT%20Bay

Example response shape:

{
  "store": "The IT Bay",
  "warning_count": 1,
  "warnings": [
    "Direct coupon source fallback did not find any usable pages."
  ],
  "result_count": 2,
  "results": [
    {
      "code": "TRS3",
      "score": 16,
      "source_count": 2,
      "summary": "3% off",
      "sources": [
        {
          "title": "The IT Bay Coupon Codes",
          "url": "https://example.com/page",
          "context": "The IT Bay coupons. Get code TRS3 for 3% off any order..."
        }
      ]
    }
  ]
}

UI Features

Search Behavior

The backend currently:

It also handles common user mistakes such as:

Known Limits

Example Store

During testing, live public pages for The IT Bay surfaced listings that mentioned codes such as:

Those came from public coupon pages such as:

That does not guarantee a code still works at checkout, only that it appears on public source pages.

Deploy Direction

This structure is suitable for:

For deployment, you will usually want to:

  1. host the Flask backend separately
  2. set window.COUPON_API_BASE_URL in the frontend to your deployed API URL

Next Improvements

Good next steps would be:

  1. add a backend debug endpoint to inspect raw fetched sources
  2. improve regex extraction for more coupon-site formats
  3. add tests for ranking and extraction
  4. add deployment instructions for GitHub Pages and Render