Run the dashboard under Aspire
In this chapter you run the entire graph as one system under a single aspire start: the orders
service, the Fresh dashboard, the durable-streams runtime, Postgres and Redis. You never wrote a
compose file, a container manifest or a service-discovery config; one command boots the graph in
dependency order and resolves every cross-reference into injected environment variables.
- 1 · Scaffold
- 2 · Contract to service
- 3 · Cache-first query
- 4 · definePage + island
- 5 · Live stream
- 6 · Deploy
What you will build
A complete, observable run of my-dashboard/ on one machine: every resource your dashboard uses,
booted from a single command and visible in the Aspire dashboard at the URL Aspire prints.
Before you begin
You need chapter 5's live monitor receiving mirrored
saga state over its open subscription. netscript init scaffolded the AppHost in chapter 1 (you
didn't pass --no-aspire). From the workspace root, confirm the orchestration entry points are on
disk:
ls aspire/apphost.mts aspire/aspire.config.json
Both files exist. apphost.mts is the TypeScript/Node program aspire start runs, and
aspire.config.json pins the SDK. You don't write the AppHost by hand.
Step 1 — Restore the AppHost SDK (once)
The AppHost runs on its own isolated Node runtime inside aspire/, so its dependencies never leak
into your Deno workspace. Restore that runtime once per machine, and again after an SDK bump:
cd aspire
aspire restore
Step 2 — Start the whole graph
aspire start turns appsettings.json and the plugin contributions into a resource graph and boots
all of it: infrastructure first, then the service, the Fresh app and the streams runtime, with
cross-references resolved into injected environment variables.
# Still inside aspire/. Prints the dashboard URL.
aspire start
When boot finishes, aspire start prints the allocated dashboard address. The graph it
brings up for this track:
| Name · Type | Description |
|---|---|
aspire (dashboard)the URL Aspire prints |
The Aspire dashboard: live resource list, console logs, structured logs and traces. The generated local profile allows anonymous access. |
postgresContainer |
Provisioned via Docker. The database your orders service reads — reachable only once Aspire is up. |
redisContainer (cache) |
Redis cache — the default --cache-backend; Redis-compatible. Backs the KV-backed query layer from chapter 3. |
ordersallocated endpoint |
Your oRPC service (defineService). RPC at /api/rpc/*, OpenAPI at /api/v1/orders/*. |
dashboard (Fresh app)allocated port |
Your Fresh frontend — the live dashboard you built in chapters 4–5. Read its port from the dashboard resource list. |
streamsallocated port |
Durable-streams producer runtime, present once the sagas plugin is installed. Feeds useLiveQuery. |
Step 3 — Open the live dashboard
Find the dashboard resource in the Aspire resource list, open its endpoint, and append the orders
route you built:
/dashboard/orders/
The table renders cache-first (chapter 4) and refetches on the client, and, with the streams runtime up, the saga monitor receives pushed updates over its subscription (chapter 5). Then open the Aspire dashboard to see the system behind it:
the URL Aspire prints
The generated local profile allows anonymous dashboard access:
| Name · Type | Description |
|---|---|
Resourcestab |
Every container and process with status, endpoints, and resolved environment. The authority for which port each resource bound. |
Console logstab |
stdout/stderr per resource — a failing service or streams runtime is one click away, not buried in a terminal. |
Structured logs + Tracestab |
Spans your handlers and pages emit (including the withTelemetry span from chapter 4), correlated across resources via the OTLP collector at the OTLP URL Aspire prints. |
Step 4 — Watch a request flow through the graph
Read the catalog through the typed ordersClient.list({ limit: 20, offset: 0 }) call from chapter 3,
inside the app. The Traces view shows the service request, and the table receives the returned
rows on its next revalidation. The read-model contract from chapter 2 exposes list; it does not
add a create operation. Add writes through a separate declared contract and handler when your app
needs them. A service query does not publish a saga message.
Verify your progress
# From the workspace root, with `aspire start` up in another terminal:
curl "$SERVICE_URL/health" # orders service URL from Aspire
# The streams runtime's port is allocated, not pinned. Copy its endpoint from the
# Aspire resource list, then:
curl <streams-endpoint>/health # streams runtime (if sagas installed)
Both return healthy responses, and the dashboard at the URL Aspire prints lists postgres, redis, orders,
the Fresh dashboard and streams, all running.
- [ ]
aspire restorethenaspire startboots the graph without errors. - [ ] The dashboard at the URL Aspire prints lists every resource healthy.
- [ ] The
dashboardapp's endpoint (from the resource list) +/dashboard/orders/renders the live table. - [ ] The typed orders query is visible in the dashboard traces.
What you built
The complete my-dashboard/ graph under one aspire start: the service, the Fresh app, durable
streams, Postgres and Redis, wired automatically and observable in the dashboard at the URL Aspire prints. Across
the track you carried one contract from the database to a cache-first page and a server-pushed live
view.
Next steps
- Task recipes → the recipes in Build cover what the tutorials don't: adding plugins, database migrations, queue backends, and production pitfalls.
- Deploy remotely → Deploy is the production companion to local Aspire.
- Go deeper → Orchestration with Aspire explains the AppHost, plugin contributions, and two-pass reference resolution; Durable streams and
the Fresh meta-framework back chapters 4 and 5.