Skip to content
Back home Next case study

Aer

Aer is a pollen tracking app for iOS, built solo. The interesting work on this project wasn't the iOS surface, even though it's the part most case studies would lead with. It was the system underneath: how to source pollen data from two providers without exposing keys, how to cache aggressively enough to keep paid-API costs near zero, how to keep the backend simple enough to stay maintainable for one person, and how to defer to free tiers where possible without losing reliability.

The product wouldn't have existed without Claude as a pair programmer. I designed the system, made the architectural calls, and product-managed the whole thing. Claude wrote almost all of the Swift and the Worker code. That working model is the reason a project of this scope happened in this timeline.

Impact

This is a personal project that hasn't been released yet, so I don't have user metrics. What I can speak to are the system and architectural wins:

Operational cost

≈0

At plausible v1 scale. A proxy + cache architecture keeps API keys out of the app bundle and amortises paid-API calls across cells of users on a per-day basis.

Solo build

~1 week

Working iOS app with widgets, notifications, localisation and a design token system.

Data source routing

Free upstream for the largest expected user segment (Europe), paid only where free coverage doesn’t exist.

Cache key design

Correct-by-construction across daily forecast rollovers, rather than relying on TTL alone.

Context

The pollen apps I tried all had the same shape. Pull a forecast, show a number, ask the user for money. The product question didn't interest me as much as the system question: how do you build a small consumer health app that pulls from multiple paid and free data sources, doesn't leak keys, doesn't cost the operator a fortune at scale, and doesn't need a full-time backend engineer to keep alive.

That's the question I actually wanted to answer. The iOS app is the demo for the system. I'm an allergy sufferer who'd use this every morning between March and August, so it had to actually work as a product, but the system architecture was the part that made me want to build it.

Discovery

Most of the discovery was technical and economic, not user research. I'm the user. The questions worth answering before writing code were:

The first was where the pollen data should come from. Open-Meteo is free, no API key required, and good across Europe. Outside Europe, the options narrow fast. Google Pollen has the best coverage but costs per request. Copernicus CAMS is free but has rate limits and attribution requirements. The decision had cost, coverage, and operational implications that needed to be sorted before any UI got drawn.

The second was where to put the API keys. An iOS app bundle can be decompiled. Any key in the binary is a key on the public internet. That ruled out the naive "iOS app calls Google Pollen directly" architecture and pulled a backend onto the critical path even for v1.

The third was how to handle cost at scale. Even at modest usage, Google Pollen calls add up if every device fetches independently. The right answer was caching, but the cache had to be designed correctly. Per-coordinate caching is useless because every device sends slightly different coordinates. Per-user caching is useless because there's no shared benefit. The cache had to be at the cell level, where multiple users in the same neighbourhood share a single upstream call.

The fourth was operational. I'm one person on a side project. Anything that needs babysitting, manual scaling, or a separate ops account doesn't fit. The hosting choice had to default to scale-to-zero with no operational floor.

What I owned

Everything. Product direction, system architecture, backend, iOS app, design system, copy, the full launch surface. Where I leaned on Claude was implementation, including SwiftUI gotcha recall and Worker boilerplate. The architectural decisions, the cost analysis, and the data-source routing logic were mine.

How I built it

Backend: from "FastAPI on a free tier" to Cloudflare Workers + KV

The first proposal was a FastAPI service hosted on Render's free tier. Familiar Python stack, easy to write, easy to read. I prototyped it briefly and rejected it for two reasons.

The first reason was caching. FastAPI's natural cache pattern is an in-memory dict. That works on a single long-running process and breaks on serverless or auto-scaled hosting because each invocation gets a fresh process. Adding a Redis sidecar for caching defeats the simplicity that made FastAPI attractive in the first place. The cache had to be a managed service, and Redis-on-Render meant a paid tier I didn't want to commit to for v1.

The second reason was operational. Free-tier FastAPI hosting spins down on inactivity. First request after a quiet period hits a cold start measured in seconds. That's tolerable in development and unacceptable in a consumer app where users tap the icon and expect data immediately.

Cloudflare Workers + KV solved both. Stateless edge functions, globally replicated KV cache, scale-to-zero with no cold-start penalty users would feel. The cost model is request-based, the free tier is generous, and there's no server to keep alive.

The cache key: coordinate snapping for shared cells

This is the architectural decision I'm proudest of on the project, and it's the one that makes the cost model work.

