For those who don't know it, Andorra is a tiny country of 80k people located in the Pyrenees. I've been living here for 3 years and built a guide for people moving here.
The downside of living here? Snowstorms and traffic jams. Andorra only has two road entrances, so when there's heavy snow or a holiday weekend, it's chaos. You need to know which roads are clear, whether snowplows are out, and if there's an alternative route.
Turns out the Andorran government has quite good public APIs. No keys or auth, so I used them to make my life easier.
Architecture
Built this with Next.js on Vercel. Each API route caches for 3 minutes so I don't overload the government APIs:
let cache = null;
const CACHE_TTL = 3 * 60 * 1000;
export async function GET() {
if (cache && Date.now() - cache.timestamp < CACHE_TTL) {
return NextResponse.json(cache);
}
const data = await fetch(`${MOBILITAT_BASE}/cameras`).then(r => r.json());
cache = { ...data, timestamp: Date.now() };
return NextResponse.json(cache);
}
For OpenStreetMap data (supermarkets, banks, pharmacies...) the API has aggressive rate limiting, so I scrape 3 categories per run via GitHub Actions and store in Upstash Redis, so I don't need to pay for a server.
A small issue is that Pharmacy shifts change at 9:30, not midnight, so if someone checks at 8AM, yesterday's pharmacy is still displayed for now.
The endpoints
These are the endpoints I used:
Mobilitat (that, is, traffic)
app.mobilitat.ad/api/v1/ gives you:
- GET
/cameras: Dozens oflive traffic cameras (animated GIFs!) - GET
/incidents: Active road incidents - GET
/llevaneus: Snowplows with real-time GPS + speed - GET
/nevadesactive: Snow alert active? true/false
The snowplow endpoint returns the exact position, heading and speed of every active snowplow:
{
"latitude": 42.5436866,
"longitude": 1.733995,
"heading": 22,
"speed": 19
}
So now I can check if the snowplows are out before leaving home in the morning, since I live at 2000 meters and some days the road is impassable.
The camera endpoints return GIFs and are quite heavy.
Fuel Prices
All 60 gas stations with official prices. Gas here is cheap (1.53 EUR/L) because Andorra's VAT is only 4.5%:
{
"name": "BP Whatever",
"parish": "Canillo",
"fuels": [{ "fuel_name": "Gas 95", "price": 1.535 }]
}
Ski Weather
Free, no API key. You need to pass the resort's elevation to get accurate mountain weather:
GET https://api.open-meteo.com/v1/forecast
?latitude=42.57&longitude=1.66&elevation=1800
¤t=temperature_2m,snow_depth,wind_speed_10m
The tools
These are the tools I built:
Thanks for reading!


Top comments (0)