Pharmagarde
started 2026-08
Find a pharmacy on duty in Abidjan, offline, at 2am. An Android app, the backend behind it, and the scraper that feeds them both.
In Abidjan, pharmacies take turns staying open at night and on weekends: the pharmacies de garde. The list changes every week, and you usually need it at the worst possible moment, with no data plan left. The one property everything is built around: a user with no network, at 2am, must still get a correct answer.
The app is Expo on Android, with a MapLibre map whose Abidjan tiles ship inside the APK as a 17 MB PMTiles file, so the map works offline from first launch. The UI never reads the network: sync writes to SQLite, screens read SQLite, and offline falls out for free instead of being a special case on every screen. The duty rotation flips Saturday and Monday at 08:00; the app compares its last sync against the latest boundary, and if the data might be stale it says so with a banner instead of silently showing last week's pharmacies.
The data comes from a Playwright scraper over the public pharmacy listings: the weekly roster of who is on duty, and a directory of more than 2,200 health establishments with addresses and coordinates, cleaned down to about 1,850 after folding duplicates. The two datasets share no identifier, so joining them by name gets about two thirds of the way. The backend, built from my http template, loads both into Postgres and serves the app one consistent snapshot, cached with ETags so an unchanged week costs a 304.
Highlights
- Offline-first: SQLite is the only thing the UI reads
- Abidjan basemap bundled in the APK as PMTiles, no download needed
- Rotation boundaries modelled as half-open intervals, pinned by tests
- Stale-data banner instead of a confident wrong answer
- Playwright scrapers for the weekly roster and the full directory, with dedupe and versioned Google Drive uploads
- Snapshot sync endpoint with ETags and 304s
- French and English, dark only