hackers.pub Hall

The Reading Room (web)

ja· en· ko
If you're new herehackers.pub's part you see in the browser, the visible screen.

Readers can read all of it with no JS. Writers get an island that's pleasant to write in (Composer). When you want fast pages and rich editing at once, this wing is the floor plan to copy.

In this hall, the word "islands" is an architectural term. The JS that runs on the client is only the veranda for interaction; everything else is HTML assembled on the server. In a quiet reading room, small islands float only where they're needed.

Highlights

  • In addition to Fresh's fsRoutes, main.ts has the GraphQL Yoga server and the upload proxy cohabit, and at the entrance it passes visitors through the ActorSuspendedError/isActorBanned gatekeeper
  • The postgres pool in web/db.ts is max: 20—with a comment that unless it's wider than the delivery queue's concurrency of 10, connections starve when the federation gets crowded
  • Even sitemaps.xml.ts and robots.txt.ts are placed as files, part of the corridor (routes)

A passage from the sutra

export const postgres = postgresJs(DATABASE_URL, {
  // The pool size needs to exceed the ParallelMessageQueue concurrency (10)
  // to leave headroom for HTTP handlers and KV store queries.  The default
  // of 10 can cause connection starvation under federation load.
  max: 20,
});
export const db: Database = drizzle({
  relations,
  client: postgres,
  logger: getDatabaseLogger(),
});
web/db.ts L14-L24— Digging the pond wide enough to match the delivery concurrency

Floor plan

web/main.ts
Fresh's startup. Yoga cohabiting, with a gatekeeper
web/routes/@[username]
The profile lane (the rooms for articles/followers/posts)
web/islands/Composer.tsx
The representative veranda for interaction—the island where you write a post
web/federation.ts
The place that breathes life into the blueprint (the builder)

Neighboring rooms

Outside links