weft
ir 2.6.0 · warp 1.8.0
generatedread out of the source that implements it

Ports and adapters

Every seam the kernel refuses to know about, what implements it, and which config key binds it.

Everything a framework normally does for you is a port here: the store, the session, the flags, the executors, the registry, the transport. The kernel imports nothing but the WinterTC Minimum Common Web API, so anything that is not the document request path is on the other side of one of these interfaces.

Most of them are bound by the front door with no configuration at all, which is what makes an application with no weft.config.ts a real deployment rather than a demo mode. The Config key column says which ones a deployment can take over, and links to the option that does it.

A port has one implementation at a time, and swapping it changes where something happens. A plugin adds to a request without replacing anything. The one thing neither may do is write a cache key, because a key that can be written by hand is a key that can be written wrongly.

binding three of them, and leaving the rest alone
import { defineConfig } from '@weftjs/core'
import { envConfig, hostDeployment, tieredStore, memoryStore, kvStore } from '@weftjs/adapters'

export default defineConfig({
  // Two tiers: this process, then the namespace every instance shares.
  store: tieredStore([memoryStore({ max: 500 }), kvStore(env.CACHE)]),

  // Settings from WEFT_-prefixed environment variables. This is also the default.
  config: envConfig({ prefix: 'WEFT_' }),

  // The deployment names itself from whatever the host calls a revision.
  deployment: hostDeployment(),
})

14 declared · 12 with an implementation in @weftjs/adapters · 7 a deployment can bind from weft.config.ts. Counted from the source, not stated.

PortConfig keyWhat implements it
AssetPortfront doorthe kernel’s own
ConfigPortconfigenvConfig, staticConfig
DbPortdbboundedDb
DeploymentPortdeploymenthostDeployment, staticDeployment
ExecutorPortfront doorthe kernel’s own
FanoutPortfanoutmemoryFanout
FlagPortfront doorstaticFlags
LimitPortlimitscountingLimits
RenderPortfront doorirRenderer
SchedulerPortfront doorfifoScheduler, prioScheduler
SessionPortfront doorcookieSession
StorePortstorekvStore, memoryStore, redisLeases, sharedLeases, tieredStore
TelemetryPorttelemetrycollectingTelemetry
TransportPortfront doornodeTransport

What a route needs early: the links worth a 103, and the chunks a bundler would pack.

Bound by the front door. A deployment does not name this one.

Nothing in @weftjs/adapters returns one: the kernel’s own implementation is the only one, and a deployment that wants another writes it.

What this deployment was configured with. A setting is deliberately **not** a tracked read — a property of the deployment rather than of the request, so it never lands in a cache key.

Bound with config in weft.config.ts.

In @weftjs/adaptersWhat it isSource
envConfigConfiguration from the environment, through a declared allow-list — a render reading `process.env` directly is a read the compiler never saw.config.ts
staticConfigSettings from an object: a Worker's `env`, a test, or a config file that already read them.config.ts

Where a loader's data comes from, named rather than anonymous — the framework never sees a .data.ts loader, so running its query through a port gives back a name, a deadline and tags. Not a query language: what runs is the caller's function.

Bound with db in weft.config.ts.

In @weftjs/adaptersWhat it isSource
boundedDbA database access that has to name a deadline and the tags it reads. Neither is bureaucracy.db.ts

Which build is answering, and where it is running. A port rather than environment variables read ad hoc: every runtime spells them differently.

Bound with deployment in weft.config.ts.

In @weftjs/adaptersWhat it isSource
hostDeploymentA deployment that reads its identity from the platform's own variables.deployment.ts
staticDeploymentA deployment that knows its own identity because somebody wrote it down.deployment.ts

One method, collapsing six mechanisms into one: same thread, a worker pool, an isolate, a binding, another pod, or the browser. Also the fault and budget boundary.

Bound by the front door. A deployment does not name this one.

