feat: add a live Postgres city to the front page - #34
Draft
NikolayS wants to merge 1 commit into
Draft
Conversation
An animated, simplified PostgreSQL cluster, drawn in canvas 2D from a small
deterministic model that runs in the reader's browser. No new dependency, no
WebGL, no network: 10 KiB gzipped for the scene and the model together.
Derived from PGSimCity (NikolayS/PGSimCity, Apache-2.0), which is the same
cluster in three dimensions. District positions, the compass and both semantic
palettes are that project's, so a reader who follows the link finds the same
colours meaning the same things.
Everything that moves is a consequence of model state, and the order it
happens in is the order PostgreSQL does the work:
- The postmaster forks one backend per connection, not per statement. Each
connection gets its own duct and keeps it for the session.
- A read that misses in the pool goes to storage; the clock sweep picks the
victim, caps usage_count at 5, and a dirty victim is written out first.
- A write dirties a page in shared memory and produces a WAL record. The
commit waits for that record to reach durable storage — and the page is
still dirty in memory when the commit returns. No path marks a frame clean
at commit time.
- Dirty pages reach the data directory at a checkpoint, through the
background writer, or because another backend needed the frame. A
write-back only cleans a frame if it was not re-dirtied mid-write.
- full_page_writes re-arms at every checkpoint, so WAL volume climbs after
one begins, and replication lag climbs with it.
- Replication ships the log. No data page crosses the wire.
The scene ships two hand-tuned palettes rather than one dimmed set, follows
data-theme, pauses off-screen and in a hidden tab, honours
prefers-reduced-motion with an explicit control to start it, and exposes every
district to the keyboard and to screen readers with a full text alternative.
Dirty frames also stand proud of the deck: clean and dirty are 140 degrees
apart in hue but close in luminance, so height carries the same information
where colour cannot.
Only dimensionless figures are shown — cache hit ratio by PostgreSQL's own
blks_hit / (blks_hit + blks_read), dirty share of the pool, and a replay-lag
bar — so nothing can be mistaken for measured throughput. The caption stating
that this is a model and not live data is content, not chrome, and is present
at every breakpoint.
`bun test src/components` asserts what the drawing claims: that no structure
stands unsupported over the excavation, that storage renders below memory,
that each backend has its own connection duct, that pages survive a commit
dirty, and that the palettes stay perceptually separable in both themes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NeTbYVtLkNTuwrRC6yUVva
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An animated, simplified PostgreSQL cluster for the front page, sitting between the hero CTA and the demo video.
Derived from PGSimCity (Apache-2.0), which is the same cluster in three dimensions. It keeps that project's plan, its compass and both of its hand-tuned semantic palettes, and drops the renderer: this is plain canvas 2D, no new dependency, no WebGL, no network — 10.1 KiB gzipped for the scene and the model together.
What it shows
Everything that moves is a consequence of a small deterministic model running in the reader's browser, and the order it happens in is the order PostgreSQL does the work:
usage_countat 5, and a dirty victim is written out by the backend that needed the frame.BM_JUST_DIRTIED).full_page_writesre-arms at every checkpoint, so WAL volume climbs after one begins — and replication lag climbs with it.Honesty
Only dimensionless figures appear on screen — cache hit ratio by PostgreSQL's own
blks_hit / (blks_hit + blks_read), dirty share of the pool, and a replay-lag bar. Nothing on the page can be mistaken for measured throughput from a real database.The caption saying this is a model and not live data is treated as content rather than chrome: it is present in full at every breakpoint, including 390px, where the scene itself shrinks instead.
Behaviour
data-theme— not one set dimmed for both.prefers-reduced-motion, composing a still frame with an explicit control to start it.Tests
bun test src/components— 47 tests, added as atestscript using the repo's existing bun, no new dependency.They assert the claims the drawing makes rather than this calibration's numbers: that no structure stands unsupported over the excavation, that storage renders below memory, that each backend has its own connection duct and none crosses the postmaster's avenue, that pages survive a commit dirty, that WAL climbs after a checkpoint, and that both palettes stay perceptually separable (ΔE floors set just under what they measure today).
Verification
bun test src/components— 47 passbun run build— succeeds; only the repo's pre-existing broken-anchor warningsNotes for review
plan.ts.npx tsc --noEmitis broken onmasteralready (the roottsconfig.jsonextends@tsconfig/docusaurus, which is not indevDependencies). Left alone; the component typechecks clean under the correct config.🤖 Generated with Claude Code
https://claude.ai/code/session_01NeTbYVtLkNTuwrRC6yUVva
Generated by Claude Code