Week 3: Open Food Facts integration (Edge Function) #5

Closed
opened 2026-02-08 19:01:10 +00:00 by makiolaj · 0 comments
Owner

Phase: Week 3 - Barcode Scanning

Task

Create Edge Function to fetch product data from Open Food Facts with caching.

Acceptance Criteria

  • Edge function created: product-lookup
  • Validates barcode format (8-13 digits)
  • Checks cache (products table) first
  • Fetches from Open Food Facts API if not cached
  • Parses response (name, brand, image, categories)
  • Caches product in database
  • Returns product data
  • Error handling (invalid barcode, not found, API error)
  • TypeScript types defined

Technical Details

Resources

  • docs/API.md (product-lookup spec)
  • Open Food Facts API docs

Estimated Effort

2 days

**Phase:** Week 3 - Barcode Scanning ## Task Create Edge Function to fetch product data from Open Food Facts with caching. ## Acceptance Criteria - [ ] Edge function created: product-lookup - [ ] Validates barcode format (8-13 digits) - [ ] Checks cache (products table) first - [ ] Fetches from Open Food Facts API if not cached - [ ] Parses response (name, brand, image, categories) - [ ] Caches product in database - [ ] Returns product data - [ ] Error handling (invalid barcode, not found, API error) - [ ] TypeScript types defined ## Technical Details - supabase/functions/product-lookup/ - Uses Deno runtime - Supabase client for DB access - Open Food Facts API: https://world.openfoodfacts.org/api/v2/product/{barcode}.json ## Resources - docs/API.md (product-lookup spec) - Open Food Facts API docs ## Estimated Effort 2 days
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: pantry-app/pantry#5