This guide explains how to set up the Supabase database and AI features for the Interview Kit application.
- A Supabase account (supabase.com)
- A Groq API key (console.groq.com)
- Create a new project in Supabase
- Go to the SQL Editor in your Supabase dashboard
- Copy the contents of
supabase-schema.sqland run it in the SQL Editor - This will create:
- The
questionstable with proper schema - Indexes for better query performance
- Row Level Security (RLS) policies
- The
Create a .env.local file in the root directory with the following variables:
# Supabase
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
# Groq AI
GROQ_API_KEY=your_groq_api_key
# Admin Password
NEXT_PUBLIC_ADMIN_PASSWORD=your_admin_passwordHow to get these values:
-
Supabase URL & Anon Key:
- Go to Project Settings > API in your Supabase dashboard
- Copy the "Project URL" and "anon/public" key
-
Groq API Key:
- Sign up at console.groq.com
- Create an API key in your account settings
-
Admin Password:
- Choose a secure password for accessing the admin dashboard
bun installbun dev- Add Questions: Submit interview questions with AI assistance
- Email Verification: Valid personal/educational emails only (no disposable emails)
- AI Answer Generation: Click "Ask AI" to generate short, interview-focused answers
- AI Enhancement: Click "Enhance" to improve your written answers
- Access: Navigate to
/adminand enter your admin password - Review Questions: See all pending questions sorted by submission date
- Approve/Reject: Take action on submitted questions
- Real-time Updates: Questions are immediately reflected in the system
The questions table includes:
id: Unique identifier (generated with nanoid)question: The interview question textanswer: The answer textdifficulty: Easy, Medium, or Hardrole_tags: Array of role tags (e.g., Frontend, Backend)subject_tags: Array of subject/language tags (e.g., React, JavaScript)email: Submitter's email (required for verification)status: drafted, approved, or rejectedcreated_at: Timestamp of submissionupdated_at: Timestamp of last update
- Row Level Security (RLS) is enabled on the questions table
- Public users can:
- Insert new questions (submissions)
- Read approved questions only
- For admin operations (approve/reject), the API uses the anon key but you should consider implementing proper authentication for production
- Email verification prevents spam submissions using disposable emails
POST /api/answer: Generate AI answers for questionsPOST /api/enhance: Enhance/improve written answersPOST /api/questions: Submit new questionsGET /api/questions?status=drafted: Fetch questions by statusPOST /api/questions/admin: Approve or reject questions
- Database connection errors: Verify your Supabase URL and anon key
- AI not working: Check your Groq API key and rate limits
- Email verification failing: Ensure you're using valid personal/educational emails
- Admin access denied: Verify your admin password in the environment variables