This guide helps you get started developing HAMi-WebUI.
Make sure you have the following dependencies installed before setting up your developer environment:
- Git
- Make
- Go (use the version in
server/.go-version) - Node.js (use the version in
.node-version) - pnpm (use the version in the root
package.json) - Protocol Buffers compiler (
protoc) - Docker, only when building local container images
We recommend using Homebrew for installing any missing dependencies:
brew install git
brew install go
brew install node@24
brew install protobuf
export PATH="$(brew --prefix node@24)/bin:$PATH"
corepack enable
We recommend using the Git command-line interface to download the source code for the HAMi-WebUI project:
- Open a terminal and run
git clone https://github.com/Project-HAMi/HAMi-WebUI.git. This command downloads HAMi-WebUI to a newhami-webuidirectory in your current directory. - Open the
HAMi-WebUIdirectory in your favorite code editor.
For alternative ways of cloning the HAMi-WebUI repository, refer to GitHub's documentation.
Run dependency installation explicitly once from the repository root. Normal build and development commands never update dependencies as a side effect.
make bootstrap
export PATH="$(go env GOPATH)/bin:$PATH"
make -C server bootstrap
pnpm exec playwright install chromiummake bootstrap uses the committed lockfile and fails instead of rewriting it.
The server bootstrap installs the pinned Go code generators; protoc remains a
system prerequisite. Re-run the relevant bootstrap command only after its
dependency or tool versions change. On Linux, use
pnpm exec playwright install --with-deps chromium when Chromium's system
libraries are not already installed.
Chart 2 deploys one application image and one container. Its Go process serves
the built Vue application on port 3000, invokes the versioned API handler
in-process, and exposes readiness, metrics, and diagnostics on the internal port
8000.
Node.js and pnpm remain build and test dependencies for the Vue application. They are not present in the production image.
The backend reads the active kubeconfig context and
server/config/config.yaml. Select a
development cluster you are authorized to inspect and configure a reachable
Prometheus address before starting it.
Build the SPA assets, generate the Go API code, and launch hami-webui from the
repository root:
make build
make -C server generate
(cd server && go run ./cmd/hami-webui --conf ./config/config.yaml --static-dir ../public --listen-address 127.0.0.1:8080)cmd/hami-webui defaults --listen-address to :3000 (for standalone use
without Vite) and serves /metrics and /readyz on :8000 (from
server/config/config.yaml). Passing 127.0.0.1:8080 leaves :3000 free for
the Vite development server.
Start the backend on 127.0.0.1:8080, then run make dev in the repository
root. This starts the Vite development server; NestJS is not part of the browser
development path. Vite forwards /api/v1/* directly to
HAMI_WEBUI_BACKEND_URL (default http://127.0.0.1:8080) without stripping a
prefix.
Open http://localhost:3000/. Set HAMI_WEBUI_BACKEND_URL when the backend
uses another origin:
HAMI_WEBUI_BACKEND_URL=http://127.0.0.1:18000 make devBefore opening a pull request, run the checks for the area you changed:
make verify
make -C server verify
bash scripts/verify-chart.sh # when the Helm chart changesThe root verification target covers Vue lint and tests, the production asset build, the Go Web entry, and its HTTP and Chromium contracts. The server target generates code before building, vetting, and testing every Go package. CI calls the same granular Make targets so local and pull-request behavior stay aligned.
To exercise the standalone Web entry while changing its static-serving contract:
make build build-web-entry
server/build/web-entry --static-dir ./public --backend-url http://127.0.0.1:8080The backend API listener must be available at --backend-url for /api/v1/*
requests in this standalone mode.
Use BlockBox with variant="detail" for the main information, resource and
allocation sections on detail pages. Pass the section heading through title
and heading actions through the extra slot, so the shared component owns the
space around the heading and content.
| Spacing layer | Detail section rule |
|---|---|
| Card padding | 12px top, 16px on the other sides |
| Section heading | 16px, weight 500, line height 28px |
| Heading to content | 8px |
| Between sibling sections | 16px |
| Before the trend controls | 24px |
Do not add a second top margin to the first content element or override these
values independently on each page. A flex or grid parent that owns the section
gap should clear its children's outer margins. Internal allocation diagrams,
tables and chart legends keep their own content spacing; the default BlockBox
variant remains available for chart and dashboard cards.
Check Chinese and English at 1280, 1366, 1440 and 1920 CSS pixels when changing these shared rules. Include long device names, multiple devices, help buttons, and loading or unavailable states, as well as the normal populated view.
The official image owns its OCI entrypoint; the Chart does not inject an implementation-specific command. The image runs as a numeric non-root user and is verified on amd64 and arm64 with a read-only root filesystem.
The public listener exposes the SPA and only the versioned HAMi Web API below
/api/v1/*. Internal /metrics and /readyz endpoints remain on port 8000
for readiness probes and Prometheus scraping. The browser API calls the backend
handler directly in-process; there is no loopback reverse proxy.
The unified application accepts these optional environment variables:
| Variable | Default | Purpose |
|---|---|---|
HAMI_WEBUI_LISTEN_ADDRESS |
:3000 |
Public Web listener; the Chart requires :3000 |
HAMI_WEBUI_STATIC_DIR |
/apps/public |
Built Vue asset directory |
HAMI_WEBUI_BASE_PATH |
/ |
Public URL prefix; the reverse proxy must preserve it |
HAMI_WEBUI_FRAME_ANCESTORS_JSON |
unset | JSON framing allowlist; [] blocks all parents |
HAMI_WEBUI_HEALTHCHECK_URL |
http://127.0.0.1:3000/health_check |
Target used only by --healthcheck |
HAMI_WEBUI_BACKEND_URL and HAMI_WEBUI_PROXY_TIMEOUT apply only to the
standalone Web-entry development binary. They are intentionally absent from the
Chart 2 in-process runtime. The public port, health endpoint, and versioned API
prefix are compatibility contracts; filesystem paths and executable names are
not.
The application can serve the SPA below a configured base path and emit a
validated CSP frame-ancestors policy. These are runtime settings, not Vite
build variables. The unprefixed /health_check remains stable for Chart probes.
When installing with Helm, use frontend.basePath and
frontend.frameAncestors; the Chart owns the corresponding generated
environment variables so its Ingress checks and access notes describe the
actual runtime. Direct image and local binary users can continue using the
environment variables above.
The primary Service routes browser traffic to port 3000. An independently
labelled *-backend ClusterIP Service routes port 8000 to the same container
and is the only Service selected by the included ServiceMonitor. The backend
component label belongs to this discovery Service, not to a separate workload
or authorization boundary. The primary Service never exposes port 8000 in
Chart 2.
The startup probe waits for /readyz on port 8000 for up to 300 seconds so
Kubernetes informer caches can synchronize. After startup, readiness and
liveness probe /health_check on port 3000. This separates slow initial data
bootstrap from the ongoing ability to serve the Web entry.
Build the same application image used by development publication, Chart 2, and release candidates:
make build-imageThe resulting image is tagged hami-webui:dev. Override DOCKER_IMAGE,
VERSION, or PLATFORM when a local integration environment needs another tag
or architecture:
make build-image \
DOCKER_IMAGE=my-registry/hami-webui \
VERSION=test \
PLATFORM=linux/amd64This target builds one local image and never pushes it. Stable multi-platform images, the Helm chart, release tag, and release notes are published only through the verified release process.
Chart 1.3 rollback restores its complete two-image deployment. Do not combine a Chart 1.x frontend or backend image with the Chart 2 templates; see the Helm migration guide.