Deal creation app
A multi-tenant HubSpot app that creates a deal, its building and its CompanyCam project from one card, with optional property data and a storm score from NOAA hail radar.
Data paths and guards
- HubSpot: Where reps create deals, from cards on company, contact and building records.
- Deal service: 40+ serverless endpoints and 3 crons on Vercel; about 20 steps for each create.
- State store: Tokens, tenant settings, job-number counters, create logs and storm events in PostGIS.
- Storm service: A Python FastAPI service on Railway that parses the radar files.
- CompanyCam: Photo projects, one for each job.
- Smarty: Address autocomplete and property data.
- NOAA hail radar: Daily hail radar files from a public NOAA bucket.
- From HubSpot to Deal service: Create request. The source record and the rep’s answers to the card’s questions. A rep submits a card.
- From Deal service to CompanyCam: Photo project. A CompanyCam project for the job, found by search or created. Each create.
- From Smarty to Deal service: Addresses and property data. Address suggestions while the rep types, and property attributes for enrichment. The rep’s typing, and each enriched create.
- From Deal service to State store: Tokens, counters, logs. OAuth tokens, job numbers, tenant settings, a log row for each create, and a storm-score query for the address. Every request.
- From Deal service to HubSpot: Deal, building, associations. The deal with its job number and name, the building found or created, enrichment fields, the lead score and the associations. Each create.
- From NOAA hail radar to Storm service: Hail radar files. The day’s hail radar files from NOAA’s public bucket. A daily cron on the deal service calls the storm service.
- From Storm service to State store: Storm events. Hail events above a size threshold, upserted into PostGIS. Each daily run.
- On Create request: Retry finds the deal it made. A retried create that finds its deal already made returns that deal instead of making another.
- On Tokens, counters, logs: Atomic job numbers. Job numbers come from an atomic counter in the store, one for each create.
- On Storm events: Storm events upserted. Each storm event is upserted on a five-field key, so a repeated run adds nothing.
- Built by me
- Platforms I connect to
- Guards
- In production
| Create request The source record and the rep’s answers to the card’s questions |
|---|
| Photo project A CompanyCam project for the job, found by search or created |
| Addresses and property data Address suggestions while the rep types, and property attributes for enrichment |
| Tokens, counters, logs OAuth tokens, job numbers, tenant settings, a log row for each create, and a storm-score query for the address |
| Deal, building, associations The deal with its job number and name, the building found or created, enrichment fields, the lead score and the associations |
| Hail radar files The day’s hail radar files from NOAA’s public bucket |
|---|
| Storm events Hail events above a size threshold, upserted into PostGIS |
-
Systems
Reps work in HubSpot. A Node service on Vercel creates each deal, with tokens, counters and logs in Supabase. A Python service on Railway loads NOAA hail radar into PostGIS. CompanyCam holds the photo projects, and Smarty supplies addresses and property data.
-
Data paths
A rep submits a card on a company, contact or building record. The service takes a job number, names the deal, finds or creates the building and the CompanyCam project, adds property data and a lead score, then writes the deal and its associations.
- a Create request
- b Photo project
- c Addresses and property data
- d Tokens, counters, logs
- e Deal, building, associations
-
Storm feed
Each day a cron on the deal service calls the storm service, which reads NOAA’s hail radar files and upserts the events into PostGIS. When enrichment is on, a geospatial query scores the storm history around the address. A failed run emails the operator through Resend.
- f Hail radar files
- g Storm events
-
Guards
A retried create gets back the deal it already made instead of a second one. Job numbers come from an atomic counter, and storm events are upserted, so a repeated run adds nothing.
- Retry finds the deal it made on a
- Atomic job numbers on d
- Storm events upserted on g
-
Result
Installed in 7 HubSpot portals and in daily use at 4 contractors. A create takes 2.1 to 3.5 seconds, and one contractor made 1,395 deals with it from January to August 2026.
Every deal assembled by hand, building and photo project included
Reps created each roofing deal by hand: they retyped the job address, made the building record, opened a CompanyCam photo project, numbered the job and named the deal. Sales also wanted property and storm history on a lead when it was created.
What I built
- 3 HubSpot cards in 6 placements and a settings page of 6,788 lines, where each contractor sets its job numbers, deal names and the questions asked before a deal.
- A Vercel backend of 40+ serverless endpoints; one create runs about 20 steps, from a token refresh under a lock and an atomic job number to building dedup and associations.
- A Python FastAPI service on Railway that loads NOAA hail radar into Supabase PostGIS every day, behind a geospatial storm-score function.
- Enrichment with 137 mappable fields from Smarty, Shovels and storm data, and a lead score from 0 to 100 across 5 weighted categories.
- A three-pass building lookup, added to a tenant’s own workflow through HubSpot’s Flows API, that finds the existing building even while HubSpot’s search index lags.
What the guards protect against
| The risk | The guard |
|---|---|
| A timeout and an automatic retry create the same deal twice. | Retry finds the deal it made A retried create that finds its deal already made returns that deal instead of making another. |
| Two creates at the same moment take the same job number. | Atomic job numbers Job numbers come from an atomic counter in the store, one for each create. |
| A repeated ingest loads the same storm twice. | Storm events upserted Each storm event is upserted on a five-field key, so a repeated run adds nothing. |
Results
- In daily use at 4 contractors, installed in 7 HubSpot portals.
- One contractor created 1,395 deals with it from January to August 2026.
- Each create takes 2.1 to 3.5 seconds, measured on 5 of 5 production deals.
- Per-deal CompanyCam projects passed 21 scenarios with 99 assertions, then 15 of 15 in production.
- 1,400,946 storm events in PostGIS by February 2026, 1,159,004 of them from NOAA hail radar.
Facts
- Every create logs its outcome, whether success, partial or failure, and the user who clicked
- The lead score weights its 5 categories 30, 25, 25, 10 and 10
- A third entry point and per-deal photo projects shipped as per-tenant settings, with other tenants unchanged
Related builds
-
Multi-tenant event processor
Date: Jun 2026
Fact: 10,630 events in 7 days through the queue that replaced Make.com
Client: For a multi-brand roofing company
Systems: AccuLynx and Make.com
Status: In production
-
QuickBooks job costing
Date: Aug 2026
Fact: On day one of a 3-day hackathon, an invoice posted through the approval gate
Client: For contractors on HubSpot (a hackathon build)
Systems: QuickBooks Online, Stripe and Claude
Status: Active
-
Roof age from aerial imagery
Date: Oct 2026
Fact: 50 of 50 demo addresses answered; 25 of 25 agreed with the county’s historical footprints
Client: For a roofing contractor consortium
Systems: Claude
Status: In production