Add embedded web console for Route42 management - #2
Merged
Conversation
…dency
Add a small management console served by the gateway at / — Dashboard
(health, local models, usage/spend, client snippets), Models (catalog +
provider keys), Preferences, Playground (recommend + streaming chat),
and Interaction History. Plain HTML/CSS/JS embedded via go:embed: no
build step, no external assets, single-binary story unchanged, and the
visual language matches the Route42 Pro desktop app (dark gray surfaces,
blue-to-purple gradients, Inter).
The console is optional: server.ui (default true, env ROUTE42_UI)
disables it, and the CLI + HTTP API work identically either way. The
auth middleware now guards exactly /api/* and /v1/* so the static
assets are public like /health; the console stores an entered token
and sends it on API calls.
Also:
- GET /api/interactions exposes the existing local interaction log
(limit param, default 50, max 500) for the history page.
- config.Prefs gains snake_case json tags. This fixes the documented
wire format: /api/prefs previously emitted Go field names, and
`prefs set --json '{"fallback_depth":3}'` silently ignored
underscored keys. Storage is column-based SQLite, so existing
databases are unaffected.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JgWPXefHtzYcspK8zo4Bo6
This was referenced Jul 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a built-in single-page web console to Route42, served at the root path (
/). The console provides a dashboard for monitoring AI usage, managing provider keys, configuring routing preferences, and testing prompt routing—all without external dependencies or a build step.Key Changes
Web UI Package (
internal/webui/): New package that embeds static assets (HTML, CSS, JavaScript) using Go'sembeddirective. The console is served as a standard HTTP handler and can be disabled via configuration.Console Assets (
internal/webui/static/):index.html: Single-page app shell with navigation, modals, and layout structureapp.js(716 lines): Zero-dependency SPA with tabs for Dashboard, Models, Preferences, Playground, and History. Handles API communication, token management (localStorage), formatting, and real-time stats renderingstyle.css(489 lines): Hand-rolled dark theme (gray-950/900 surfaces, blue→purple gradients) matching the commercial UI designlogo.svg: Route42 brand markAPI Additions:
internal/api/interactions.go: New/api/interactionsendpoint returning recent routed requests with configurable limit (default 50, max 500)internal/api/routes.goto register the webui handler and interactions endpointinternal/api/server.goto apply auth middleware correctly (UI and/healthremain public even whenapi_tokenis set)Configuration:
server.uiboolean flag (defaulttrue) tointernal/config/config.goto allow disabling the consoledocs/config.mdandcmd/route42/serve.gowith UI configuration and startup loggingTesting: Added
internal/api/webui_test.gowith tests for UI serving, disabling, auth scope, and the interactions endpointImplementation Details
/healthremain public; only/api/*endpoints require the bearer token when configured.go:embed, maintaining the single-binary deployment story.https://claude.ai/code/session_01JgWPXefHtzYcspK8zo4Bo6