How mahalakshmi-design-studioz/ai-mock-interview-react-vite-typescript-january-2025 works
Project type and purpose
• This is a React + TypeScript single‐page application built with Vite.
• It implements an AI-driven mock-interview tool: it accesses the user’s webcam, records/transcribes answers, submits them to Gemini AI, displays feedback or follow-up questions, and saves the session data in Firebase.
File structure
• Top level:
• public, src, components.json, config files (tsconfig, vite.config.ts, tailwind.config.js)
• firebase.json, .firebaserc → Firebase Hosting & config
• src/ contains:
• main.tsx & index.html → SPA entry point
• layouts, routes, components/* → React component hierarchy (UI, forms, modals, containers)
• config/firebase.config.ts → Firebase SDK initialization (Auth & Firestore)
• handlers/auth-handler.tsx → Authentication logic
• scripts/index.ts → auxiliary scripts (if any)
• lib/helpers & utils → pure functions
• provider/toast-provider.tsx → cross-app context provider
• There is no custom backend; the app relies on Firebase (Auth + Firestore) for data persistence and hosting.
Key insights from README
• It’s a minimal Vite + React + TypeScript template with ESLint & Tailwind.
• No built-in server or cloud functions—so all API calls (to Gemini AI) and data operations happen from the client.
Main components & their relationships
a. Frontend (React SPA)
• UI Layers:
– Routes: entry pages (home, sign-in/up, dashboard, mock interview, feedback, report)
– Layouts: public vs. protected vs. auth wrappers
• Components: form for mock interview, video recorder, transcript view, feedback modal, report viewer
b. Firebase Services
• Hosting: serves the built SPA
• Auth: manages user sign-in/up
• Firestore (or RTDB): stores user answers + AI feedback
c. External AI Service
• Gemini AI API: receives transcribed answers, returns feedback or follow-ups
d. Browser APIs
• Webcam / MediaRecorder to capture video/audio
• Web Speech API (or a 3rd-party SDK) to transcribe audio
Data flows & interactions (also see the user’s flowchart):
[Start App]
↓
[Access Webcam] → MediaRecorder
↓
[Transcribe User Answer] → Web Speech API
↓
[Send to Gemini AI] → fetch()/axios to AI endpoint
↓
[Receive Feedback or Follow-up Question]
↓
[Display in Chat UI] → React component (modal/chat bubble)
↓
[Save Answer + Feedback to Firebase] → Firestore write
↓
[End Session]
↓
[Optionally View Saved Report] → read from Firestore → Report page
↓
[End]
Architectural patterns & design principles
• Component-based UI (atomic & compound components under src/components/ui and higher-level containers)
• Single-page application with client-side routing (src/routes + layouts)
• BaaS (Firebase) for Auth & Data → no custom backend
• Separation of concerns: configs, handlers, utils, providers
• Asynchronous workflows orchestrated in React hooks within form-mock-interview.tsx and record-answer.tsx