This repository contains Supabase Edge Functions for web scraping and email handling, deployed using GitHub Actions.
The repository includes two main edge functions:
- scrape-reviews: A Deno-based edge function that scrapes TripAdvisor reviews using Playwright and Browserbase, then stores the data in a Supabase database.
- send-email: A simple edge function that processes contact form submissions and sends emails using SendGrid.
- Deno - The JavaScript/TypeScript runtime used for edge functions
- Supabase - Backend-as-a-Service platform for hosting the edge functions
- Playwright - Browser automation library for web scraping
- Browserbase - Headless browser infrastructure for web scraping
- SendGrid - Email delivery service
- GitHub Actions - CI/CD for automatic deployment
This function scrapes TripAdvisor reviews for a specific attraction:
- Uses Playwright with Browserbase for headless browser automation
- Scrapes multiple pages of reviews (configurable)
- Extracts detailed review data including:
- Reviewer information (name, profile, avatar)
- Review content (title, text, rating)
- Metadata (date, trip type, helpful votes)
- Stores the scraped data in a Supabase database table named "reviews"
- Handles pagination and error cases
BROWSERBASE_API_KEY
- API key for BrowserbaseBROWSERBASE_PROJECT_ID
- Project ID for BrowserbaseSUPABASE_URL
- URL of your Supabase projectSUPABASE_ANON_KEY
- Anonymous key for Supabase API access
This function processes contact form submissions:
- Receives form data (name, email, subject, message)
- Forwards the information via SendGrid to a specified email address
- Handles CORS and provides appropriate responses
SENDGRID_API_KEY
- API key for SendGrid email service
The edge functions are automatically deployed to Supabase using GitHub Actions when changes are pushed to the main branch.
The deployment workflow:
- Triggers on push to main branch or manual workflow dispatch
- Sets up the Supabase CLI
- Deploys all functions to the specified Supabase project
SUPABASE_ACCESS_TOKEN
- Access token for SupabasePROJECT_ID
- Supabase project ID