Skip to content

Repository files navigation

Interview Question Generator

A full-stack web application that generates tailored interview questions for any job position using AI. Powered by multiple LLM providers (Claude and Gemini), it delivers role-specific questions in seconds.

Features

  • Generate interview questions for any job title
  • Choose between Claude and Gemini LLM providers
  • Real-time loading feedback
  • Input validation and prompt injection protection
  • Clean, responsive UI built with React and TailwindCSS
  • Serverless-ready deployment on Vercel

Tech Stack

Layer Technology
Frontend React 19, Vite 8, TailwindCSS 4
Backend Node.js serverless functions (Express 5)
LLM Providers Anthropic Claude, Google Gemini
Deployment Vercel
Language JavaScript + TypeScript

Project Structure

interview-generator/
├── src/                            # React frontend
│   ├── features/interview/
│   │   ├── InterviewQuestionGenerator.jsx  # Main UI component
│   │   └── hooks/useInterviewQuestions.js  # State & request hook
│   ├── services/llm/
│   │   └── interviewApiClient.js           # HTTP client for API
│   └── shared/
│       ├── constants.js            # Question count limits
│       ├── helpers.js              # Response parsing utilities
│       ├── httpService.ts          # Typed HTTP wrapper
│       ├── llmEnum.js              # Provider constants
│       └── lang/en/index.ts        # Error messages
│
├── api/                            # Serverless API functions
│   └── llm/
│       ├── [provider]/
│       │   └── interview-question.ts  # POST endpoint handler
│       └── _shared/
│           ├── contract.ts         # Request/response types
│           ├── errorMapper.ts      # Error normalization
│           ├── prompt.ts           # Prompt construction & validation
│           ├── providers.ts        # Claude and Gemini integration
│           └── validate-request.ts # Input validation
│
├── public/                         # Static assets
├── vite.config.js                  # Vite configuration
├── vercel.json                     # Vercel deployment config
└── package.json

Getting Started

Prerequisites

  • Node.js 18+
  • npm
  • API keys for at least one LLM provider (Claude or Gemini)

Installation

git clone https://github.com/chinazagideon/interview-generator.git
cd interview-generator
npm install

Environment Variables

Create a .env file in the project root:

# Claude (Anthropic)
CLAUDE_LLM_API_KEY=your_anthropic_api_key
CLAUDE_LLM_API_URL=https://api.anthropic.com/v1/messages
CLAUDE_LLM_MODEL=claude-sonnet-4-6
CLAUDE_LLM_MAX_TOKENS=1000

# Gemini (Google)
GEMINI_LLM_API_KEY=your_google_api_key
GEMINI_LLM_MODEL=gemini-2.0-flash
GEMINI_LLM_API_URL=https://generativelanguage.googleapis.com/v1beta

You only need to configure the provider(s) you intend to use.

Running Locally

npm run dev

The app will be available at http://localhost:5173. API requests are proxied to the Vite dev server.

To run the API layer via Express locally, set:

VITE_USE_EXPRESS_PROXY=true

Then start the Express server alongside Vite (port 3000).

Build for Production

npm run build      # Outputs to /dist
npm run preview    # Preview the production build locally

Linting

npm run lint

API Reference

POST /api/llm/:provider/interview-question

Generates interview questions for a given job title.

URL Parameters

Parameter Values
provider claude | gemini

Request Body

{
  "jobTitle": "Senior Software Engineer",
  "count": 3
}
Field Type Required Description
jobTitle string Yes The job title (2–120 characters)
count number No Number of questions (1–5, default: 3)

Success Response (200)

{
  "ok": true,
  "data": {
    "questions": [
      "Describe your experience with distributed systems.",
      "How do you approach code reviews?",
      "Walk me through a technically challenging project."
    ]
  },
  "meta": {
    "provider": "claude",
    "model": "claude-sonnet-4-6",
    "requestId": "req_01XYZ"
  }
}

Error Response

{
  "ok": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "jobTitle must be between 2 and 120 characters",
    "retryable": false
  },
  "meta": {
    "provider": "claude"
  }
}

Error Codes

Code HTTP Status Description
VALIDATION_ERROR 400 Invalid jobTitle or count
BAD_PROVIDER 400 Unsupported provider value
UPSTREAM_AUTH 502 LLM API key is invalid or missing
UPSTREAM_RATE_LIMIT 429 LLM provider rate limit exceeded
UPSTREAM_ERROR 502 LLM provider returned an error
INTERNAL_ERROR 500 Unexpected server-side failure

Deployment

This app is configured for zero-config deployment on Vercel.

  1. Push to your GitHub repository
  2. Import the project in the Vercel dashboard
  3. Add your environment variables in the Vercel project settings
  4. Deploy — Vercel handles both the static frontend and serverless API functions automatically

The vercel.json configures:

  • Build command: npm run build
  • Output directory: dist
  • Framework: vite
  • Serverless functions are auto-detected from the /api directory

Security

  • Prompt injection protection: Job title inputs are scanned for injection patterns before being sent to any LLM
  • Input length limits: Job titles are capped at 120 characters; question count is capped at 5
  • No user data stored: Questions are generated on-demand and not persisted

License

MIT

About

Interview Questions Generator - A full-stack web application that generates tailored interview questions for any job position using AI. Powered by multiple LLM providers (Claude and Gemini), it delivers role-specific questions in seconds.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages