How sadanandmiskin/intervai works
Project type and purpose
• This is a full-stack web application (“IntervAI”) for AI-powered interview preparation.
• The frontend is a React+TypeScript SPA (Vite + Tailwind) that users interact with in the browser.
• The backend is a Node.js/Express service (TypeScript) exposing REST endpoints and a WebSocket server.
• It uses MongoDB for persistence, JWT for auth, integrates with Google OAuth, and calls out to an external AI service (Fireworks AI) for question generation and evaluation.
File structure
• Top-level docker-compose.yml orchestrates two containers: “frontend” and “backend.”
• backend/
• src/controllers, routes, models, middleware → MVC structure in Express
• index.ts sets up HTTP + WebSocket servers
• .env for secrets (FIREWORKS_API_KEY, MONGODB URI, JWT_SECRET, GOOGLE_CLIENT_ID, FRONTEND_URL)
• frontend/
• src/pages for routing (Home, Login, Create session, Interview, Dashboard, Results)
• src/components for UI, contexts/AuthContext for JWT-based state
• src/services/api.ts wraps HTTP & WebSocket client logic
• Vite config + Tailwind + ESLint
• docker-compose.yml
• Defines two services (frontend, backend), links them, exposes ports 5173 and 3000
Key architecture insights from README
• Real-time Q&A & feedback over WebSockets
• AI question generation & answer evaluation via Fireworks AI
• Persistent session reports stored in MongoDB
• Google Sign-In for user auth
Relationships & data flow
1. Browser → HTTP → Backend REST API
2. Browser ↔ WebSocket → Backend real-time server
3. Backend → Fireworks AI API (HTTP)
4. Backend → MongoDB (read/write)
5. Browser ← JWT in HTTP headers or WS handshake
6. Browser ← Backend responses & WS events
Architectural patterns & design principles
• Single-page frontend separated from backend monolith
• MVC-style controllers, routes, models in backend
• WebSocket + REST hybrid for real-time and traditional API calls
• Environment-driven configuration (12-factor app)
• Containerized via Docker Compose (service orchestration)