Skip to content
All builds
Websites

BailiwickService-Area Mapper

What it does for you

Check whether an address is in your service area and what the visit costs.

Draw the zones a local service business covers, set fees and priorities, and test any address or a whole customer list against them.

Bailiwick screenshot

Who it's for

Local businesses that travel to the customer, like a mobile detailer, a cleaner, or a home care agency. It gives the same answer to "do you come out to me?" every time.

Screenshots

Bailiwick screenshot 1

In more detail

Bailiwick is a map for a small local service business, like a mobile detailer, a cleaner, or a home care agency. You draw the areas you serve, set a travel fee for each, and check in one click whether a customer's address is covered and what it costs. It answers "do you come out to me?" with a consistent yes or no instead of a gut call or a zip code guess.

Honest limits

The live Nominatim lookup and the full mouse flows (dragging corners, inserting midpoints) were checked in code review and the headless demo, not in a real user session. Zones are straight-line shapes, not drive time, which is not how a detailer or caregiver really prices. It runs and the geometry is well tested; the interaction layer has not had real hands on it.

How I built it

Claude Code built it across two runs. The first wrote the geometry core and the UI, then stalled on the dropping API stream and left em dashes in the README and case study template, which failed 2 verify checks. The second run kept every existing module, rewrote the docs in small writes, retook both screenshots, and got verify green. That finishing run was about 0.3 hours.

All the geometry lives in one DOM-free module, geo.js: ray-casting point in polygon with holes, haversine and point-to-segment edge distance, spherical area, and Douglas-Peucker simplify. Claude Code wrote it and its assertion suite first, before any UI existed. The page and verify.mjs import the same file unchanged, so the shipped code is the tested code.

The drawing tools are hand-built on raw Leaflet events instead of a draw plugin, with corner dragging and midpoint insert. There are also radius zones, cut-outs for places you do not serve, batch CSV testing, GeoJSON in and out, an embeddable widget, and a share link. I set the framing (a local service business, nothing else), the one-dependency rule (Leaflet 1.9.4), the Nominatim limits (1 request per second, cached), and the demo.

What I learned

  • Point in polygon has real edge cases. A ray that passes exactly through a vertex gets counted twice unless you use a half-open edge rule.
  • Holes are just extra rings that flip the answer, so they cost almost nothing once the ring test is solid.
  • "Distance to the nearest edge" is the number people actually want when an address is outside. Projecting locally to a flat plane to find the closest point, then measuring with haversine, is accurate enough at city scale.
  • A dark map does not need a second tile provider. Inverting and hue-rotating only the tile pane keeps the zone colors true.
  • Small modules and small writes let a stalled build be finished instead of redone, and a tested core made it easy to trust the leftover UI.

What carried forward

This is one of the stalled builds finished on the tiny-writes pattern proven on #31. The shared core pattern (one pure module imported by the page and by verify.mjs) goes back to #9. It is also the second Leaflet map in the list after #14 Map Pin Board, this time with plain OpenStreetMap tiles.

If I took it further

I would add drive-time zones, since travel time is what service businesses actually price by, and then run a real session with the mouse flows.

#037 Built with Claude Code September 23, 2026 453 automated checks

Want one like this?