Files
helexa/helexa.ai/vite.config.ts
rob thijssen 79073170ec
All checks were successful
CI / Format (push) Successful in 47s
CI / CUDA type-check (push) Successful in 1m39s
CI / Clippy (push) Successful in 2m38s
CI / Test (push) Successful in 5m24s
CI / Build cortex SRPM (push) Has been skipped
CI / Publish cortex to COPR (push) Has been skipped
CI / Build neuron SRPM (push) Has been skipped
CI / Publish neuron to COPR (push) Has been skipped
CI / Bump version in source (push) Has been skipped
feat(F0): helexa.ai frontend scaffold + monorepo coexistence
New top-level `helexa.ai/` app for the public beta — Vite + React (SWC) +
TypeScript + react-bootstrap + react-router + react-i18next-ready. Not a
Cargo crate; lives beside the workspace.

- Vite with @vitejs/plugin-react-swc (standard Vite + npm, not the
  reference's rolldown/pnpm pin). `vite.config.ts` dev-proxies the mesh
  data-plane (/v1, /health → helexa-router) and account control-plane
  (/api → helexa-upstream /web/v1) same-origin, targets overridable via
  VITE_ROUTER_BASE_URL / VITE_ACCOUNT_BASE_URL.
- tsconfig (app/node, ported from the reference), eslint flat config,
  minimal index.css reset + bootstrap CSS, a placeholder App shell.
- Deps pre-declared for later phases: dexie + dexie-react-hooks (IndexedDB
  chat history), @fingerprintjs/fingerprintjs (anon throttle + register
  fingerprint), i18next/react-i18next, react-icons.
- Monorepo: root .gitignore ignores helexa.ai/{node_modules,dist} +
  .env.local (mirrors the existing /bench entries); committed
  package-lock.json for reproducible installs.

Validated: npm install resolves (vite 7 + plugin-react-swc 4 + react 19),
`npm run lint`/`typecheck`/`build` all green (344 modules via SWC →
dist/). The frontend isn't in the Cargo workspace, so the Rust CI is
unaffected. A path-filtered web CI job is deferred (needs a Node-capable
runner confirmed) and folded into a later phase.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F6o3ddqmYNh9kzdwq6eowh
2026-06-23 09:58:35 +03:00

30 lines
1.1 KiB
TypeScript

import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react-swc";
// During `vite dev`, proxy the mesh data-plane (helexa-router, OpenAI-
// compatible) and the account control-plane (helexa-upstream) so the SPA
// talks to them same-origin without CORS. Targets are overridable via env.
// VITE_ROUTER_BASE_URL — helexa-router (default http://localhost:8088)
// VITE_ACCOUNT_BASE_URL — helexa-upstream (default http://localhost:8090)
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "VITE_");
const router = env.VITE_ROUTER_BASE_URL || "http://localhost:8088";
const account = env.VITE_ACCOUNT_BASE_URL || "http://localhost:8090";
return {
plugins: [react()],
server: {
proxy: {
"/v1": { target: router, changeOrigin: true },
"/health": { target: router, changeOrigin: true },
// The frontend calls /api/*; helexa-upstream serves /web/v1/*.
"/api": {
target: account,
changeOrigin: true,
rewrite: (p) => p.replace(/^\/api/, "/web/v1"),
},
},
},
build: { outDir: "dist" },
};
});