Case study

Full-stack web apps

Cairn is an outdoor map built on open data, with accounts, a PostGIS database and 26 API routes behind it. I never finished it because I couldn’t get it to scale properly.

The problem

A web app that looks finished is a small part of the job. What makes it safe to put in front of real users is everything behind the screen: accounts, a database, dozens of API routes, rate limits, and protection from both attackers and surprise bills.

Cairn is a map anyone can use without signing up, with a full platform behind it for the people who do.

Project 01

Cairn

An outdoor map for hikers and explorers, built entirely on open data. Never finished.

  • Unfinished
  • 26 API routes
  • 430 automated tests
Topographic map of Yosemite Valley with the layers panel open
Yosemite Valley with the layers panel. Map data from the USGS, USDA Forest Service, NOAA and OpenStreetMap contributors.

What I built

  • Seven map styles, including topographic, satellite, terrain and an outdoor style that brings out trails and water, plus layers for trails, public land, forest roads and shaded hills.
  • A tilted 3D view, search by place name or coordinates, and route planning on foot, by bike or by car, with elevation.
  • Weather and alerts from the National Weather Service.
  • Saved places, routes and collections, private share links, and GPX import and export. No account is needed to use the map; saving needs one.
  • Accounts with email and Google sign-in, email verification, password reset, a list of signed-in devices and account deletion.
  • A PostgreSQL database with PostGIS, which understands shapes and distances, so “what’s in this part of the map?” is quick to answer. Each kind of map data sits behind a common interface, so one supplier can be swapped without touching the rest.

The hard parts

Not being tricked into attacking itself

A server that fetches web addresses can be fooled into reaching private systems. Every outside request in Cairn goes through one client that allows only approved sites, checks where each address really leads, rechecks every redirect, and limits time and size. A code rule blocks anything that tries to go around it.

Never getting a surprise bill

Map services can get expensive fast. A circuit breaker counts requests to each one and stops at the free limit. The app then switches that feature off instead of spending money.

Being honest about trail data

Some forests publish which uses a trail allows, and some don’t. Showing a blank as “nothing allowed” would be wrong, so Cairn treats “not published” as its own answer.

Being kind to free services

One elevation profile can need about 128 lookups. Cairn saves answers for as long as the facts stay true: a year for the height of the ground, a week for a route. It stores a scrambled version of each search, never the words.

Testing

There are 430 automated tests; 136 of them need a live database. One test finds every API route in the project and fails if any is missing its login check or rate limit. Others feed in malicious GPX files and check that one person can’t open another’s data.

Where it stands

Cairn was never finished. I couldn’t get it to scale properly, so I stopped working on it. The unfinished version is still online.

Cairn screenshots

Need something like this?

If you need something like Cairn, tell me what you’re trying to build. I’ll reply with questions, then a scope and a price.

Get in touch