How can I implement real-time matching between customers and nearby handymen?

I’m building a handyman app where customers can request services such as plumbing, electrical work, and repairs. I need to match each request with nearby available handymen based on location and service type.

What is a good way to implement the matching and real-time status updates using a backend API and database?

You’ll need to have the tradesperson update their status to say when they’re free, and where they are, and again when they’re not free. Once you’ve got that, the searching part is pretty simple - match the trade and calculate the distance from the enquirer.

I think the availability part is especially important here. I would probably keep the matching logic separate from the real time status layer, so a request can first filter by service type and availability, then rank the remaining handymen by distance.

For the location side, storing coordinates and using a database query for nearby providers should scale better than calculating the distance against every provider in application code. It also gives you more flexibility later if you want to add things like service radius, response time, or current workload.

For real time updates, I would also make the provider status explicit, such as available, assigned, busy, or offline. That makes it easier to avoid offering the same person to multiple customers at the same time.

The basic flow could be request created → filter by service and availability → find nearby providers → send the request → lock the provider once accepted → update both sides in real time.

That seems like a good foundation before adding more advanced matching rules.

I suspect your problem is going to be more in getting the data than how to use it…

1 Like

Use geospatial queries to match available handymen by location and service type, with PostgreSQL/PostGIS being a solid choice.
For real-time job status updates, use WebSockets/Socket.IO so customers and handymen receive instant updates.

If your app will be making the appointments then I think you will be having big problems you do not anticipate. Not technical problems. Your application might work very well until it gets big. Then managing all the calls will likely be overwhelming.

About a year ago Costco was doing something like that. I needed to get the appointment changed and I could not get in touch with a real person. I needed 2 TVs mounted, each in a different room. They created appointments for 2 people to do the work but it would have been more efficient to assign one person. I suppose that will be less of a problem if you design the application to be more reasonable.

You have not made it clear whether you intend to handle the appointments. There are services such as HomeAdvisor and Angi (Angie’s List) that will match customers with service companies. Competing with them will be difficult. For a local service you might be able to determine who provides good service and who does not but when that grows it will be difficult.