Raw GPS coordinates from devices are unique to ~5 decimal places. Two users standing next to each other in a park report different coordinates. If the cache key is the raw coordinate, no two users ever share a cache entry, and every device pays a fresh upstream API call. The cache is decorative.

The fix is to round the coordinates before they hit the cache key. I round to the nearest 0.1° (round(coord / 0.1) * 0.1), which corresponds to roughly 11km cells. Anyone in the same 11km cell shares a cache entry. The cache key is lat,lon,YYYY-MM-DD with the date in UTC, so each calendar day always pulls a fresh upstream response, but everyone in the cell shares it for the rest of the day.

The 11km granularity is a deliberate choice. Pollen forecasts don't vary meaningfully at sub-kilometre resolution. The atmospheric models providing the data don't either. The Open-Meteo grid is coarser than 11km in most regions. Snapping to 0.1° loses no signal users would notice and groups requests aggressively enough that even a clustered userbase produces an order of magnitude fewer upstream calls than the device count would suggest.

Practically, two people in Warsaw checking the app at 9am and 9:05am hit the same cell, the same date, and the same cache key. The first request fetches upstream and writes the result to KV. The second hits KV, returns in single-digit milliseconds, and costs nothing.

KV TTL is 12 hours as a safety net. The UTC date in the cache key handles correctness day-to-day. The TTL handles edge cases like a corrupt cache write or a botched upstream response that I'd rather not hold onto for 24 hours.

Data source routing: free where possible, paid where necessary

The Worker examines the request coordinates against an EU bounding box (roughly 35-71°N, 25°W-45°E) and routes:

The routing happens server-side, so the app sends the same request shape regardless of where the user is. From the iOS perspective, there's one endpoint. The Worker is the integration layer.

This routing strategy is what makes the cost model work. Most of my likely user base is European, and European users hit the free upstream. Non-European users hit the paid upstream, but the cache hit rate within the cell-and-day cache key absorbs most of the cost even there. A single cell of users in Tokyo or São Paulo costs one Google Pollen call per day, regardless of how many devices are in that cell.

Security: API keys never in the bundle

The Google Pollen API key lives in a Worker KV secret. It's set via the Cloudflare CLI, never committed to the repo, and never deployed to the iOS bundle. The app has no idea Google Pollen exists. From the app's perspective, there's https://aer-pollen.aer-pollen.workers.dev/pollen?lat=...&lon=... and that's the entire universe of pollen data.

This isn't optional. iOS apps can be decompiled with off-the-shelf tools. Any key shipped in the bundle is a key on the public internet. Most consumer apps that call paid APIs directly are leaking those keys, often unaware. The proxy layer is the only architecture that prevents this without elaborate obfuscation that doesn't actually work.

A side benefit of the proxy is that I can swap, deprecate, or migrate upstream providers without an app update. If Google Pollen pricing changes or CAMS becomes a better option in some regions, the routing change is a Worker deploy, not an App Store submission cycle.

Cost analysis at v1

The economics are why this architecture matters for a side project. With the cell-and-day cache key:

The architecture lets me ship a v1 that costs effectively nothing to operate, even with non-trivial usage, and only starts to cost money when the userbase is wide enough geographically that paid-API cells multiply. At that point the cost is predictable and proportional, which is the right shape for a side project that might or might not become a real product.

Notification timing: aligned to data availability

The app sends one notification per day with the day's worst level if it's at or above moderate. The timing is a system decision, not a UX one.

Open-Meteo's ECMWF model data for European users typically lands between 8 and 10am local. A BGAppRefreshTask at 8am pulls fresh data into the cache. The notification fires at 9am with that fresh data. Users can adjust the hour in Settings between 7 and 11, but the default sits where the data does. Firing at 8am risks pulling stale data; firing later than 9 misses the morning routine the product is built around.

This is the kind of decision that's invisible if you only look at the UI. It's the difference between a notification that's useful every morning and one that's useful 80% of mornings.

Decisions and tradeoffs

Cloudflare Workers vs FastAPI on Render

FastAPI was the obvious familiar option and would have been faster to write. I rejected it because the in-memory cache pattern doesn't survive serverless invocations and the free tier's spin-down behaviour creates a user-visible cold start. Workers solve both with the constraint that the Worker runtime is more limited than a Python process. For this product (a routing and caching layer), Workers' constraints are fine. For a product that needed real Python ecosystem access, the call would have been different.

