Skip to content

Support pluggable barcode lookup drivers #13

Description

@jpdevries

Summary

Add a driver/adapter pattern for barcode lookup so users can choose which API powers their barcode scanner. Currently hardcoded to Open Food Facts.

Motivation

Open Food Facts is great for groceries but has gaps for non-food household items. A pluggable driver system would let users configure alternative APIs based on their needs.

Proposed drivers

  • Open Food Facts (default, current) — free, open source, food-focused
  • Barcode Lookup — broader product coverage (see #$NEXT)

Design

An env var like BARCODE_DRIVER=openfoodfacts selects the active driver. Each driver implements a common interface:

interface BarcodeLookupDriver {
  lookup(barcode: string): Promise<BarcodeLookupResult | null>;
}

The existing Open Food Facts logic in packages/app/pages/api/lookup-barcode.ts becomes the first driver.

References

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions