Lead Auction and Matching System Enhancement
Budget: $250 – $750 USD
Agents make requests for clients, and providers bid on those leads in a timed auction. After payment is collected, the winning provider receives the lead.
The system also allows manual matches.
The core stack:
Frontend: React (via Lovable-generated code)
Backend: Supabase (PostgreSQL + Edge Functions)
Authentication: Supabase Auth
Database Policies: Row-Level Security (RLS) with roles (admin, provider, etc.)
WHAT'S ALREADY BUILT
Housing Request Form (Multi-step) – UI mostly complete, some validation/submission bugs remain
Leads Table – Receives data from form
Auction System
Start bid, current bid, bid expiration, and payment integration
Manual bids and auto-bids enabled
Matching System
Admins can manually match a provider to a lead (but needs polish)
lead_matches table created to track match history
ManualMatchModal – Functional but needs multi-provider support and full confirmation flow
Notifications System – Partially implemented (provider notifications on win, etc.)
Edge Functions – submit-bid, validate-auction-payment, etc.
Admin Dashboard – Displays metrics, pending leads, etc.
WHAT’S BROKEN OR MISSING
Form Submission (Housing Request Page)
Validation errors for fields like paroleDate (Date vs String)
Case ID trigger was misconfigured (case_id column ambiguity)
No consistent submission success logs
Form sometimes disappears due to renderStep() logic
Matching Logic
Manual matching fails when trying to insert into lead_matches (RLS or constraints)
Matching UI doesn't allow selecting multiple providers
No auto-matching algorithm (this can wait)
Notifications
RLS on notifications blocks inserts from Edge Functions or Admin actions
Auction Flow
Need to confirm: after payment, is lead marked as "matched"? Is the provider notified?
No proper match_completed state or audit trail
Winning bid sometimes isn’t linked to matched provider
THE DEVELOPER I NEED SHOULD BE ABLE TO:
Debug and fix Supabase RLS policies
Understand and extend Edge Functions in Supabase
Work in React/TypeScript (Lovable-generated)
Handle controlled forms and validation (Zod, React Hook Form, etc.)
Clean up database triggers and functions (e.g., case ID generation)
Add missing logic in the submit-bid, validate-auction-payment, and ManualMatchModal
Ensure data integrity between leads, lead_matches, and notifications tables
Implement clean error handling and logging
END GOAL (DEFINITION OF DONE)
The entire system should:
Allow social workers to submit complete housing requests
Automatically generate a case ID for each request
Display the request in admin dashboard and open for bidding
Allow providers to bid (manual or auto)
On winning, payment is collected, lead is locked, and provider is notified
Admin can also manually match a provider at any time, even if bidding hasn’t started
All events are logged (e.g., bids, matches, errors, notifications)
Admin dashboard shows system status, pending requests, match history, and test tools
All RLS policies are correctly applied to allow proper permissions
SAMPLE TASK LIST (FIRST 5 TASKS)
Fix housing request form submission (validation, case ID, calendar input, onSubmit trigger)
Review and finalize all RLS policies for lead_matches, notifications, leads
Fix ManualMatchModal to allow multi-provider selection and insert matches properly
Confirm auction-payment validation inserts matched provider and triggers notifications
Create admin-facing match history log (lead → provider → date → match type)
HANDOFF NOTES:
The codebase was scaffolded by Lovable AI, so some component logic may feel machine-generated. You’re expected to polish and extend it, not just patch over errors.
I have Supabase roles set up for admin, provider, and user.
I can provide access credentials, schema diagrams, and Supabase Studio access.
The system also allows manual matches.
The core stack:
Frontend: React (via Lovable-generated code)
Backend: Supabase (PostgreSQL + Edge Functions)
Authentication: Supabase Auth
Database Policies: Row-Level Security (RLS) with roles (admin, provider, etc.)
WHAT'S ALREADY BUILT
Housing Request Form (Multi-step) – UI mostly complete, some validation/submission bugs remain
Leads Table – Receives data from form
Auction System
Start bid, current bid, bid expiration, and payment integration
Manual bids and auto-bids enabled
Matching System
Admins can manually match a provider to a lead (but needs polish)
lead_matches table created to track match history
ManualMatchModal – Functional but needs multi-provider support and full confirmation flow
Notifications System – Partially implemented (provider notifications on win, etc.)
Edge Functions – submit-bid, validate-auction-payment, etc.
Admin Dashboard – Displays metrics, pending leads, etc.
WHAT’S BROKEN OR MISSING
Form Submission (Housing Request Page)
Validation errors for fields like paroleDate (Date vs String)
Case ID trigger was misconfigured (case_id column ambiguity)
No consistent submission success logs
Form sometimes disappears due to renderStep() logic
Matching Logic
Manual matching fails when trying to insert into lead_matches (RLS or constraints)
Matching UI doesn't allow selecting multiple providers
No auto-matching algorithm (this can wait)
Notifications
RLS on notifications blocks inserts from Edge Functions or Admin actions
Auction Flow
Need to confirm: after payment, is lead marked as "matched"? Is the provider notified?
No proper match_completed state or audit trail
Winning bid sometimes isn’t linked to matched provider
THE DEVELOPER I NEED SHOULD BE ABLE TO:
Debug and fix Supabase RLS policies
Understand and extend Edge Functions in Supabase
Work in React/TypeScript (Lovable-generated)
Handle controlled forms and validation (Zod, React Hook Form, etc.)
Clean up database triggers and functions (e.g., case ID generation)
Add missing logic in the submit-bid, validate-auction-payment, and ManualMatchModal
Ensure data integrity between leads, lead_matches, and notifications tables
Implement clean error handling and logging
END GOAL (DEFINITION OF DONE)
The entire system should:
Allow social workers to submit complete housing requests
Automatically generate a case ID for each request
Display the request in admin dashboard and open for bidding
Allow providers to bid (manual or auto)
On winning, payment is collected, lead is locked, and provider is notified
Admin can also manually match a provider at any time, even if bidding hasn’t started
All events are logged (e.g., bids, matches, errors, notifications)
Admin dashboard shows system status, pending requests, match history, and test tools
All RLS policies are correctly applied to allow proper permissions
SAMPLE TASK LIST (FIRST 5 TASKS)
Fix housing request form submission (validation, case ID, calendar input, onSubmit trigger)
Review and finalize all RLS policies for lead_matches, notifications, leads
Fix ManualMatchModal to allow multi-provider selection and insert matches properly
Confirm auction-payment validation inserts matched provider and triggers notifications
Create admin-facing match history log (lead → provider → date → match type)
HANDOFF NOTES:
The codebase was scaffolded by Lovable AI, so some component logic may feel machine-generated. You’re expected to polish and extend it, not just patch over errors.
I have Supabase roles set up for admin, provider, and user.
I can provide access credentials, schema diagrams, and Supabase Studio access.
Related categories:
PHP
JavaScript
Magento
MySQL
PostgreSQL
Backend Development
Frontend Development
Database Management