Coordinate snapping precision: 0.1° vs finer or coarser

Snapping at 0.1° (about 11km) was the precision I landed on. Snapping at 1.0° (about 110km) would have improved cache hit rates further but blurred the signal across regions where pollen genuinely differs. Snapping at 0.01° (about 1.1km) would preserve sub-neighbourhood granularity but tank the cache hit rate because pollen forecasts don't vary at that resolution anyway. The 0.1° choice matches the underlying model resolution, which is the principled cutoff.

Cache key design: include UTC date vs pure TTL

A cleaner-looking design would have been a 12-hour TTL on a coordinate-only cache key. I included the UTC date in the key explicitly so that each calendar day always pulls fresh data, regardless of when the cache was last written. The reason was that pollen forecasts roll daily, and a TTL-only design would let yesterday's late-evening cache entry serve a morning request from the next day. Including the date in the key makes the daily rollover correctness-by-construction. The TTL stayed as a safety net, not the primary mechanism.

Open-Meteo + Google Pollen vs single source

A single source would have been operationally simpler. I considered going Open-Meteo only and accepting that non-European users get worse coverage. I rejected this because the long-term goal is a product that works wherever the user is, and the architecture that supports both is the same architecture that supports either. The marginal cost of routing to a second source is small once the proxy exists.

CAMS considered, deferred

Copernicus CAMS was on the table as a free alternative to Google Pollen for non-EU coverage. The free tier has rate limits, attribution requirements, and a less reliable uptime story. For v1 I went with Google Pollen as the paid option behind the cache, because the cache absorbs most of the cost and the reliability story is cleaner. CAMS stays on the roadmap as a possible swap if Google Pollen pricing becomes a problem at scale; the proxy makes that swap a Worker change, not an app change.

What didn't ship

Dark mode

The whole palette was designed for a light, pastel feel. A dark mode would need a parallel palette plus a re-tuning of the blob and grain layers that look right on light. I locked the app to light mode in Info.plist for v1 to avoid shipping an untested half-version.

Multiple saved locations

The data model stores one location. Users who commute can't compare cities. Adding the data side is straightforward; the UI for switching between locations is real work, and v1 didn't need it.

Forecast view

Open-Meteo returns forecast_days=1 and the data is sitting there. The 7-day sparkline shows historical only. A forward-looking forecast view is the most obvious roadmap item, but the design question of how to surface "tomorrow's prediction" without overstating its certainty hadn't landed.

Allergen detail screens

What does birch pollen look like, when is its season, what does it cross-react with. All discussed, none built. v1 ships with allergen names and that's it.

Accessibility fix on the two lowest pollen levels

Known issue. The two lowest accent colours fail WCAG AA on white cards. Fixing them means either accepting a darker variant for text-on-white usage or finding a different colour for those levels.

What I took away

The system-design lesson is that the cache key is the entire cost model. Naive caching by raw coordinate is no caching at all. Caching by cell groups users who would otherwise each pay a separate upstream call into a single shared one. The 11km granularity matches the underlying data resolution, which is the right principled cutoff. Pick the cache key wrong and the architecture's cost story falls apart even though the code looks fine.

The proxy-as-policy-layer lesson is that the Cloudflare Worker isn't just a key-hider. It's the place where data source routing, cost optimisation, and provider migration all live. Putting that policy in the iOS app would have meant shipping a new app build every time the routing logic changed. Putting it in the Worker means a deploy, no app change, no App Store cycle. That separation of concerns is worth more than its complexity cost on day one because it's the difference between a product that's flexible and one that isn't.

The AI pair programming lesson is that the moments Claude was most useful were the moments where I'd already done the architectural thinking. "Implement this Worker that routes to provider A for EU coordinates and provider B otherwise, with a 0.1° coordinate snap and a date-stamped cache key" is a brief Claude can act on cleanly. "Design me a backend" is not. The split that worked was: I architected, Claude implemented, I reviewed. Treating Claude like a Stack Overflow accelerator missed most of the value. Treating it like an engineer on a clear spec captured most of it.

The discipline lesson is that the most defensible v1 decisions on this project were cuts. No CAMS, no dark mode, no multi-location, no forecast view, no widget configuration, no analytics, no in-app language picker. Each one was something I could have shipped to look more capable. The product works, and the system is defensible, because I didn't.

ZIU

ZIU is a national student portal for quickly accessing exam results and academic history.

Next case study