Files
foxhunt/web-dashboard/vite.config.ts
jgrusewski 84877e5146 feat: add auth gRPC service + migrate dashboard from REST/WS to grpc-web
Backend (Rust):
- Create proto/auth.proto with Login and RefreshToken RPCs
- Implement AuthGrpcService in services/api with JWT issuance
- Register as unauthenticated service in main.rs (pre-auth)
- Update JWT issuer from foxhunt-api-gateway to foxhunt-api

Dashboard (TypeScript):
- Install @connectrpc/connect-web + @bufbuild/protobuf
- Generate TypeScript proto clients via buf (src/gen/)
- Create grpc.ts transport with JWT interceptor
- Rewrite all useApi hooks to typed gRPC calls
- Replace WebSocket with useGrpcStream server-streaming hooks
- Migrate all 6 pages + 6 components to grpc-web
- Delete api.ts, websocket.ts, useWebSocket.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 00:05:18 +01:00

34 lines
1.2 KiB
TypeScript

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [react(), tailwindcss()],
server: {
proxy: {
// Proxy grpc-web requests to the tonic-web gateway
'/auth.AuthService': { target: 'http://localhost:50051' },
'/trading.TradingService': { target: 'http://localhost:50051' },
'/risk.RiskService': { target: 'http://localhost:50051' },
'/ml.MLService': { target: 'http://localhost:50051' },
'/ml_training.MLTrainingService': { target: 'http://localhost:50051' },
'/config.ConfigService': { target: 'http://localhost:50051' },
'/monitoring.MonitoringService': { target: 'http://localhost:50051' },
'/foxhunt.tli.BacktestingService': { target: 'http://localhost:50051' },
},
},
build: {
sourcemap: process.env.NODE_ENV !== 'production',
rollupOptions: {
output: {
manualChunks: {
vendor: ['react', 'react-dom', 'react-router-dom'],
charts: ['lightweight-charts', 'recharts'],
query: ['@tanstack/react-query'],
grpc: ['@connectrpc/connect', '@connectrpc/connect-web', '@bufbuild/protobuf'],
},
},
},
},
})