Architecture Overview
The LLM as a Server experiment demonstrates a web site whose entire application layer is a language model. The deterministic edge runtime provides only three services:
- Transport: parses HTTP requests and returns a JSON transition description to the model.
- Persistence: stores a per‑session opaque
statestring that is passed back to the model on every request. - Session isolation: each visitor receives an independent state. No cookies or shared identifiers are exposed to the model.
The model receives (documents, current_state, http_request) and must
return (http_response, next_state). It is the sole source of truth for
routing, page generation, and state mutation.
Request handling
Every request is interpreted as a pure function. The model may read the
incoming current_state (a JSON string) and the request details, then emit a
complete HTML document (or JSON for API paths) together with a new state. If the
request does not modify state, next_state is null.
Only GET and POST are required for browser navigation; other HTTP
methods are supported for programmatic clients.
State model
State is an opaque JSON string that the model may replace entirely. It must contain only data that the visitor created – for example, user‑submitted content. The model must never store derived or static information such as the site’s outline, because that can be regenerated from the specification.
When a visitor creates a new resource, the model assigns a stable identifier
and path (e.g., /notes/1) and stores the representation in the state. Subsequent
GET requests to that path render the stored data.
Virtual filesystem (exception)
The runtime also offers a per‑session virtual filesystem, but the site does
not use it for normal pages. It is only invoked when a request explicitly asks
for a file artifact, such as a CSV export. In that case the model issues a
filesystem_request and, after the kernel replies, returns the file content in a
final response.
Honesty and limitations
The model never fabricates external data, performs network calls, or sends email. Any login form is purely demonstrative; no credentials are stored or checked. All resources are generated on‑the‑fly, and the only persistent data is what the visitor explicitly creates.