
Engineering
recherche-maison.com : find the DPE behind a house listing
A SaaS I built and sell myself. You copy what a French house listing shows, it finds the energy certificate (DPE) of the home, with its address. 15.5 million certificates searched directly in your browser, for a few cents of hosting per month.
- saas
Introduction
Have you ever looked at a house listing in France and wondered where the house actually is ? The listing has to show the energy class (the famous letter from A to G), the surface and the town, but not the address. The thing is, the diagnosis behind this letter (the DPE) is public ! Every certificate is sent to the ADEME, the French environment agency, and published as open data.
So if you copy what the listing gives you, you can usually find the certificate, and the address with it. That’s what recherche-maison does, and it is a product I sell myself, under my own small company (EI Chauquest).
Before going into the detail, here is what I wanted the website to do :
Features
- Search with only what a listing shows : postcode or town, energy class, surface
- Narrow it down with the DPE date or the consumption (kWh/m²/year) when the listing gives them
- Show every matching certificate in a list and on a map (often a few, sometimes only one)
- Open a certificate to see all its data, its building and its land parcel
- Save a home or a search to come back to it later
- Cost almost nothing to host
First plan : a big database (bad idea)
My first idea was the classic one : download everything into a database and put an API in front of it. Before writing the code, I measured a few numbers :
- 15.5 million certificates, 226 columns each
- about 31 GB as CSV
- the ADEME API is limited to 500 kB/s, so a full download takes around 17 hours (and GitHub Actions kills a job after 6 hours)
With these numbers, a database server didn’t make sense anymore. The data is public and nobody owns a row, so why keep a server running just to hand it out ? I went for Parquet files (a compressed format that stores the data column by column) that the browser reads directly.
Pros :
- About 4.5 GB once compressed, which costs a few cents per month on Cloudflare R2
- No database server to maintain
- 226 columns cost nothing extra, a search only reads the columns it needs
Cons :
- The files have to be rebuilt every week, when the ADEME publishes new certificates
- A trickier setup (range requests, CORS on the bucket) than a plain API
How it works
Quick big picture, I won’t dive into every component :
- The certificates are Parquet files on R2, one folder per département.
- The search runs in your browser with DuckDB-WASM. It only downloads the pieces of file it needs (HTTP range requests), not the whole département (Paris alone is 838,532 certificates !).
- Accounts, saved homes and saved searches are the only private data. They live in a small Cloudflare Worker with a D1 database and Google sign-in.
The tricky part : D1 has no row-level security, meaning the database can’t check by itself who is allowed to read which row. So I made one single file the only one allowed to talk to the database, and a test breaks the build if any other file tries. It is less elegant than real database rules, but it does the job.
The data was full of traps
Open data is great, but it is not clean at all. Here is what I found the hard way (each one is now covered by a test) :
- The CSV column names are not the same as the API field names, and two of them are swapped. Read by name, and the address ends up in the wrong column without any error.
- The coordinates belong to each certificate, not to each address. Merging them by address loses data.
- Storing the numbers as floats is not lossless. 96 columns carry exactly one decimal, so I store them as integers multiplied by 10.
The base was built once on my computer, and since then a weekly job only fetches what changed.
Result
The site is live (in French). On top of existing homes, it also covers new builds, offices and shops, and energy audits, each linked to its building (RNB) and its land parcel. Searching the whole history is free with a Google account, and the certificates from the last two months are 5 € per month, paid with Stripe.
I also published it as a reuse on data.gouv.fr, the French government’s open data portal, so you can find it right next to the ADEME datasets.
Limits
- A home only shows up if its DPE was sent to the ADEME. No DPE, no result.
- The address is the one geocoded by the ADEME, it can be approximate.
- Several certificates can match the same listing. The site shows all of them and doesn’t choose for you.
Conclusion
That’s it for this quick tour ! If you are looking for a house in France, give it a try, and if a feature is missing don’t hesitate to tell me. If you want to see another project running on Cloudflare, this portfolio is one, and I wrote about it here.