Nothing in @weftjs/adapters returns one: the kernel’s own implementation is the only one, and a deployment that wants another writes it.

Invalidation that crosses a process boundary. hub.notify alone is correct on exactly one instance; on two, half the readers are told and half are not. publish must not deliver back to the publisher — origin is for implementations that cannot suppress it. See spec/kernel/transport.md.

Bound with fanout in weft.config.ts.

In @weftjs/adaptersWhat it isSource
memoryFanoutA `FanoutPort` over a bus in this process.fanout.ts

Feature flags, and the one thing that makes them plannable: the complete axis set. A flag whose values are enumerable partitions the plan rather than branching inside a render.

Bound by the front door. A deployment does not name this one.

In @weftjs/adaptersWhat it isSource
staticFlagsFlags from a declared axis set: an undeclared flag is a build error, not a silent dead branch.flags.ts

How often one caller may do something. The kernel cannot implement this: which of an address, a session or a subject to count against is a deployment's decision, and the intent declares how much traffic it can take. See spec/kernel/authority.md.

Bound with limits in weft.config.ts.

In @weftjs/adaptersWhat it isSource
countingLimitsA fixed-window counter, and it says fixed on purpose: `StorePort` has a lease, not a counter, so a sliding window is not available here. See `spec/kernel/authority.md`.limits.ts

Who turns a fragment and a value set into bytes. The job carries the template, since one slot renders a different fragment on every route. Bound rather than assumed — remote is another implementation of this port, not a second render path.

Bound by the front door. A deployment does not name this one.

In @weftjs/adaptersWhat it isSource
irRendererWho turns a fragment and a value set into bytes. See `spec/kernel/ports.md`.render.ts

Who decides the order within a wave, and how wide a wave may be.

Bound by the front door. A deployment does not name this one.

In @weftjs/adaptersWhat it isSource
fifoSchedulerA ceiling and nothing else: the order a plan produced is kept exactly as it was.scheduler.ts
prioSchedulerOrders a wave by declared priority. It reorders what it was handed and can add nothing.scheduler.ts

Who is asking, and the cookies that say so. The one port whose reads change a cache key — identity forces a private class. Writing is phase A only; the port returns cookies rather than setting them.

Bound by the front door. A deployment does not name this one.

In @weftjs/adaptersWhat it isSource
cookieSessionIdentity and cookies from a signed cookie. The default, and a real one.session.ts

Where rendered bytes are held, and what the deployment can honestly claim about them. The four readonly properties are checked at build time, so strong against an eventual store is a build error rather than a guarantee nobody keeps.

Bound with store in weft.config.ts.

In @weftjs/adaptersWhat it isSource
kvStoreA store over Workers KV. Eventually consistent, and it declares that rather than hoping.workers.ts
memoryStoreThe default store: one process, a byte ceiling, and LRU eviction. Real, and not shared.memory-store.ts
redisLeasesLeases over Redis, so stampede coalescing works across processes rather than once per isolate.redis-leases.ts
sharedLeasesLeases over any store that can do a conditional write, for deployments with no Redis.shared-leases.ts
tieredStoreSeveral stores as one, nearest first. Reports the weakest tier's coherence, not the nearest.tiered.ts

Where the marks and the measures go. Two methods: an instant something happened, and how long something took. The kernel measures whether or not one is bound.

Bound with telemetry in weft.config.ts.

In @weftjs/adaptersWhat it isSource
collectingTelemetryAn in-memory telemetry port. For tests and for the devtools' own timeline.telemetry.ts

What the runtime underneath can do that the Fetch API cannot express. Small on purpose: Request and Response cover everything else, and this is the exceptions.

Bound by the front door. A deployment does not name this one.

In @weftjs/adaptersWhat it isSource
nodeTransportRequest in, Response out — the whole of running the kernel on Node. See `spec/kernel/lifecycle.md` for 103 Early Hints.node-transport.ts