Llueve: reservoirs, rainfall and open water data in Spain
I’ve mentioned before (and it’s one of the ideas behind 2701 Labs) that the barrier to writing software has dropped so far that the gap between an idea and building it barely exists.
For months I’d been thinking that relying on embalses.net, the venerable default with its ads, trackers and 15-year-old design, was… unnecessary. And yes, I am the kind of Spaniard who checks embalses.net every Tuesday to see how much water we’ve got.
Then a few days ago I saw a post from Javier de la Torre launching Embalses de España, an open-source example for his new product, LakehouseBox.
That gave me both the inspiration and a starting point. Today I’m launching llueve.es, a site where you can check how full Spain’s reservoirs are, how much rain has fallen over their catchments and which reservoirs supply each town’s tap water.
It brings together MITECO’s weekly bulletin (375 reservoirs, with records dating back to 1988), live readings from the SAIH networks (about 200 reservoirs), AEMET’s rain gauges and the 2022 to 2027 river basin management plans for nearly 7,900 municipalities.
There are no ads, no cookies and no sign-ups. Alongside the website (in Spanish and Catalan), there are CSV downloads, an open JSON API and an MCP server you can connect to your AI assistant.
What’s in llueve.es
The original LakehouseBox project had already solved the most interesting and painstaking part. I reused some of the code and the whole idea of combining MITECO’s bulletin, AEMET’s rainfall data across each reservoir’s entire catchment and the river basin management plans to answer where your town’s water comes from. The data schema (ref, obs, now) also gave me a big head start.
I built llueve.es on that foundation to cover what we usually check on embalses.net much more cleanly and add what I was missing:
- A complete, clean, indexable site. The original project is a single map page running DuckDB in the browser. Here, every municipality, reservoir, river basin, province and autonomous community has its own page (more than 8,600 URLs per language). You can explore records back to 1988 in interactive charts, and there is a dedicated view of reservoir rises after a major storm to see which reservoirs gained water.
- More live coverage and a national estimate. I added two missing real-time networks (SAIH Tajo and Hidrosur, nearly 70 more live reservoirs), scheduled daily imports from AEMET and a live national estimate.
- Open data ready to use. Everything runs on Postgres and Cloudflare, removing the dependency on DuckDB in the browser and exposing the same data as CSV downloads, a JSON API and an MCP server.
Open API and MCP server
At llueve.es/datos, you can download any dataset as a CSV or query the JSON API without an account or API key.
If you use Claude, ChatGPT, Codex or any other MCP-compatible client, you can connect the server at llueve.es/mcp and ask questions like:
- Which reservoirs supply Valencina de la Concepción, and how full are they today?
- Which reservoirs rose the most in the past 72 hours, and how much rain fell over their catchments?
- How is the Guadalquivir basin doing compared with its 10-year average?
Each answer includes the source, the date of the data and a link to the relevant page on Llueve so your assistant can cite it.
How it’s built
I generally try to keep things simple, and for this project I wanted to turn a public data catalogue on DuckDB and Iceberg into a standalone site that is fast and cheap to run. Here is the stack:
- Supabase (Postgres + PostGIS). Building on the original schema’s three layers (
reffor geographic reference data,obsfor observations andnowas a kind of materialised view for the site), I converted the spatial queries from DuckDB to PostGIS. Every 15 minutes,pg_cronrebuilds thenowtables from the observations and reference data. - Python imports on Cloudflare Containers. A cron job starts a temporary container when it’s time to fetch a source, loads the data into Postgres and shuts down. All “serverless”.
- Astro and an API on Cloudflare Workers. The API Worker (which also serves MCP) queries Postgres and caches each response at the edge with versioned URLs. Until the data changes, neither the API nor the MCP server hits the database. On top sits an Astro site rendered on the server; only the maps and charts load JavaScript.
- Design in Paper. I’d wanted to try Paper and connect its MCP server to my agents for a while. It’s wild to see it all happen in real time: laying out screens, typography and colour tokens… Obviously the design is just decent and could be refined much further, but it was one of my last hurdles to building products on my own. Paper passed that test easily.
As with Findegil, I wrote almost all the code with agents. For projects of this complexity, what still makes the difference is settling the schema, the API contracts and the design before generating code.
What’s still missing
- Reservoirs in the Balearic and Canary Islands. Their municipalities already have supply pages (aquifers, water galleries and desalination), but no reservoir level data because MITECO’s bulletin covers mainland Spain. I’m not sure where to pull this data from yet, but I’ll find a way. Live data for the Duero basin is also missing.
- Simple alerts (on Telegram, for example) if people ask for them.
- Open-sourcing the code. The repository is still private while I tidy up a few things, but the plan is to release it under Apache 2.0, like the original.
If you’re also one of those people who checks the reservoirs on Tuesdays, head over to llueve.es and look up your town. And if you spot a number that doesn’t add up or run into trouble with the MCP server, email me at [email protected].