# Repository Guidelines This monorepo hosts a Vite + React + TypeScript frontend and a Rust backend (HTTP/WS) focused on low‑latency streaming of transcribed conversations. Use this guide for structure, commands, style, tests, and PRs. ## Project Structure & Module Organization - `frontend/src/components/` React UI components (`PascalCase.tsx`). - `frontend/src/services/` client utilities (`ws.ts` for WebSocket, `http.ts`). - `frontend/src/stores/` Nanostores state; `frontend/src/styles/` global CSS. - `frontend/public/` static assets; `frontend/dist/` build output. - Backend at repo root: `src/`, `Cargo.toml`, optional `tests/`. HTTP at `/` and `/api/*`; streaming via SSE `/api/stream/transcript` and WS `/ws`. - Root holds repo configs/docs (e.g., `TODO.md`, this `AGENTS.md`). ## Build, Test, and Development Commands Frontend (from `frontend/`): - `npm run dev` — start Vite dev server (`http://localhost:5173`). - `npm run build` — type‑check and build to `dist/`. - `npm run preview` — serve the production build. Backend (from repo root): - `cargo run` — run the Rust server in dev. - `cargo build --release` — production build. - `cargo test` — run unit/integration tests. - `cargo fmt --all --check` and `cargo clippy -- -D warnings` — style/lints. ## Coding Style & Naming Conventions - TypeScript: strict mode; 2‑space indent; single quotes; minimal semicolons. Components `PascalCase.tsx`; utilities/types `camelCase.ts`; CSS `kebab-case.css`. Group imports: built‑in, third‑party, internal. - Rust: `rustfmt` defaults; files/modules `snake_case.rs`; types/traits `PascalCase`; functions/vars `snake_case`; constants `SCREAMING_SNAKE_CASE`. - Lint/format: No ESLint/Prettier configured; prefer ESLint + `@typescript-eslint` and Prettier if added. ## Testing Guidelines - Frontend: Vitest + React Testing Library. Name tests `Component.test.tsx` or use `src/__tests__/`. Cover `src/stores`, `src/services`, and key components. - Backend: `cargo test`. Unit tests in modules; integration tests in `tests/`. Validate `/health`, `/api/echo`, and streaming shapes (SSE/WS). ## Commit & Pull Request Guidelines - Commits: Do not use Conventional Commits. Write clear, imperative subjects without prefixes (no `feat:`, `fix:`, etc.). Keep subjects concise; add a short body when useful to explain why and impact. Example: `Update mission screen to keep CTAs fixed`. - PRs: Small, focused; include description, linked issues, and screenshots/GIFs for UI. When changing streaming payloads, document sample SSE and WS messages. - Quality gate: `npm run build` passes; `cargo clippy` has no warnings. Do not commit `frontend/dist/`, `.vite/`, or Rust `target/`. ## Security & Configuration Tips - Frontend: set `VITE_WS_URL` in `frontend/.env.local` (e.g., `ws://localhost:8080/ws`) and consume via `import.meta.env.VITE_WS_URL`. - Backend: prefer env vars (`PORT=8080`, `RUST_LOG=info`). Avoid committing secrets.