Web-based chat interface for the Shre AI platform. All AI routing goes through shre-router for trust gate, budget enforcement, cost tracking, and conversation learning.
Port: 5510 | Stack: Vite + React 19 + Zustand | Backend: Node.js (serve.js)
# Install dependencies
pnpm install
# Development (hot reload on port 5000)
npm run dev
# Production build + serve
npm run build
npm run serve # Starts on port 5510Open http://localhost:5510 in your browser. Login: rapidnir / rapid@nir
Browser ──► serve.js (port 5510) ──► shre-router (port 5497) ──► AI providers
│ │
├── /api/auth/* ├── Trust gate
├── /api/router/v1/chat ├── Budget enforcement
├── /api/sessions/* ├── Cost tracking
├── /ws/terminal (PTY) └── Model routing
└── /ws/notifications
| File | Purpose |
|---|---|
serve.js |
Production server: auth, proxy, sessions, WebSocket, voice |
src/ChatView.tsx |
Main chat UI: messaging, streaming, agent switching |
src/Sidebar.tsx |
Session list, navigation, agent picker |
src/StatusBar.tsx |
Connection status, agent count, tasks, calendar |
src/TerminalView.tsx |
Embedded terminal (xterm.js + PTY) |
src/store.ts |
Zustand state: sessions, messages, streaming |
contract.json |
API contract: all endpoints, types, events |
routes/auth.js |
Authentication: JWT, 2FA, rate limiting |
routes/voice.js |
Voice: STT/TTS via shre-router |
- User types message in
ChatView.tsx router-client.tssends POST to/api/router/v1/chatserve.jsproxies to shre-router:5497 (SSE streaming)- shre-router: trust gate -> budget -> RAG -> routing -> provider -> cost recording
- Response streams back as SSE events
| Path | Purpose |
|---|---|
/ws/terminal |
PTY terminal sessions |
/ws/notifications |
Reminders, status updates, project progress |
| Command | Description |
|---|---|
npm run dev |
Vite dev server (port 5000, hot reload) |
npm run build |
Production Vite build to dist/ |
npm run serve |
Start production server (port 5510) |
npm run preview |
Vite preview (port 5510) |
npm run build:app |
Build Electron desktop app |
npm test |
Vitest unit tests (302 tests, includes component tests via @testing-library/react) |
npm run lint |
ESLint on src/ (uses root eslint.config.mjs) |
npm run lint:fix |
ESLint auto-fix |
npm run format |
Prettier write src/**/*.{ts,tsx,json,md} |
npm run format:check |
Prettier check without writing |
npm run test:e2e |
Run all Playwright E2E tests |
npm run qa |
Full QA: run tests + create bug tasks |
npm run qa:agent -- chat-core |
Run single test agent |
npm run qa:rerun |
Re-run only failed tests |
npm run qa:dry |
Test run without creating tasks |
npm run test:android |
Run tests on connected Android device |
Pre-commit runs lint-staged via husky: ESLint --fix + Prettier --write
on staged src/**/*.{ts,tsx,json,md,yml,yaml} files.
See docs/TESTING.md for the full test guide including Android device testing.
# Quick smoke test
npm run qa:agent -- smoke
# Full QA suite (all 16 agents, ~8 min)
npm run qa
# Test on Android device (USB debugging required)
npm run test:androidSee docs/CONFIGURATION.md for environment variables, ports, and auth setup.
| Service | Port | Required | Purpose |
|---|---|---|---|
| shre-router | 5497 | Yes | AI routing, trust gate, cost tracking |
| shre-auth | 5455 | Yes | Authentication |
| shre-tasks | 5460 | Optional | Task creation from chat |
| shre-fleet | 5498 | Optional | Agent count for status bar |
| Ollama | 11434 | Optional | Local model fallback |
| Document | Description |
|---|---|
| Architecture | System design, data flow, component map |
| API Reference | All endpoints with request/response examples |
| Testing Guide | Test infrastructure, agents, Android testing |
| Configuration | Environment variables, ports, auth |
| Troubleshooting | Common issues and fixes |
| CLAUDE.md | AI assistant context (auto-loaded) |