Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

AI Interviewer

AI Interviewer is a Next.js (App Router) + TypeScript application that simulates a technical interview end-to-end. You browse LeetCode-style problems, launch an interview session with Monaco code editor + sandboxed runner, and collaborate with an AI interviewer that adapts to your behavior.

Features

  • Adaptive interview flows - Session state machine tracks phases (intro/clarify/approach/coding/testing/optimize/wrapup), rubrics, and checkpoints.
  • AI interviewer widget - Floating chat widget with streaming OpenAI responses, Markdown rendering, and configurable tone/hint levels.
  • Sandbox runner - /api/run (sample tests) & /api/submit (full tests) execute user code in temporary files (Node/Python) and return structured results.
  • Code + Chat UX - Monaco editor, console output, autosave snapshots, three-column layout with quick navigation back to problems.
  • Mock problem provider - Bundled problems (Two Sum, Valid Parentheses, Merge Two Lists, Binary Tree Level Order, Longest Substring) served via /lib/providers.
  • Unit tests - Coverage for provider, rubric heuristics, and state-machine transitions via Vitest/JSDOM.

Requirements

  • Node.js 18+ (matching Next.js 14 requirements).
  • npm 9+ (or compatible package manager).
  • Optional: OpenAI API key if you want cloud-based interviewer replies (otherwise, built-in fallback logic will handle responses).

Getting Started

  1. Install dependencies
    npm install
  2. Configure environment Create .env.local with:
    OPENAI_API_KEY=sk-...
    # Optional (defaults to gpt-4o-mini if omitted)
    OPENAI_MODEL=gpt-4o-mini
    Without a key, the interviewer will fall back to scripted prompts.
  3. Run dev server
    npm run dev
    Visit http://localhost:3000.
  4. Production build
    npm run build
    npm start
  5. Tests
    npm test

Project Structure

  • app/ – Next.js routes (home, problems, interview, APIs).
  • components/ – UI building blocks (ProblemPanel, CodeWorkspace, Interviewer widget, chat list, etc.).
  • lib/providers/ – Mock problem provider abstraction.
  • lib/interview/ – Session machine, rubric heuristics, interviewer prompt, client hooks.
  • lib/runner/ – Problem harness builders, sandbox executor, schemas.
  • __tests__/ – Vitest tests.
  • public/ – Static assets (currently empty).

Screenshots

Problem detail Interview chat Chat controls
Problem page Chat page Chat config

Interviewer Engine

  • Client hook useInterviewSession manages session state, autosaves, and triggers interviewer responses when the user sends chat messages.
  • /api/interviewer posts full context to OpenAI using streaming responses (SSE). On failure, it falls back to deterministic heuristics.
  • Chat widget displays streaming Markdown responses and includes controls for hint levels, tone, and question-only toggles.

Runner Implementation

  • Each problem defines JavaScript & Python harnesses in lib/runner/problemTestPlans.ts.
  • lib/runner/sandboxRunner.ts writes user code + harness to a temp file and executes Node.js or Python with timeouts.
  • API routes /api/run & /api/submit validate payloads with Zod and return RunResult objects (pass/fail counts, stderr, per-test details).

Safety & Notes

  • Sandbox runner is for local/dev use; replace with a hardened sandbox (Docker, Firecracker, etc.) before production.
  • AI interviewer respects hint controls and never dumps final solutions unless the user escalates the hint level.
  • LocalStorage autosaves interview progress, so you can resume where you left off.

Scripts

  • npm run dev – Start Next.js dev server.
  • npm run build – Production build.
  • npm run start – Serve production build.
  • npm run lint – ESLint (Next config).
  • npm test – Vitest unit tests.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages