Skip to content

Effect HTTP

@monque/dashboard-effect serves the bundled Dashboard. Install it with Effect 4.1.4 and your host’s Effect platform package. The host supplies authentication, platform services and the HTTP listener.

import { NodeFileSystem } from "@effect/platform-node";
import { dashboardEffectLayer } from "@monque/dashboard-effect";
import { Layer, Path } from "effect";
import { Etag, HttpPlatform, HttpRouter } from "effect/http";

const Platform = Layer.mergeAll(
  NodeFileSystem.layer,
  Path.layer,
  HttpPlatform.layer.pipe(Layer.provide([NodeFileSystem.layer, Etag.layerWeak])),
);

const Dashboard = dashboardEffectLayer({
  basePath: "/ops/ui",
  apiBaseUrl: "/control",
  pollingIntervalMs: 5000,
}).pipe(HttpRouter.provideRequest(Platform));

Compose Dashboard with your router. Mount Management at /control; the browser uses /control/rpc. Before serving, add HttpRouter.middleware authentication with Layer.provide(Authentication.layer). Protect assets and deep links too, and use the same identity policy for Management.

apiBaseUrl also accepts an Effect<string, E, R> that reads host services and the current HttpServerRequest. The host handles its failures. For Bun, supply Bun platform services.

HTML uses Cache-Control: no-store; assets use one-year immutable caching. The adapter supports GET, HEAD, custom mounts and Job/Queue View deep links. Missing assets return 404. Paths and symlinks cannot escape the built asset root.