Fresh

The Deno web framework built on Preact.

Nine numbered steps of the request lifecycle, with the owning file at each hop.

Documents

└── 

The file, explained

What makes it useful

Over half its length is architecture: how a request becomes HTML, how islands hydrate on the client, how the two build paths differ. Rules are the minority of the file.

Techniques in this file

Quoted passages are verbatim. Open one to see it in the source.

01 / Architecture as narrative

The request lifecycle, numbered

Nine steps from handler to response, naming the file at each hop: routing, context creation, the middleware chain built as nested closures, layout composition, render, the boot script, and the response headers.

02 / From this file

The island mechanism, both halves

On the server a diff hook wraps island components in HTML comment markers and collects their props into an array. On the client, boot walks the DOM for those markers and hydrates each one. The marker format is given, which is the contract the two halves share.

Source excerpt starting at line 87.
  comment markers: `<!--frsh:island:NAME:PROPSIDX:KEY-->...<!--/frsh:island-->`

03 / Hard prohibitions

Three git rules covering irreversible operations

Never amend, never force push, always create new commits. Lockfile changes are not committed unless the PR is about dependencies, with the reason given as noisy and environment-specific diffs.

Source excerpt starting at line 42.
- **Never amend commits or force push.** Always create new commits.

04 / From this file

One command standing in for CI

A single task runs formatting, linting, type checking and tests, and is named as the thing to run before pushing. The CI section below lists the eight steps the pipeline runs, so the coverage of the shortcut is visible.

05 / From this file

A known-bad situation with its upstream issue

Lockfile hashes pointing at a moving branch go stale, and the normal reload command cannot fix them. The file states that the hash is edited by hand in that case and links the upstream issue.

Put it to work

Borrow this for your repo

  1. Write the request lifecycle as numbered steps with the owning file at each hop.
  2. Give the agent one command that stands in for CI, and list what it covers.
  3. State the irreversible git operations as absolute prohibitions.
  4. Where a normal command cannot fix a known problem, say so and link the upstream issue.

How the file is organized

  1. 01Repository Overview
  2. 02Packages
  3. 03Git Workflow
  4. 04Development
  5. 05Architecture
  6. 06Routing
  7. 07Build system
  8. 08Partials
  9. 09CI
Read this revision on GitHub ↗

Context your instructions cannot carry

Fresh's file tells an agent how the codebase works. It cannot tell it which bug three customers hit this week. Modem keeps that context current and attaches it to the work.

Try Modem