How modamaan/ai-mock-interview works
Main Components
• Frontend (Presentation Layer): This is built with Next.js and Tailwind CSS. It handles user interfaces such as the authentication pages (sign-in and sign-up routes in the “app/(auth)” directory), main entry pages (app/page.js and app/layout.js), and the Dashboard components (found in “app/dashboard/…”). Additionally, there is a components library (e.g., “components/ui”) which supplies shared UI elements.
• Business Logic & Routing: Next.js’s app router is utilized here. The “app/dashboard/interview”, “app/dashboard/question”, “app/dashboard/upgrade”, and similar directories represent different interactive flows of the platform. Middleware (middleware.js) ensures that user requests are processed (e.g., authentication, session management) before they reach the actual pages.
• Backend & Database Access: Although the platform is primarily built as a Next.js application, backend logic is integrated into API routes or server-side rendered pages. Supporting files in “lib” and “utils” (e.g., utils/db.js, utils/schema.js) indicate the existence of data-access layers making use of Drizzle ORM to interact with a PostgreSQL database.
• External Services: A key component is the integration with the Gemini API that powers the AI interview functionalities. There is also an ecosystem setup for deployment (via Dockerfile, compose.yaml, and Neon Serverless for PostgreSQL) that ensures scalability.
Relationships and Interactions
• The Frontend communicates with the backend using Next.js API routes and server-side rendering. For instance, when a user initiates a mock interview, the UI sends requests to backend routes that request AI-generated interview questions from Gemini API.
• Authentication components handle sign-in and sign-up flows and secure routes via middleware.
• The Business Logic layer then interacts with the database through Drizzle ORM. This ensures smooth data retrieval and persistence (e.g., saving interview sessions, fetching question banks).
• The external Gemini API is called from the backend business logic layer to retrieve and process AI-specific data.
Architectural Patterns and Key Technologies
• Next.js’s App Router: Implements page-based navigation, dynamic routing (e.g., pages like interview/[interviewId]), and server-side rendering.
• MVC/Component Pattern: The project is divided between UI components (in “components” and “app/_components”), business logic (organized in structured directories under “app/dashboard”), and data management (found in “lib” and “utils”).
• Integration Components: The use of Docker (Dockerfile, .dockerignore, compose.yaml) for containerization and deployment, and configuration files (drizzle.config.js, tailwind.config.js, next.config.mjs) further clarify the tech stack.
• Database Abstraction: Drizzle ORM abstracts PostgreSQL database interactions.