How tanjul17/ai-mock-interview works
Main Components
• User Interface Layer:
• Represented primarily by the Next.js “app” directory where the UI pages are organized.
• Separate branches for authentication: sign-in and sign-up pages exist in app/(auth), and the interview flow is found in app/(root)/interview.
• The top-level layout files (app/layout.tsx and sub-layouts) provide the base for dynamic page rendering.
• API Layer (Backend Logic):
• The API endpoints reside under app/api. Specifically, the vapi endpoint (app/api/vapi/generate/route.ts) handles interactions with Vapi, likely for generating interviews or processing voice interactions.
• Additional business logic is handled in the “lib” directory (such as auth.action.ts and general.action.ts) which organizes core actions and utilities.
• Authentication & Data Storage:
• Firebase is used for authentication and data persistence. Note the firebase directory with admin.ts and client.ts which define different client-side and server-side Firebase interactions.
• The README confirms Firebase is responsible for sign-up/sign-in functionalities and data management.
• External Services Integration:
• Vapi AI Voice agents and Google Gemini are explicitly listed in the README.
• Vapi integration is also indicated by vapi references in the project structure and the SDK in lib/vapi.sdk.ts.
• This layer connects the voice agent functionalities with the backend for producing interviews and feedback.
• UI Components & Design System:
• The “components” and nested “components/ui” directories contain reusable UI components (Agent, AuthForm, InterviewCard, and others). These encapsulate the user experience and are based on shadcn/ui elements.
• Tailwind CSS (along with globals.css in the app directory) provides styling.
Relationships and Interactions
• The user (client browser) interacts with the UI layer (Next.js pages) that renders layouts, forms, and interviews.
• UI components call API endpoints (via fetch or Next.js server routes) to perform operations such as interview generation and authentication.
• Business logic in lib (actions and utilities) consolidates processing for both frontend actions and API calls.
• Firebase (both via client and admin scripts) mediates user authentication and data storage operations.
• External AI services (Vapi AI and Google Gemini) are reached through the API layer, where the Vapi SDK might encapsulate the voice agent interactions. This chain provides AI-driven interview simulation and feedback.
Architectural Patterns and Technologies
• Full-stack Next.js application pattern where frontend and backend coexist.
• Separation of concerns: distinct directories for UI pages (app), reusable components (components), and server/API logic (app/api, lib).
• Integration of external services via dedicated SDKs and API routes.
• Usage of Firebase for authentication/data, ensuring clear segregation between client and server Firebase configurations.
• Adoption of utility-driven design for actions (lib/actions) that reinforces modularity and reusability.