web

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

README

web

The dashboard for the control plane. It is embedded into the Go binary with embed.FS, so the server needs no Node runtime and no separately hosted frontend.

Stack

React 19, Vite, TypeScript (strict), Tailwind CSS, TanStack Router (file-based routes in src/routes, split per route), TanStack Query and TanStack Virtual. UI components come from @glinui/ui.

Run, test, build

npm install                 # install dependencies
npm run dev                 # Vite dev server
npm test                    # vitest run, component and hook tests under src/
npm run test:watch          # vitest in watch mode
npm run typecheck           # tsc -b only
npm run lint                # eslint (lint:fix to fix)
npm run format:check        # prettier --check (format to write)
npm run build               # production build in dist/
npm run check-bundle-size   # compare chunk sizes with bundle-budgets.json

CI runs tests, type checks and lint in the "Web (tsc, eslint)" job whenever web/ changes. npm run build also writes dist/stats.html, a treemap of chunk sizes.

Conventions

  • No data fetching in component bodies. Route loaders prime the Query cache and components read it with useSuspenseQuery or useSuspenseInfiniteQuery on the same key.
  • Query keys come from a factory per resource (see src/queries/apps.ts), never an inline array.
  • Lists that can exceed 50 items are virtualized with @tanstack/react-virtual.
  • No any. src/routeTree.gen.ts is generated on every dev and build run and is not committed.

i18n and icons

User-facing text goes through i18n, with files under src/locales and setup in src/i18n. Brand marks come from @thesvg/react and UI icons from @thesvg/ui-react. The checks and how to run them are in Contributing guards.

Documentation

Overview

Package web embeds the built frontend via embed.FS, keeping the control plane a single static binary with no Node runtime required on the server, and serves it with client-side-routing fallback, so a hard refresh or direct link to a TanStack Router path like /apps/foo resolves correctly instead of 404ing at the server before React Router ever gets a chance to handle it.

Index

Constants

This section is empty.

Variables

View Source
var DistFS embed.FS

DistFS is intentionally empty (Go's embed.FS zero value, no //go:embed directive) in the default build. web/dist is a gitignored build artifact that doesn't exist until `npm run build` runs; a bare //go:embed dist here would make plain `go build ./...` fail on any checkout that hasn't built the frontend yet, breaking it repo-wide, including every quick sanity `go build`/`go vet`/`golangci-lint run` both this project's git hooks and CI already rely on. The real frontend is embedded only by an explicit `-tags embedweb` build, after `cd web && npm run build`; see embed_real.go and Handler's doc comment for what happens when it isn't.

Functions

func Handler

func Handler(b *brand.Brand) http.Handler

Handler serves the embedded frontend. If this binary wasn't built with -tags embedweb (the default, see embed_stub.go), it serves a 501 with an actionable message instead of panicking or 404ing silently: a missing frontend is a build configuration fact worth surfacing clearly, not a routing failure to debug.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL