Build
Each area pairs guides, which explain a capability, with recipes, which solve one task. Pick the area that matches what you are adding. In the sidebar, each area's Recipes section sits below the guides that teach what its recipes assume.
Web layer
Fresh pages, routes, data loading, forms, and islands with @netscript/fresh, plus the Fresh UI components.
- Customize Fresh UI
- Build a desktop frontend
- Build a server-validated form
- Theme your app
- Upgrade an app to tokens v2
Services & SDK
Contract-first oRPC services and the typed SDK that calls them.
- Add a service
- Discover services
- Expose OpenAPI & Scalar
- Protect an anonymous service route
- Call internal procedures from a service or worker
- Host workers and streams services
Background processing
Worker jobs and polyglot tasks that run outside the request path.
- Tune the worker runtime
- Run a polyglot task
- Add a task runtime adapter
- Restrict worker task permissions
Durable workflows
Sagas, event triggers, and durable streams for work that must survive restarts.
AI
The AI engine, MCP client, durable chat, chat UI, and tooling for coding agents.
Data & persistence
Prisma databases, KV, queues, and cron.
Identity & access
Sign-in, sessions, and protected routes with one active auth backend.
Orchestration & runtime
The CLI scaffold, the Aspire resource graph, runtime configuration, plugins, and deployment.
- Add a plugin
- Author a plugin
- Deploy locally with Aspire
- Detached start for agents and CI
- Deploy a workspace
- Deploy to Deno Deploy
- Roll out runtime overrides
- Graceful shutdown
- Deliver outbound webhooks
Observability
OpenTelemetry traces and structured logs, read in the Aspire dashboard.
Preferred NetScript paths
Start with the framework-owned path for each task. Lower-level alternatives help when you integrate an existing host, but they shouldn't be the first construction you copy into a NetScript workspace.
| Task | Preferred path | Why this path comes first |
|---|---|---|
| Load data for a typed page | definePage().withResource(...) |
Keeps route data in the page builder instead of recreating an Express-style loader. |
| Keep island data live | useLiveQuery |
Uses the package-owned query bridge, hydration, and cleanup rather than a hand-rolled polling loop. |
| Add or customize UI | netscript ui:add |
Copies registry source and its token-driven styles into the app you own. |
| Theme the whole app | netscript ui:apply |
Switches the app-wide preset and rebuilds the tokens instead of editing generated CSS or theming one page. |
| Deploy to Google Cloud | netscript deploy cloud-run |
Uses the first-class target lifecycle (plan, up, down) instead of an unrelated deployment wrapper. |
| Back TanStack DB with a service | @netscript/sdk/collections |
Builds the collection from the typed service/query surface. |
| Connect a typed client to TanStack Query | @netscript/sdk/query-client |
Supplies NetScript query keys, invalidation, persistence, and service utilities. |
| Add server-side stale-while-revalidate caching | CacheQuery from @netscript/sdk/cache |
Uses the SDK cache engine and its provider boundary rather than a parallel cache contract. |
| Publish interactive API documentation | Scalar/OpenAPI | One service option exposes the contract-derived spec and the bundled Scalar UI. |
The linked recipe or guide is the canonical sample. When it also shows a general-purpose construction, treat that as an integration escape hatch, not the default route.