● xodhiambo.com · nairobi · UTC+3 v.2026.08
xavier@nairobi:~$ cat projects/jobtracker/README.md

JobTracker: save the link now, the details catch up

What it is

A job application tracker for people who currently use a spreadsheet. Paste a posting link and it's saved; the title, organisation and posting text fill in while you carry on. Two rules decide what gets built: capture has to be near-instant, and the app has to show something a spreadsheet can't.

Shape

Server-rendered FastAPI with HTMX: handlers return HTML fragments, and the business logic sits in a service layer so a JSON API for a native app can be a thin adapter later. Capture is never blocked on parsing. The link is saved first and fetched in the background; a failed fetch means typing the title yourself, never a lost save.

browser -> Dokku nginx -> web     FastAPI · Jinja · HTMX · Alpine.js
                          |  sessions, rate limits --> Redis 7
                          |  save the link first, then defer the fetch
                          v
                      Postgres 16   applications · append-only events · jobs
                          ^
                          |  fill blank fields, append an event
                       worker  Procrastinate
                          |
                          v
                      outbound boundary   resolve, check, pin, cap
                          |
                          v
                      the posting   whatever URL a person pasted

Fetching the posting safely

The posting URL is typed by a user, so it is attacker-supplied, and the fetch is the first code in the app that opens a connection to an address someone else picked. The boundary refuses by default and checks again on every redirect: http or https only, no credentials in the URL, web ports only, every resolved address public, a capped number of redirects, capped bytes, and an HTML content type.

Checking the address isn't enough on its own. If the hostname is handed to the HTTP client afterwards, it resolves the name again, and a DNS server the attacker controls can answer with a public address for the check and 127.0.0.1 a millisecond later. That's DNS rebinding. So the request goes to the literal address that passed the check, with the hostname carried only for TLS and the Host header.

Most of httpx's conveniences are switched off for the same reason: each one makes a decision this boundary exists to make itself.

httpx defaultInsteadWhy
follow redirectsits own redirect loopevery hop is re-validated, not just the first
pool connectionsno keep-alivethe pool is keyed by the pinned IP, so a second hostname on it would skip certificate checks
decompress for usraw bytes through a capped zlib decoderhttpx decodes a whole read before any cap of ours runs
buffer the responsestream in chunks against two capsa body we'll refuse is never held whole

Why the queue moved to Procrastinate

The first queue was arq, because Redis was already there for sessions and rate limits. It gave no visibility: what's queued, and why a job failed, meant reading Redis keys, and a failed job's arguments were gone. Procrastinate keeps jobs as rows in the Postgres the app already runs, so monitoring is one query, the same in dev, tests and production:

select id, task_name, status, attempts, queueing_lock from procrastinate_jobs;

The cost, measured: a defer takes 2.08 ms against arq's 0.22 ms, inside a save request that runs 6.8 ms median and 17.2 ms p95. It also doesn't buy transactional enqueue. Procrastinate speaks psycopg and the app's SQLAlchemy speaks asyncpg, so the job and the application can't commit on one connection. The save still commits first and defers after. The move was for visibility, not transactions.

Status is derived, never stored as truth

Every stage change is a row in an append-only application_events table, and current_stage is only a cache of the latest one, so history, undo and where a change came from are free. A shortlisted job is just an application that hasn't been applied to yet, so "I applied" is a stage change, not a move between tables.