Add RentCast & Realie integration for automatic property data and valuations
Merged
KI
4mo ago+1812+1812+0123456789012345678901234567890123456789-27-27-01234567890123456789
Enter an address. Get the whole property.
Today, adding a property to Sure means a three-step manual wizard: type the
details, estimate your own market value, enter the address. This PR adds a
second path ā pick an AVM (Automated Valuation Model) provider, enter a name
and a US address, and Sure fetches everything else for you in a single API
request:
- š Property type (single family, condo, townhouse, multi-family, land, ā¦)
- š Year built
- š Living area (square footage)
- š° Current market value estimate ā set as the account balance automatically
The account is created fully active with the address saved ā no wizard steps,
no guessing your home's value from a listings site.
Two US providers are supported at launch, both with free tiers:
| Provider | Free tier | Data source |
|---|---|---|
| RentCast | 50 requests/mo | AVM value estimate + property record in one call |
| Realie | 25 requests/mo | Full property record incl. model value in one call |
Screenshots
How it works
- Setup: Settings ā Self-Hosting gets a "Property Valuation Providers"
section. Keys are encrypted at rest, ENV-overridable
(RENTCAST_API_KEY/REALIE_API_KEY), and show live monthly usage. - Add a property: when a key is configured, the existing "How would you
like to add it?" selector offers Add via RentCast/Realie alongside manual
entry. The lookup form reuses the manual flow's localized address fields. - One request per property: RentCast's
/v1/avm/valueis called with
lookupSubjectAttributes=trueso the value estimate and property record
arrive together; Realie's address lookup returns the full record including
its model value. No secondary calls. - Daily refresh, never hourly: a new
SyncPropertyValuationsJob
(daily,config/schedule.yml) keeps linked valuations current. It is
deliberately excluded from hourly and manual family syncs. - Hard monthly caps: every request (lookup or refresh) counts against a
per-provider monthly budget (50/25). At the cap, Sure stops calling the
provider until the month rolls over ā your quota can't be burned by the
background job. Paid plans can raise the cap via
RENTCAST_MAX_REQUESTS_PER_MONTH/REALIE_MAX_REQUESTS_PER_MONTH. - Manual entry is completely unchanged, and nothing changes for instances
with no AVM keys configured.
Implementation notes
- New
:property_valuationsregistry concept with a shared
Provider::PropertyValuationConceptinterface ā adding future AVM
providers is a single class + registry entry Property::AvmImportmaps provider payloads onto the existing
account/property/address models; unmapped property types leave the
subtype blank rather than guessing- Two new columns on
properties(avm_provider,avm_last_synced_on) - Follows existing provider conventions throughout (Faraday client,
with_provider_response,RateLimitable, encryptedSettingfields,
AlphaVantage-style limit counters)
Limitations
- US addresses only (both providers are US-based)
- Realie lookups filter by street + state (its API requires a county to
filter by city, which the form doesn't collect)
Testing
- 24 new/updated tests: provider clients (stubbed HTTP), rate-limit
enforcement, ENV overrides, daily job behavior, controller create/error
flows, view rendering ā all green, rubocop + erb_lint clean
š¤ Generated with Claude Code
Summary by CodeRabbit
- New Features
- Added AVM valuation support with RentCast and Realie, including an AVM method selector and provider-specific address dialogs to create properties from valuations.
- Added RentCast/Realie API key fields to hosting settings with masked inputs and monthly usage visibility.
- Introduced a daily scheduled sync to refresh eligible AVM valuations.
- Bug Fixes
- Improved sync reliability: failed valuation balance updates no longer mark properties as synced; failures are recorded with provider/account context.
- Tests
- Expanded coverage for the AVM wizard flow, provider mapping, sync behavior (including rate limits/budgeting), and error handling paths.