Pass Muster Media My Social Feed

The Tech

What it costs to run

We can answer "what does it cost to run?" better with a design than with a number: almost nothing happens when a visitor shows up.

4 min read

We won't put a price on our bills here. Prices change, and the useful thing is the shape: the less work each visitor causes, the less it costs to run, and the less can go wrong. Everything below is built around that.

Piece 1: pages built ahead of time

Our public pages, the front page, this blog, the reader and every creator site, are plain files. We build them on our own machine and publish them to Cloudflare Pages, a host that serves static files. The deploy script does four things in order: build the reader, build every creator site into its own folder, publish the lot, then update the Worker described below.

A visitor asking for a creator site gets a finished file. Nothing is assembled, queried or rendered while they wait. That's the cheapest request a web server can answer, and it means a surge of visitors doesn't turn into a surge of work.

Piece 2: one small Worker for every subdomain

Each creator gets an address like name.passmustermedia.com. You might expect a server per site. We have one Worker (a tiny program that runs at the edge of Cloudflare's network) with fewer than 60 lines of code.

It works like a receptionist. It reads the first part of the address, looks it up in a list of hosts, and fetches that creator's folder from the same published site. Unknown names are sent to the main page. It only answers reads. A second entry sends social to the reader.

Adding a creator means adding a line to a list, then redeploying. Cloudflare creates the subdomain's DNS record and certificate on its own. There's no new server, no new database and no per-site setup to maintain.

Piece 3: one scheduled function, not a server per visitor

Some data has to be live: new posts, who's streaming. That comes from one small Supabase Edge Function, with the database behind it. A scheduler inside the database (pg_cron) wakes it every minute to do the refreshing. Visitors don't each trigger a trip to Substack.

Instead, each publication is fetched once for everybody and stored. The function decides when to look again: after an hour for one that posted in the last two days, 4 hours within two weeks, 12 hours within 90 days, daily after that. Writers' names and links are good for 7 days, a reader's list for 15 minutes, a missing page for a day. When a page asks, it gets the stored answer; the page doesn't even know a cache exists. We covered the schedule in Fresh when it matters.

That's why a hundred people reading the same writer costs about the same as one: it's one read per publication per window, however many people have the page open.

Piece 4: payments are somebody else's job

Checkout happens on Stripe's own page. Changing a card, invoices and cancelling happen on Stripe's billing page too. Our billing function only does the glue: it starts a Checkout, listens for Stripe's signed notices (paid, cancelled) and records the result. By its own header it changes nothing except a few tables of orders, billing customers and contact messages. We never build, host or secure a card form. For how sign-in guards it, see Signing in without passwords.

What about free tiers?

Our notes treat the database project as being on the provider's free plan, and plan for alerts when we'd outgrow it. We won't say more than that about plans or prices, since we'd have to look them up and they change. What we can say is why the design suits small plans: static files, shared caching, and a scheduler doing a bounded amount of work per minute.

The trade-off we accepted

Building ahead has a price too. A creator site is a snapshot: new shows, guests and like counts only reach it when we rebuild and deploy. Automating a nightly rebuild is an open decision in our notes, not something we do today. The live bits (new posts, live shows) are the exception, because they're topped up from the shared cache.

The principle: do the work once, ahead of time or once for everybody, and keep per-visitor work close to zero.

It's the same reasoning behind being a good guest to the platforms we read: work we don't do is work nobody pays for. You can see the result in My Social Feed and the creator sites.

← All posts