Skip to main content
NetScriptdocs Search docs ⌘K v0.0.9
Browse documentation

Deno meta-framework · v0.0.9

A NetScript app is five connected layers.

Contracts define the boundaries. Services serve them at request time, plugins extend them across processes, the web layer brings them to the browser, and the observed resource graph keeps the whole system visible.

This page maps the five layers of a NetScript app and the boundary problem each one solves. Read the sections in order, then follow each one into the detailed documentation.

1. Contracts

A contract is the source of truth for an operation's input and output. It can describe behavior as well as data: checkout.start is as natural a boundary as a list or update operation. A service implements the oRPC contract, @netscript/sdk derives clients and query helpers from the same contract map, and the service runtime generates OpenAPI from the contract router. The TypeScript caller and the HTTP description share one definition instead of two hand-written shapes.

Contracts and type flow covers the schemas and router mechanics.

2. Services

A service runs a contract at request time. defineService() turns a contract router into a running Hono and oRPC service. The preset wires in request logging, OpenAPI generation, a Scalar docs UI, RPC, health endpoints, and service-info metadata. SDK clients resolve service URLs lazily from Aspire-injected environment values, so callers don't pin a local port into application code.

A service owns the request boundary. Work that must resume after the process exits belongs in a durable runtime, not in a longer request handler. See Services & SDK and service discovery.

3. Plugins

Services handle requests; plugins handle work that outlives one. The host starts empty, and plugins add its runtime capabilities. A plugin manifest is validated data that declares services, background processors, schemas, topics, configuration, and telemetry contributions. The CLI turns those declarations into static workspace wiring.

A plugin is a packaging unit, not a runtime unit: Aspire can run a plugin's API and its background processors as separate resources. Workers, sagas, triggers, and streams are the durable examples. The plugin-system explanation covers the manifest and registry mechanics.

4. The web layer

The web layer carries the contract to the browser. @netscript/fresh builds on Fresh 2 and Preact. Typed route contracts and definePage() connect paths, search parameters, metadata, handlers, data layers, and forms. A server page can call the contract-derived SDK, hydrate TanStack Query state, and hand interactive work to islands. Routes that need no island ship no island JavaScript.

The web-layer overview has the complete model. The focused guides cover server rendering, page builders, and queries and islands.

5. Observability

Resource graph
orders plugin
starts
starts
starts
starts
starts
database connection
database connection
database connection
KV cache connection
KV cache connection
KV cache connection
observes
observes
observes
observes
observes
Postgres
resource
Redis cache
resource
(default --cache-backend)
HTTP API service
worker
(background processor)
saga-runner
(background processor)
Aspire AppHost
(declares & starts resource graph)
Aspire Dashboard
(telemetry / logs / traces)
One plugin can become several observed resources. Aspire starts its API and background processors alongside their shared infrastructure.

The diagram shows one plugin. At workspace scale, the generated AppHost also composes apps, services, plugin processors, databases, and cache resources, then injects service-discovery and OTLP configuration into their processes. The Aspire dashboard reads health, logs, traces, and metrics from that running graph. Trace context carried by SDK calls keeps client and service spans connected.

Aspire is the default local orchestration layer, not part of every package API. Without it, the Deno packages still work, but resource startup, discovery values, and telemetry wiring become the application's responsibility. Orchestration & runtime, Observability, and the Aspire boundary cover the mechanics.

Go deeper

Each essay explains one part of the model and why it has its shape. Read them in sidebar order: the architecture essay sets the vocabulary the others assume.

Search all documentation

Type a term to search the documentation.