Documentation
¶
Overview ¶
Package ui exposes the built Vite bundle as an embedded filesystem.
The bundle is produced by `pnpm --prefix ui build` (CI: the Dockerfile runs it in a node:22 stage, then the final image stage compiles tasksd with this embed). The resulting ui/dist is baked into the tasksd binary — no external static-assets directory, no sidecar, no separate deploy.
Mount the returned handler at / in the Temporal frontend HTTP router so it serves the SPA shell for every non-API request:
import tasksui "github.com/hanzoai/tasks/ui"
router.PathPrefix("/").Handler(tasksui.Handler())
The Temporal gRPC-Gateway routes under /api/v1/* take precedence via earlier route registration; everything else falls through to the SPA, which supports client-side routing (react-router) so deep links survive reload.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FS ¶
FS returns the embedded built-UI filesystem rooted at dist/. Empty when the build step has not run (dev workflow uses the Vite dev server instead — see ui/vite.config.ts).
func Handler ¶
Handler returns an http.Handler that serves the embedded SPA.
Behaviour:
- Exact-match static assets (JS/CSS/images) ship with immutable cache hints because Vite hashes filenames.
- Anything else rewrites to /index.html so the React router handles the route client-side. This is the standard SPA fallback and is the only way react-router's BrowserRouter survives a page reload on a deep link.
- If the build hasn't run and index.html is missing, every request returns 503 so operators notice in staging before shipping a blank image to production.
Types ¶
This section is empty.