Skip to content

amangit1314/CareerSpire

Repository files navigation

Mocky - AI-Powered Mock Interview Platform

A production-ready, scalable AI-driven mock interview platform built with Next.js, Prisma, and Supabase.

πŸš€ Features

Core Features

  • βœ… AI-Powered Mock Interviews - Practice with AI-generated questions and feedback
  • βœ… Code Editor - Monaco editor with syntax highlighting and test execution
  • βœ… Progress Tracking - Detailed analytics and performance metrics
  • βœ… Question Bank - 1000+ curated DSA, coding, and HR questions

Production Features

  • βœ… Secure Authentication - JWT with refresh tokens, password hashing
  • βœ… Rate Limiting - Per-IP and per-user rate limits
  • βœ… Notification System - In-app and email notifications with preferences
  • βœ… Media Storage - Supabase storage with signed URLs
  • βœ… Error Handling - User-friendly error messages
  • βœ… Loading States - Beautiful skeleton loaders
  • βœ… Caching - React Query + server-side caching
  • βœ… Performance - Debouncing, throttling, code splitting

πŸ› οΈ Tech Stack

  • Frontend: Next.js 14 (App Router), React, TypeScript, TailwindCSS
  • Backend: Next.js API Routes, Server Actions, Prisma ORM
  • Database: PostgreSQL (via Prisma)
  • Storage: Supabase Storage
  • Email: Supabase Email (configurable to Resend/SendGrid)
  • Auth: JWT with refresh tokens
  • State Management: TanStack Query (React Query)
  • Code Editor: Monaco Editor
  • Charts: Recharts

πŸ“¦ Installation

Prerequisites

  • Node.js 18+
  • PostgreSQL database
  • Supabase account

Setup

  1. Clone the repository
git clone <your-repo-url>
cd Mocky
  1. Install dependencies
npm install
  1. Set up environment variables
cp .env.local.example .env.local

Fill in your environment variables:

DATABASE_URL=postgresql://user:password@host:port/database
JWT_SECRET=your-secret-key-change-in-production
JWT_REFRESH_SECRET=your-refresh-secret-key
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
OPENROUTER_API_KEY=your-openrouter-key
LLM_MODEL=openai/gpt-4o-mini
NEXT_PUBLIC_APP_URL=http://localhost:3000
  1. Set up database
# Generate Prisma Client
npx prisma generate

# Run migrations
npx prisma migrate dev

# (Optional) Seed database
npx prisma db seed
  1. Set up Supabase Storage
  • Create a bucket named media in Supabase Storage
  • Configure bucket settings (private, 10MB max file size)
  1. Run development server
npm run dev

Open http://localhost:3000

AGE

-- BORN on 13-01-2026 -- DIED ON 30-01-2026 πŸ₯ΉπŸ˜₯πŸ˜‘β˜ οΈ

πŸ“ Project Structure

Mocky/
β”œβ”€β”€ app/                    # Next.js app directory
β”‚   β”œβ”€β”€ actions/           # Server actions
β”‚   β”œβ”€β”€ api/               # API routes
β”‚   β”œβ”€β”€ dashboard/         # Dashboard pages
β”‚   β”œβ”€β”€ mock/              # Mock interview pages
β”‚   └── auth/              # Auth pages
β”œβ”€β”€ components/            # React components
β”‚   β”œβ”€β”€ ui/                # UI primitives
β”‚   └── skeletons/         # Loading skeletons
β”œβ”€β”€ hooks/                 # React Query hooks
β”œβ”€β”€ lib/                   # Utilities
β”‚   β”œβ”€β”€ auth.ts           # Auth utilities
β”‚   β”œβ”€β”€ errors.ts         # Error handling
β”‚   β”œβ”€β”€ rate-limit.ts     # Rate limiting
β”‚   └── supabase/         # Supabase helpers
β”œβ”€β”€ services/             # API services
β”œβ”€β”€ types/                # TypeScript types
└── prisma/               # Prisma schema

πŸ” Security Features

  • JWT Authentication: Access tokens (15min) + Refresh tokens (7 days)
  • Password Hashing: bcryptjs with 12 rounds
  • Rate Limiting: Per-endpoint rate limits
  • Input Validation: Zod schemas for all inputs
  • SQL Injection Protection: Prisma ORM
  • XSS Protection: React's built-in escaping
  • CSRF Protection: SameSite cookies

πŸ“Š Database Schema

See prisma/schema.prisma for the complete schema. Key models:

  • User - User accounts
  • Session - Refresh token sessions
  • Notification - In-app notifications
  • NotificationPreference - User notification settings
  • MockSession - Interview sessions
  • MockResult - Submission results
  • Question - Question bank
  • MediaObject - Media file metadata

πŸš€ Deployment

Vercel Deployment

  1. Push code to GitHub
  2. Import project in Vercel
  3. Add environment variables
  4. Deploy!

Database Migration

Run migrations in production:

npx prisma migrate deploy

πŸ“ API Documentation

Authentication

  • POST /api/auth/signup - Sign up
  • POST /api/auth/signin - Sign in
  • POST /api/auth/signout - Sign out
  • POST /api/auth/refresh - Refresh access token
  • GET /api/auth/me - Get current user

Mock Interviews

  • POST /api/mock/start - Start mock interview
  • POST /api/mock/submit - Submit solution
  • GET /api/mock/[id] - Get session details

Notifications

  • GET /api/notifications - Get notifications
  • POST /api/notifications/[id]/read - Mark as read
  • POST /api/notifications/read-all - Mark all as read
  • GET /api/notifications/preferences - Get preferences
  • PATCH /api/notifications/preferences - Update preferences

Media

  • POST /api/media/upload-url - Get upload URL

πŸ§ͺ Testing

# Run linter
npm run lint

# Type check
npx tsc --noEmit

πŸ“„ License

MIT

🀝 Contributing

Contributions are welcome! Please read our contributing guidelines first.

πŸ“ž Support

For issues and questions, please open an issue on GitHub.

About

A production-ready, scalable AI-driven mock interview platform built with Next.js, Prisma, and Supabase.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors