Web migration cleanup, runtime electronAPI shim, and VPS deployment#1
Merged
Merged
Conversation
- Remove leftover Electron-only modules: backend/tray, backend/window, backend/logger, backend/tray.ts and backend/types/electron.d.ts. - Drop now-unused electron and electron-updater deps from package.json. - Fix broken '../../../../shared/types' imports in frontend (services, stores, components) to the @shared/types alias. - Add a runtime electronShim that materialises window.electronAPI on top of ApiService so legacy components keep working over HTTP, and emulate push events (proxy status, config, logs) via polling. - Backend now optionally serves the built frontend with SPA fallback so a single port can host the OpenAI proxy, the management API and the web UI simultaneously. - Auto-generate a Management API secret on first run and print it to stdout once; allow pinning via CHAT2API_MANAGEMENT_SECRET. - Bind 0.0.0.0 by default and surface OpenAI / Management / UI URLs in the boot log. - Clean up backend/oauth/manager.ts (drop dead inAppLogin imports and unused storeManager) and re-export inAppLogin types correctly under isolatedModules. - Add Dockerfile, docker-compose.yml, .dockerignore, .env.example and DEPLOYMENT.md for VPS / 24x7 deployments. Co-authored-by: ZhaiKer <216113428+zhaiiker@users.noreply.github.com>
zhaiiker
pushed a commit
that referenced
this pull request
May 21, 2026
…responsive fix: language persistence and mobile responsiveness
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.
This pull request was generated by @kiro-agent 👻
Comment with /kiro fix to address specific feedback or /kiro all to address everything.
Learn about Kiro autonomous agent
Summary
This PR continues the migration from the Electron desktop edition to a pure
Node.js backend + React web UI that can run on a VPS 24/7.
The migration plan in
MIGRATION_PROGRESS.mdclaimed to be complete, butthe running app failed because several layers still pointed at Electron
(tray, window manager, logger) and the frontend's HTTP types/imports were
broken. This PR cleans all that up and gets the project bootable as a pure
web app.
What was broken
backend/tray.ts,backend/tray/,backend/window/,backend/logger/still imported
electron(BrowserWindow / Tray / nativeImage / app).backend/types/electron.d.tsdeclared anelectronmodule ambiently.backend/oauth/manager.tsimported the now-stubinAppLoginManagerandstoreManagereven though neither was used.frontend/src/services/api.tsand several stores imported types from'../../../../shared/types', which resolves outside the project tree.window.electronAPI.*,but
electronAPIwas never set.127.0.0.1and the management API was disabledby default; there was no path that produced a runnable secret.
npm startonly ran theproxy on the API port.
What this PR does
Cleanup
backend/tray.ts,backend/tray/,backend/window/,backend/logger/, andbackend/types/electron.d.ts.electron-updaterandcanvasfrom dependencies.InAppLogin*types asexport typeso theisolatedModulesflag is happy.
backend/oauth/manager.ts.Type / import correctness
frontend/src/types/electron.d.tsso all type imports resolvethrough
@shared/types. TheElectronAPIshape is preserved as aclient-side contract (used by the runtime shim).
'../../../../shared/types'imports in 8 frontend files.Compatibility shim instead of a 30-file rewrite
frontend/src/services/electronShim.ts, which materialiseswindow.electronAPI.*at runtime on top ofApiService. Every legacycall (
window.electronAPI.providers.getAll(), etc.) now goes over HTTPto
/v0/management/*automatically.onStatusChanged,onConfigChanged,onNewLog, ...) with low-frequency polling so dashboards still update.frontend/src/main.tsx.Single-port web deployment
types, sane caching, and SPA index.html fallback.
Set
CHAT2API_FRONTEND_DIRor run afternpm run buildand the UI isreachable on the same port as the API.
0.0.0.0so the container is reachablefrom outside.
secret, persists it, prints it to stdout once, and enables the API.
Operators can pin it with
CHAT2API_MANAGEMENT_SECRETin production.VPS / 24x7 ergonomics
Dockerfile(multi-stage, non-root, prod-only deps) anddocker-compose.yml(named volume for/data, env-driven secret)..dockerignore,.env.example,DEPLOYMENT.mdcovering Caddy /Nginx / systemd setups, environment variables, and data persistence.
Files
Try it
npm ci npm run build npm start # or docker compose up -d --buildThe first-run banner contains the management secret you'll need to log
into the web UI at
http://<host>:8080/.Follow-ups (out of scope for this PR)
window.electronAPI.*and migrate them to callApiServicedirectly(the shim is a stop-gap, not a destination).
oauthflows in the browser context — the in-app browser loginis now stubbed out and only manual-token entry is supported.
/healthPrometheus exporter and adistbuild of the UI tothe Docker image so the
frontend/source isn't needed at runtime.