DashboardopencodeLazy server-only HTTP construction

Lazy server-only HTTP construction

Category: preference
Confidence: 0.80
ID: 01a0aec3-9a63-7066-a19c-319749427bb7
Project ID: c0425955-02bc-4c17-9af2-b114c00077e7
Cross-project: No
Recalled in other projects: 0
Source session: 0E5EeJfngrA9O8uoR
Created: 2026-09-17 09:44:52
Updated: 2026-09-17 09:47:29

Content

Defer server-only HTTP applications, routes, web handlers, service graphs, OpenAPI generation, and background startup until a process actually serves or requests them. CLI commands and scripts that merely import shared modules must incur no server setup cost or side effects. Use lazy memoized initialization so expensive construction occurs only on first use and is reused. In particular, build and serialize the OpenAPI /doc response only when requested, cache the complete HttpServerResponse, and reuse its serialized Uint8Array.

Move to: