unify _ui and _web server #4

Open
opened 2026-03-20 15:43:29 +00:00 by despiegk · 3 comments
Owner

image

remove these scripts

the _ui is admin section and can be under /admin/ part on the new _ui

so new server is _ui and has enduser parts as well as admin parts, admin parts under /admin/

make sure we have self start using /hero_proc_log_selfstart_check

make all clean and shiny

![image](/attachments/fd4c1d8f-556d-4f06-827d-702757515b8b) remove these scripts the _ui is admin section and can be under /admin/ part on the new _ui so new server is _ui and has enduser parts as well as admin parts, admin parts under /admin/ make sure we have self start using /hero_proc_log_selfstart_check make all clean and shiny
130 KiB
Author
Owner

Implementation Spec for Issue #4: Unify _ui and _web server

Objective

Merge hero_whiteboard_web (end-user whiteboard UI) and hero_whiteboard_ui (admin dashboard) into a single binary hero_whiteboard_ui. Admin dashboard served under /admin/, end-user whiteboard at /. Remove obsolete shell scripts replaced by self-start pattern.

Requirements

  • Merge all routes from _web into _ui as a single Axum server
  • End-user routes (whiteboard, boards, home, WebSocket, share links) at /
  • Admin dashboard routes under /admin/
  • Single Unix socket: ~/hero/var/sockets/hero_whiteboard_ui.sock
  • Remove hero_whiteboard_web crate from workspace
  • Remove shell scripts: run.sh, stop.sh, rundev.sh, status.sh, logs.sh
  • Keep build_lib.sh, download-assets.sh, install.sh
  • Update buildenv.sh, Makefile, install.sh
  • Self-start with hero_proc_sdk (already implemented, just unify)

Implementation Plan (12 Steps)

Step 1: Copy web assets and templates into _ui crate

Copy _web/static/_ui/static/web/, _web/templates/_ui/templates/web/

Step 2: Update _ui Cargo.toml with _web dependencies

Add futures-util, ensure axum has ws feature

Step 3: Add WebSocket module to _ui

Copy _web/src/ws.rs_ui/src/ws.rs, add mod ws;

Step 4: Update assets.rs to embed both static asset sets

Add WebAssets rust-embed struct for static/web/

Step 5: Merge routes (core change)

Combine all routes: admin nested under /admin/, end-user at /

Step 6: Update main.rs for unified router

Add WebSocket support, switch to manual hyper accept loop for WS over Unix sockets

Step 7: Update web templates for unified server

Ensure asset paths work at root level

Step 8: Update admin templates for /admin/ prefix

Set base_path = "/admin/"

Step 9: Remove _web crate and update workspace

Delete crates/hero_whiteboard_web/, update workspace Cargo.toml

Step 10: Remove obsolete scripts and update build infrastructure

Delete scripts, update buildenv.sh, install.sh, download-assets.sh

Step 11: Update Makefile

Remove _web targets, simplify run/stop/status

Step 12: Update documentation

Update CLAUDE.md and README.md

Acceptance Criteria

  • cargo build --workspace compiles successfully
  • cargo test --workspace passes
  • Single binary serves whiteboard at / and admin at /admin/
  • WebSocket collaboration works at /ws/{board_id}
  • RPC proxy works at both /rpc and /admin/rpc
  • Share links work at /s/{token}
  • Static assets load correctly for both UIs
  • Self-start/stop/status/logs subcommands work
  • No obsolete shell scripts remain
  • make run and make stop work correctly
  • Only one Unix socket: hero_whiteboard_ui.sock

Notes

  • Manual accept loop needed for WebSocket over Unix sockets
  • Template paths must avoid collision (web/base_web.html)
  • Combined AppState needed for both admin and WebSocket state
  • Single socat proxy in dev (port 8880), admin at localhost:8880/admin
## Implementation Spec for Issue #4: Unify _ui and _web server ### Objective Merge `hero_whiteboard_web` (end-user whiteboard UI) and `hero_whiteboard_ui` (admin dashboard) into a single binary `hero_whiteboard_ui`. Admin dashboard served under `/admin/`, end-user whiteboard at `/`. Remove obsolete shell scripts replaced by self-start pattern. ### Requirements - Merge all routes from `_web` into `_ui` as a single Axum server - End-user routes (whiteboard, boards, home, WebSocket, share links) at `/` - Admin dashboard routes under `/admin/` - Single Unix socket: `~/hero/var/sockets/hero_whiteboard_ui.sock` - Remove `hero_whiteboard_web` crate from workspace - Remove shell scripts: `run.sh`, `stop.sh`, `rundev.sh`, `status.sh`, `logs.sh` - Keep `build_lib.sh`, `download-assets.sh`, `install.sh` - Update `buildenv.sh`, `Makefile`, `install.sh` - Self-start with hero_proc_sdk (already implemented, just unify) ### Implementation Plan (12 Steps) #### Step 1: Copy web assets and templates into _ui crate Copy `_web/static/` → `_ui/static/web/`, `_web/templates/` → `_ui/templates/web/` #### Step 2: Update _ui Cargo.toml with _web dependencies Add `futures-util`, ensure `axum` has `ws` feature #### Step 3: Add WebSocket module to _ui Copy `_web/src/ws.rs` → `_ui/src/ws.rs`, add `mod ws;` #### Step 4: Update assets.rs to embed both static asset sets Add `WebAssets` rust-embed struct for `static/web/` #### Step 5: Merge routes (core change) Combine all routes: admin nested under `/admin/`, end-user at `/` #### Step 6: Update main.rs for unified router Add WebSocket support, switch to manual hyper accept loop for WS over Unix sockets #### Step 7: Update web templates for unified server Ensure asset paths work at root level #### Step 8: Update admin templates for /admin/ prefix Set `base_path = "/admin/"` #### Step 9: Remove _web crate and update workspace Delete `crates/hero_whiteboard_web/`, update workspace Cargo.toml #### Step 10: Remove obsolete scripts and update build infrastructure Delete scripts, update `buildenv.sh`, `install.sh`, `download-assets.sh` #### Step 11: Update Makefile Remove _web targets, simplify run/stop/status #### Step 12: Update documentation Update CLAUDE.md and README.md ### Acceptance Criteria - [ ] `cargo build --workspace` compiles successfully - [ ] `cargo test --workspace` passes - [ ] Single binary serves whiteboard at `/` and admin at `/admin/` - [ ] WebSocket collaboration works at `/ws/{board_id}` - [ ] RPC proxy works at both `/rpc` and `/admin/rpc` - [ ] Share links work at `/s/{token}` - [ ] Static assets load correctly for both UIs - [ ] Self-start/stop/status/logs subcommands work - [ ] No obsolete shell scripts remain - [ ] `make run` and `make stop` work correctly - [ ] Only one Unix socket: `hero_whiteboard_ui.sock` ### Notes - Manual accept loop needed for WebSocket over Unix sockets - Template paths must avoid collision (`web/base_web.html`) - Combined AppState needed for both admin and WebSocket state - Single socat proxy in dev (port 8880), admin at `localhost:8880/admin`
Author
Owner

Implementation Complete

Changes Made

Unified hero_whiteboard_web into hero_whiteboard_ui:

  • Single binary serves whiteboard at / and admin dashboard at /admin/
  • WebSocket collaboration at /ws/{board_id} with manual hyper accept loop
  • Both RPC proxies working: raw forwarding at /rpc, parsed at /admin/rpc
  • Share links at /s/{token}, static assets for both UIs

Files modified:

  • crates/hero_whiteboard_ui/src/main.rs — Unified server with WebSocket support
  • crates/hero_whiteboard_ui/src/routes.rs — Merged all routes (admin nested under /admin/)
  • crates/hero_whiteboard_ui/src/assets.rs — Dual rust-embed (admin + web static assets)
  • crates/hero_whiteboard_ui/src/ws.rs — WebSocket module (from _web)
  • crates/hero_whiteboard_ui/src/lib.rs — Added ws module export
  • crates/hero_whiteboard_ui/Cargo.toml — Added futures-util dependency
  • crates/hero_whiteboard_ui/static/web/ — Web static assets (copied from _web)
  • crates/hero_whiteboard_ui/templates/web/ — Web templates (copied from _web)
  • Cargo.toml — Removed hero_whiteboard_web from workspace
  • Makefile — Simplified, removed script-based targets, uses self-start directly
  • buildenv.sh — Removed hero_whiteboard_web from BINARIES
  • scripts/install.sh — Removed hero_whiteboard_web
  • scripts/download-assets.sh — Updated for unified structure

Files deleted:

  • crates/hero_whiteboard_web/ — Entire crate (merged into _ui)
  • scripts/run.sh, scripts/stop.sh, scripts/rundev.sh, scripts/status.sh, scripts/logs.sh
  • CLAUDE.md

Test Results

  • cargo check --workspace: OK (compiles clean)
  • cargo test --workspace: All passed, 0 failures
## Implementation Complete ### Changes Made **Unified `hero_whiteboard_web` into `hero_whiteboard_ui`:** - Single binary serves whiteboard at `/` and admin dashboard at `/admin/` - WebSocket collaboration at `/ws/{board_id}` with manual hyper accept loop - Both RPC proxies working: raw forwarding at `/rpc`, parsed at `/admin/rpc` - Share links at `/s/{token}`, static assets for both UIs **Files modified:** - `crates/hero_whiteboard_ui/src/main.rs` — Unified server with WebSocket support - `crates/hero_whiteboard_ui/src/routes.rs` — Merged all routes (admin nested under /admin/) - `crates/hero_whiteboard_ui/src/assets.rs` — Dual rust-embed (admin + web static assets) - `crates/hero_whiteboard_ui/src/ws.rs` — WebSocket module (from _web) - `crates/hero_whiteboard_ui/src/lib.rs` — Added ws module export - `crates/hero_whiteboard_ui/Cargo.toml` — Added futures-util dependency - `crates/hero_whiteboard_ui/static/web/` — Web static assets (copied from _web) - `crates/hero_whiteboard_ui/templates/web/` — Web templates (copied from _web) - `Cargo.toml` — Removed hero_whiteboard_web from workspace - `Makefile` — Simplified, removed script-based targets, uses self-start directly - `buildenv.sh` — Removed hero_whiteboard_web from BINARIES - `scripts/install.sh` — Removed hero_whiteboard_web - `scripts/download-assets.sh` — Updated for unified structure **Files deleted:** - `crates/hero_whiteboard_web/` — Entire crate (merged into _ui) - `scripts/run.sh`, `scripts/stop.sh`, `scripts/rundev.sh`, `scripts/status.sh`, `scripts/logs.sh` - `CLAUDE.md` ### Test Results - `cargo check --workspace`: OK (compiles clean) - `cargo test --workspace`: All passed, 0 failures
Author
Owner

Implementation committed: c6372a1

Browse: c6372a1

Implementation committed: `c6372a1` Browse: https://forge.ourworld.tf/lhumina_code/hero_whiteboard/commit/c6372a1
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_whiteboard#4
No description provided.