Social & feeds
Blog platform - write once, cache everywhere
Why a blog is a read-heavy system where the cache is the product, and what publishing has to invalidate.
What this board gets wrong on purpose
The tension
Freshness depends on a hand-written list: the purge worker invalidates the post, the home page, its tag pages, the author page and the feed - and nothing else, so page 2 of the archive, the "related posts" box on other posts and any page added next quarter stay stale for the full 24 hour CDN TTL. Purges are asynchronous, so a reader can see the old version for a few seconds after publish, and a purge that fails is not retried. Behind it all, every write goes to one database primary.
Practise this as an interview
Take Blog platform - write once, cache everywhere as a timed system design interview on a blank board - on your own, with the requirements to check yourself against, or with a candidate you invite.
Start here
Why this design
A blog platform (think Medium, Substack, Ghost, a company engineering blog) is a classic first system design because the ratio is so extreme: tens of thousands of posts written a day, tens of millions of page views. That ratio says the job is serving the same HTML to many people cheaply, which is caching. And caching moves the hard part to the one moment something changes: publishing has to find and invalidate every page that shows the post.
What you will learn
- Why 2,500 reads per write makes the CDN, not the database, the serving tier.
- How a 95 percent cache hit ratio turns 3,000 page views a second at peak into 150 requests at the origin.
- Why publishing is an invalidation problem: one post changes five or more URLs.
- Why images go to object storage, and why they dominate storage by 100x.
- Where a single primary database is fine for years, and why.
How to read this board
- Top: PUBLISH. Author, editor, the posts API hex, and the publish event that starts the fan-out.
- Right: STORES. The posts database (one primary), a read replica, and the media bucket.
- Bottom: READ. Reader, CDN edge, the render service that builds HTML on a miss.
- Bottom right: AFTER PUBLISH. The red purge worker and the search indexer.
- Press play, then read pages 1 to 6, then the tables. The conversation is the red box: who decides which pages are stale?
1 · Requirements
Functional
- Authors write drafts in a rich editor, with autosave, and upload images.
- Publish a post: it gets a permanent URL /@author/slug and appears on the home page, the author page, its tag pages and the RSS feed.
- Edit a published post; readers see the change within a minute.
- Readers read posts without logging in. Search posts by title and text.
- Unpublish or delete a post; it disappears everywhere within a minute.
Non-functional
- Time to first byte under 100 ms for a cached page anywhere in the world; under 500 ms on a miss.
- Read availability 99.95 percent - pages keep serving from the CDN even if the origin is down.
- Write availability 99.9 percent; autosave must never lose more than a few seconds of typing.
- Survive one post going viral (front page of a news aggregator) without the origin noticing.
- Search may lag publishing by a minute.
Out of scope
- Comments, likes and paywalls (each personalises a page and needs its own design).
- Email newsletters to subscribers.
- Custom domains per blog (a CDN configuration problem, not a data one).
The rest of this board
Available on Tier Slate
This page publishes the question. The answer — 5 more written pages, an 8-step narrated walkthrough and a 5-table schema — is the board itself, and it opens in Tierslate.
- 5written pages
- 8walkthrough steps
- 5tables21 columns
5 pages behind this one
- Capacity estimation
- Storage estimation
- Availability
- How it works
- Deployment plan
More boards
Timelines, follows, fan-out - the read-heavy classics.
- Social news feed - fan-out on write or on read
- Media feed - the feed serves URLs, the edge serves bytes
- The professional graph - degrees, and why it is not a join
- Comment trees - one range scan, and four writes per vote
- The social graph - one edge, written twice
- Home timeline - materialise it, then keep it honest
- Link previews - fetching a stranger's page safely
- Reviews and ratings - the average that must not be gamed
- Content moderation - deciding before everyone sees it
- Stories - posts that delete themselves in 24 hours