Skip to content

Migrate enrichment from backend to Supabase edge function#2853

Open
malek10xdev wants to merge 5 commits into
mainfrom
feat/enrich-edge-function
Open

Migrate enrichment from backend to Supabase edge function#2853
malek10xdev wants to merge 5 commits into
mainfrom
feat/enrich-edge-function

Conversation

@malek10xdev

Copy link
Copy Markdown
Collaborator

Summary

Migrate the contact enrichment service from the Node.js backend (controllers, routes, enrichment engines) to a new supabase/functions/enrich edge function. This reduces backend surface area and moves enrichment logic closer to Supabase.

Changes

  • feat: Add supabase/functions/enrich edge function with three endpoints:
    • POST /enrich/person - single contact enrichment with cache check, credit validation, task tracking, and result storage
    • POST /enrich/person/bulk - bulk enrichment with cache hits, credit-limited processing, and progress tracking
    • POST /enrich/webhook/:id - async webhook for third-party enrichment engine results
  • feat: Migrate EnrichButton.vue frontend component to call supabase.functions.invoke instead of `` backend calls
  • chore: Remove deprecated backend enrichment controllers, routes, and services (enrich-layer, thedig, voilanorbert engines) + their unit tests

Testing

  • 539 backend unit tests pass (8 enrichment test suites removed with their deleted source code)
  • Pre-push hooks: backend lint, frontend lint, prettier — all clean

Add a new Supabase Edge Function for contact enrichment that:
- POST /enrich/person - enrich a single contact with cache check,
  credit validation, task tracking, and result storage
- POST /enrich/person/bulk - bulk enrich contacts with cache,
  credit limits, and progress tracking
- POST /enrich/webhook/:id - async webhook handler for 3rd-party
  enrichment engine results
- Uses Hono framework, structured logging, i18n support
Replace  backend calls with supabase.functions.invoke for
enrichment endpoints. Adapt response handling to work with the
edge function response format (non-2xx body parsing, status
adaptation).
Remove the old backend enrichment controller, routes, and all
enrichment service implementations (enrich-layer, thedig, voilanorbert).
This functionality has been migrated to the supabase/functions/enrich
edge function.
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

Coverage Report

Passed

Commit: ee066b4

Summary

Name Stmts Branch Funcs Lines
🟡 Total 42.8% 40.8% 48.6% 43.2%
All files
Name Stmts Branch Funcs Lines
🔴 backend/src/app.ts 0% 0% 0% 0%
No coverage changes
Name Stmts Branch Funcs Lines
🔴 backend/src/app.ts 0% 0% 0% 0%

Generated by Test Coverage Reporter for commit ee066b4

The open-source enrich function should not contain billing logic.
Billing (credit validation and deduction) will be added in the
leadminer-commercial repo by overriding this function to call
the billing edge function.

Remove: validate_customer_credits RPC, deduct_customer_credits RPC,
ValidateCreditsResult interface, credits_insufficient i18n keys,
and all credit-related branching logic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant