Track product prices across e-commerce sites and get alerts on price drops. Built with Next.js, Firecrawl, and Supabase.
- π Track Any Product - Works with Amazon, Zara, Walmart, and more
- π Price History Charts - Interactive graphs showing price trends over time
- π Google Authentication - Secure sign-in with Google OAuth
- π Automated Daily Checks - Scheduled cron jobs check prices automatically
- π§ Email Alerts - Get notified when prices drop via Resend
- Next.js 16 - React framework with App Router
- Firecrawl - Web data extraction API
- Handles JavaScript rendering
- Rotating proxies & anti-bot bypass
- Structured data extraction with AI
- Works across different e-commerce sites
- Supabase - Backend platform
- PostgreSQL Database
- Google Authentication
- Row Level Security (RLS)
- pg_cron for scheduled jobs
- Resend - Transactional emails
- shadcn/ui - UI component library
- Recharts - Interactive charts
- Tailwind CSS - Styling
Before you begin, ensure you have:
- Node.js 18+ installed
- A Supabase account
- A Firecrawl account
- A Resend account
- Google OAuth credentials from Google Cloud Console
git clone https://github.com/EzraMalik/DealDrop.git
cd DealDrop
npm install- Create a new project at supabase.com
- Wait for the project to be ready
Go to SQL Editor in your Supabase dashboard and run these migrations:
Migration 1: Database Schema (supabase/migrations/001_schema.sql)
-- Enable UUID extension
create extension if not exists "uuid-ossp";
-- Products table
create table products (
id uuid primary key default uuid_generate_v4(),
user_id uuid references auth.users(id) on delete cascade not null,
url text not null,
name text not null,
current_price numeric(10,2) not null,
currency text not null default 'USD',
image_url text,
created_at timestamp with time zone default now(),
updated_at timestamp with time zone default now()
);
-- Price history table
create table price_history (
id uuid primary key default uuid_generate_v4(),
product_id uuid references products(id) on delete cascade not null,
price numeric(10,2) not null,
currency text not null,
checked_at timestamp with time zone default now()
);
-- Add unique constraint for upsert functionality
ALTER TABLE products
ADD CONSTRAINT products_user_url_unique UNIQUE (user_id, url);
-- Enable Row Level Security
alter table products enable row level security;
alter table price_history enable row level security;
-- Policies for products
create policy "Users can view their own products"
on products for select
using (auth.uid() = user_id);
create policy "Users can insert their own products"
on products for insert
with check (auth.uid() = user_id);
create policy "Users can update their own products"
on products for update
using (auth.uid() = user_id);
create policy "Users can delete their own products"
on products for delete
using (auth.uid() = user_id);
-- Policies for price_history
create policy "Users can view price history for their products"
on price_history for select
using (
exists (
select 1 from products
where products.id = price_history.product_id
and products.user_id = auth.uid()
)
);
-- Indexes for performance
create index products_user_id_idx on products(user_id);
create index price_history_product_id_idx on price_history(product_id);
create index price_history_checked_at_idx on price_history(checked_at desc);Migration 2: Setup Cron Job (supabase/migrations/002_setup_cron.sql)
-- Enable required extensions
CREATE EXTENSION IF NOT EXISTS pg_cron;
CREATE EXTENSION IF NOT EXISTS pg_net;
-- Create function to trigger price check via HTTP
CREATE OR REPLACE FUNCTION trigger_price_check()
RETURNS void
LANGUAGE plpgsql
SECURITY DEFINER
AS $$
BEGIN
PERFORM net.http_post(
url := 'https://your-app-url.vercel.app/api/cron/check-prices',
headers := jsonb_build_object(
'Content-Type', 'application/json',
'Authorization', 'Bearer YOUR_CRON_SECRET_HERE'
)
);
END;
$$;
-- Schedule cron job to run daily at 9 AM UTC
SELECT cron.schedule(
'daily-price-check',
'0 9 * * *',
'SELECT trigger_price_check();'
);Note: Update the URL and Authorization Bearer token in the function after deployment.
- Go to Authentication β Providers in Supabase
- Enable Google provider
- Get OAuth credentials from Google Cloud Console:
- Create a new project or select existing
- Enable Google+ API
- Create OAuth 2.0 credentials
- Add authorized redirect URI:
https://<your-project>.supabase.co/auth/v1/callback
- Copy Client ID and Client Secret to Supabase
- Go to Settings β API
- Copy your Project URL
- Copy your anon/public key
- Copy your service_role key (keep this secret!)
- Sign up at firecrawl.dev
- Go to dashboard and get your API key
- Sign up at resend.com
- Get your API key from the dashboard
- (Optional) Add and verify your domain for custom email addresses
Create .env.local in the root directory:
# Supabase
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
# Firecrawl
FIRECRAWL_API_KEY=your_firecrawl_api_key
# Resend
RESEND_API_KEY=your_resend_api_key
RESEND_FROM_EMAIL=onboarding@resend.dev
# Cron Job Security (generate with: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))")
CRON_SECRET=your_generated_cron_secret
# App URL
NEXT_PUBLIC_APP_URL=http://localhost:3000Generate CRON_SECRET:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"npm run dev-
Install Vercel CLI (optional)
npm install -g vercel
-
Deploy
vercel --prod
Or connect your GitHub repository to Vercel for automatic deployments.
-
Add Environment Variables in Vercel
Go to your project settings and add all variables from
.env.local:NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEYSUPABASE_SERVICE_ROLE_KEYβ οΈ FIRECRAWL_API_KEYRESEND_API_KEYRESEND_FROM_EMAILCRON_SECRETNEXT_PUBLIC_APP_URL(set to your Vercel URL)
-
Update Supabase Cron Function
After deployment, update the cron function with your production URL:
CREATE OR REPLACE FUNCTION trigger_price_check() RETURNS void LANGUAGE plpgsql SECURITY DEFINER AS $$ BEGIN PERFORM net.http_post( url := 'https://your-actual-vercel-url.vercel.app/api/cron/check-prices', headers := jsonb_build_object( 'Content-Type', 'application/json', 'Authorization', 'Bearer your_actual_cron_secret' ) ); END; $$;
-
Update Google OAuth Redirect URI
Add your Vercel domain to Google Cloud Console authorized redirect URIs.
- User adds product - Paste any e-commerce URL on the homepage
- Firecrawl scrapes - Instantly extracts product name, price, currency, and image
- Data stored - Product saved to Supabase with Row Level Security
- View tracking - See current price and interactive price history chart
- Supabase pg_cron - Runs daily at 9 AM UTC
- Triggers API endpoint - Makes secure POST request to
/api/cron/check-prices - Firecrawl scrapes all products - Updates prices for all tracked products
- Updates database - Saves new prices and adds to history if changed
- Sends email alerts - Notifies users via Resend when prices drop
Firecrawl solves the hard problems of web scraping:
- β JavaScript Rendering - Handles dynamic content loaded via JS
- β Anti-bot Bypass - Built-in mechanisms to avoid detection
- β Rotating Proxies - Prevents IP blocking
- β AI-Powered Extraction - Uses prompts to extract structured data
- β Multi-site Support - Same code works across different e-commerce platforms
- β Fast & Reliable - Built for production use
No need to maintain brittle, site-specific scrapers!
dealdrop/
βββ app/
β βββ page.js # Landing page with product input
β βββ actions.js # Server actions for DB operations
β βββ auth/
β β βββ callback/
β β βββ route.js # OAuth callback handler
β βββ api/
β βββ cron/
β βββ check-prices/
β βββ route.js # Cron endpoint for price checks
βββ components/
β βββ ui/ # shadcn/ui components
β βββ AddProductForm.js # Product URL input with auth modal
β βββ ProductCard.js # Product display with chart toggle
β βββ PriceChart.js # Recharts price history
β βββ AuthModal.js # Google sign-in modal
βββ lib/
β βββ firecrawl.js # Firecrawl API integration
β βββ email.js # Resend email templates
β βββ utils.js # Utility functions
βββ utils/
β βββ supabase/
β βββ client.js # Browser Supabase client
β βββ server.js # Server Supabase client
β βββ middleware.js # Session refresh middleware
βββ supabase/
β βββ migrations/
β βββ 001_schema.sql # Database tables & RLS
β βββ 002_setup_cron.sql # Cron job setup
βββ proxy.ts # Next.js 15 proxy (replaces middleware)
βββ .env.local # Environment variables
Customize the email template in lib/email.js - modify HTML, styling, or content.
Update the Firecrawl prompt in lib/firecrawl.js to extract additional fields:
prompt: "Extract product name, price, currency, image URL, brand, rating, and availability";Built with β€οΈ by Abdul using Next.js, Firecrawl, and Supabase