# satwiksai18/interview-practice-partner architecture

> Architecture diagram of the GitHub repository satwiksai18/interview-practice-partner, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/satwiksai18/interview-practice-partner
- Repository: https://github.com/satwiksai18/interview-practice-partner

## Overview

##### Project type and purpose
- This is a full-stack web application:
- A Next.js + TailwindCSS frontend (“ai_interviewer” folder)
- A FASTAPI (Python) backend with WebSocket and OpenAI integration (“backend” folder)
- Purpose: Provide AI-powered mock interviews, question generation, answer evaluation, and analytics.

##### File structure (inferred from README)
- Top-level directories:
- ai_interviewer: Next.js app serving UI, handles routing, state, and connects over HTTP/WebSocket
- backend: FASTAPI application exposing REST endpoints and WebSocket routes, integrates with LLM and database
- Key configuration/deployment files:
- ai_interviewer/package.json, next.config.js, tailwind.config.js
- backend/requirements.txt or package.json (for server.js), Dockerfile (if present)
- Patterns: client-server separation, real-time channel (WebSocket) alongside RESTful API

##### Extract insights from README
- Tech stack overview confirms separation of UI, API, real-time stream, and AI service
- Features hint at a database for storing user sessions, performance metrics, and analytics

##### Main components & their roles
a. Frontend (Next.js + TailwindCSS)
- Renders interview UI, dashboards, user auth, styling
- Communicates via HTTP (question lists, historical data, analytics)
- Opens WebSocket for real-time Q&A sessions
b. Backend (FASTAPI + WebSockets)
- REST API: CRUD for sessions, user profiles, analytics
- WebSocket endpoint: two-way streaming for dynamic follow-ups
- Controller for invoking OpenAI LLM endpoints
c. Database (e.g., PostgreSQL/MongoDB)
- Stores interview sessions, user answers, scores, performance history
d. External AI Service (OpenAI API)
- Generates questions, evaluates responses, produces feedback
e. (Optional) Authentication Service / Cache / Message Broker
- JWT auth, Redis cache for session state or pub/sub if scaling WebSocket

##### Relationships & data flow
- Browser → HTTP REST → Backend → Database
- Browser ↔ WebSocket → Backend → OpenAI API
- Backend → OpenAI → Backend → Database (stores results)
- Backend → HTTP REST → Frontend (analytics data)

##### Architectural patterns & design principles
- Clear separation of concerns: UI, API, AI integration, persistence
- Real-time event-driven communication (WebSockets)
- Stateless API servers with external state (DB, cache)
- Modular code organization: Next.js pages/components, FASTAPI routers/services

3) To the right: “OpenAI API” cloud
- UI → REST → API → DB → API → UI
- UI ↔ WebSocket ↔ API → OpenAI → API → DB

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client"
        direction TB
        Browser["User Browser"]:::frontend
        NextJS["Next.js App"]:::frontend
    end

    %% API Server Layer
    subgraph "API Server"
        direction TB
        REST["REST API (FASTAPI)"]:::backend
        WS["WebSocket Endpoint"]:::backend
    end

    %% External Services
    subgraph "Services"
        direction TB
        OpenAI["OpenAI API"]:::external
    end

    %% Persistence Layer
    DB[(Database)]:::database

    %% Connections
    Browser -->|"HTTP REST"| REST
    NextJS -->|"HTTP REST"| REST
    REST -->|"CRUD Queries"| DB
    DB -->|"Query Results"| REST
    REST -->|"HTTP Response"| NextJS
    NextJS -->|"WebSocket Connect"| WS
    WS ---|"Real-time Messages"| NextJS
    WS -->|"LLM Request"| OpenAI
    OpenAI -->|"LLM Response"| WS
    WS -->|"Store Session Data"| DB

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,color:#004085;
    classDef backend fill:#d4edda,stroke:#155724,color:#155724;
    classDef external fill:#fff3cd,stroke:#856404,color:#856404;
    classDef database fill:#e2e3e5,stroke:#6c757d,color:#6c757d;
```
