DevFusion Hackathon · Problem Statement 1 (#26ENPRE1)
A complete placement preparation platform with AI-powered mock interviews, real code execution, timed quizzes, and leaderboards — 100% free, zero cost, no credit card required.
- Tech Stack (All Free)
- Features
- Project Structure
- Prerequisites
- Local Development Setup
- Environment Variables
- Database Seeding
- Free Service Setup Guides
- Deployment — Completely Free
- Docker Setup (Optional)
- API Reference
- Free Tier Limits
- Troubleshooting
| Layer | Technology | Cost |
|---|---|---|
| Frontend | React 18 + Vite + TailwindCSS | Free |
| Backend | Node.js + Express | Free |
| Database | MongoDB Atlas (512MB free cluster) | Free forever |
| AI (Interviews & Quizzes) | Groq API — LLaMA 3 8B | Free, no credit card |
| Code Execution | Piston API (emkc.org) | Free, no key needed |
| Email (OTP) | Mailtrap free tier | Free, 1000 emails/month |
| Backend Hosting | Render.com free web service | Free (spins down when idle) |
| Frontend Hosting | Vercel free tier | Free forever |
| Auth | JWT (self-hosted) | Free |
| Payment | Sandbox simulation (no gateway) | Free |
- ✅ 15 pre-seeded DSA problems (Easy / Medium / Hard)
- ✅ Monaco code editor with syntax highlighting (same as VS Code)
- ✅ Real code execution via Piston API — JavaScript, Python, C++, Java, C
- ✅ Topic-wise filtering: Arrays, Strings, Trees, DP, Graphs, SQL, etc.
- ✅ Bookmark questions, track solved/unsolved per user
- ✅ AI hints via Groq (without giving away the solution)
- ✅ Custom stdin input for testing
- ✅ Role-based mock interviews: Frontend, Backend, Full Stack, DSA
- ✅ 10 adaptive questions — difficulty adjusts based on your score
- ✅ Each answer scored 0–10 with detailed feedback + improvement tip
- ✅ Full session transcript stored and reviewable
- ✅ Session summary with strengths and improvement areas
- ✅ Free tier: 5 interviews/month | Pro: unlimited
- ✅ Generate timed MCQ tests on any topic (Groq generates them instantly)
- ✅ 5–20 questions, 1 minute per question timer
- ✅ Instant results with correct answers and explanations
- ✅ Per-topic leaderboard showing top scorers
- ✅ Register / Login / Forgot Password with OTP via email
- ✅ Google OAuth login (optional, can be enabled with GOOGLE_CLIENT_ID/SECRET)
- ✅ JWT access token + refresh token (auto-refresh)
- ✅ Dashboard: questions solved, interviews, avg score, weak areas
- ✅ Daily streak tracker with longest streak record
- ✅ Bookmark management
- ✅ Free tier: 5 AI interviews + 10 submissions/month
- ✅ Pro tier upgrade via sandbox (no real payment gateway needed)
- ✅ Billing history page
- ✅ Add / Edit / Delete questions from the bank
- ✅ View all registered users and their activity
- ✅ Platform analytics: top attempted questions, acceptance rates by topic
- ✅ Health check endpoint at
/api/health
prepgrid/
├── backend/
│ ├── src/
│ │ ├── config/ # DB connection
│ │ ├── controllers/ # Business logic
│ │ │ ├── authController.js
│ │ │ ├── practiceController.js
│ │ │ ├── interviewController.js
│ │ │ ├── quizController.js
│ │ │ ├── userController.js
│ │ │ └── adminController.js
│ │ ├── middlewares/ # Auth, tier check
│ │ ├── models/ # Mongoose schemas
│ │ │ ├── User.js
│ │ │ ├── Question.js
│ │ │ └── index.js # Session, Quiz, Submission, Payment
│ │ ├── routes/ # Express routers
│ │ ├── services/
│ │ │ ├── groq.js # Groq AI (free LLaMA 3)
│ │ │ ├── piston.js # Code execution (free, no key)
│ │ │ └── mailer.js # Nodemailer
│ │ ├── utils/
│ │ │ └── seed.js # DB seeder (15 questions + admin)
│ │ └── server.js
│ ├── .env.example
│ ├── Dockerfile
│ └── package.json
│
├── frontend/
│ ├── src/
│ │ ├── pages/
│ │ │ ├── Landing.jsx
│ │ │ ├── Login.jsx # Auth pages
│ │ │ ├── Register.jsx
│ │ │ ├── ForgotPassword.jsx
│ │ │ ├── Dashboard.jsx
│ │ │ ├── Practice.jsx # Problem list
│ │ │ ├── ProblemDetail.jsx # Monaco editor + Piston
│ │ │ ├── Interview.jsx # Lobby + session + history
│ │ │ ├── Quiz.jsx # Lobby + session
│ │ │ ├── Leaderboard.jsx
│ │ │ ├── Profile.jsx
│ │ │ ├── Billing.jsx
│ │ │ └── Admin.jsx
│ │ ├── components/
│ │ │ └── Layout/Layout.jsx # Sidebar + routing shell
│ │ ├── services/api.js # Axios + auto token refresh
│ │ ├── store/authStore.js # Zustand auth state
│ │ └── main.jsx
│ ├── index.html
│ ├── vite.config.js
│ ├── tailwind.config.js
│ ├── vercel.json
│ ├── Dockerfile
│ └── package.json
│
├── docker-compose.yml
├── render.yaml
├── package.json # Root: concurrently scripts
└── README.md
Make sure these are installed on your machine:
node --version # v18 or higher required
npm --version # v9 or higher
git --version # any recent versionTo install Node.js: https://nodejs.org (choose LTS)
git clone https://github.com/Akarshak51/Prepgrid.git
cd prepgrid# Install root, frontend, and backend dependencies in one command
npm run install:allOr manually:
npm install
cd frontend && npm install
cd ../backend && npm install
cd ..# Copy the example env file for backend
cp backend/.env.example backend/.env
# Copy for frontend
cp frontend/.env.example frontend/.envNow edit backend/.env with your values (see Environment Variables section).
# Start both frontend and backend simultaneously
npm run devThis runs:
- Backend on http://localhost:5000 / https://prepgrid-1-9bl2.onrender.com
- Frontend on http://localhost:5173 / https://prepgrid-pold.vercel.app
Or start them separately:
# Terminal 1 — Backend
npm run dev:backend
# Terminal 2 — Frontend
npm run dev:frontendcd backend
npm run seedThis creates:
- Admin account:
admin@prepgrid.dev/Admin@123456 - 15 DSA problems across Easy, Medium, and Hard difficulties
Create backend/.env with these values:
# ── Server ────────────────────────────────────────────────────────
PORT=5000
NODE_ENV=development
# ── Database (MongoDB Atlas — see setup guide below) ──────────────
MONGO_URI=mongodb+srv://<user>:<password>@cluster0.xxxxx.mongodb.net/prepgrid?retryWrites=true&w=majority
# ── JWT (generate secure random strings) ─────────────────────────
# Run this to generate: node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"
JWT_SECRET=your_64_char_random_string_here
JWT_REFRESH_SECRET=another_64_char_random_string
JWT_EXPIRES_IN=1h
JWT_REFRESH_EXPIRES_IN=7d
# ── Session Secret (for OAuth, optional) ────────────────────────
# If not provided, JWT_SECRET will be used
SESSION_SECRET=your_session_secret_here
# ── Google OAuth (Optional — for Google login) ──────────────────
# Leave empty to disable Google login
# Get keys from: https://console.cloud.google.com/
GOOGLE_CLIENT_ID=your_google_client_id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_REDIRECT_URI=http://localhost:5000/api/auth/google/callback
# ── Groq AI (free — see setup guide below) ────────────────────────
GROQ_API_KEY=gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
GROQ_MODEL=llama3-8b-8192
# ── Email — Mailtrap (free dev) ───────────────────────────────────
MAIL_HOST=sandbox.smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USER=your_mailtrap_username
MAIL_PASS=your_mailtrap_password
MAIL_FROM=noreply@prepgrid.dev
# ── Frontend URL (for CORS) ───────────────────────────────────────
CLIENT_URL=https://prepgrid-pold.vercel.app
# ── Admin seed credentials ────────────────────────────────────────
ADMIN_EMAIL=admin@prepgrid.dev
ADMIN_PASSWORD=Admin@123456
# ── Piston API (no key needed!) ───────────────────────────────────
PISTON_URL=https://emkc.org/api/v2/pistonCreate frontend/.env:
VITE_API_URL=https://prepgrid-1-9bl2.onrender.comThe seed script creates the admin user and 15 sample questions:
cd backend
npm run seedAdmin credentials after seeding:
- Email:
admin@prepgrid.dev - Password:
Admin@123456
To re-seed (clears existing questions):
cd backend
npm run seed
⚠️ The seed script deletes all questions before re-inserting. User data is preserved.
- Go to https://cloud.mongodb.com and create a free account
- Click "Build a Database" → choose M0 Free tier
- Select a region (Singapore or Mumbai for India)
- Create a database user:
- Username:
prepgriduser - Password: generate a secure password
- Username:
- Add IP Access: click "Add My Current IP", also add
0.0.0.0/0for deployment - Click "Connect" → "Connect your application"
- Copy the connection string:
mongodb+srv://prepgriduser:<password>@cluster0.xxxxx.mongodb.net/prepgrid?retryWrites=true&w=majority - Paste it as
MONGO_URIin your.env
Groq gives you free access to LLaMA 3, Mixtral, and other models with generous rate limits.
- Go to https://console.groq.com
- Sign up with Google or email (no credit card needed)
- Go to API Keys → Create API Key
- Copy the key (starts with
gsk_) - Paste as
GROQ_API_KEY=gsk_xxxxxin.env
Free tier limits: ~14,400 requests/day on llama3-8b-8192
That's ~200 interview sessions or ~1000 quiz generations per day.
Available free models:
llama3-8b-8192— fast, great for interviews (recommended)llama3-70b-8192— more powerful, slowermixtral-8x7b-32768— large context window
For OTP and welcome emails during development:
- Go to https://mailtrap.io and create a free account
- Go to Email Testing → Inboxes → click your inbox
- Select SMTP Settings → choose Nodemailer
- Copy the credentials:
MAIL_HOST=sandbox.smtp.mailtrap.io MAIL_PORT=2525 MAIL_USER=abc123def456 MAIL_PASS=xyz789uvw012 - Paste into your
.env
For production, switch to Gmail App Password (free):
- Enable 2FA on your Google account
- Go to Google Account → Security → App Passwords
- Generate a password for "Mail"
- Use:
MAIL_HOST=smtp.gmail.com MAIL_PORT=587 MAIL_USER=youremail@gmail.com MAIL_PASS=your_16_char_app_password MAIL_FROM=youremail@gmail.com
Enable social login via Google. This is optional — users can always use email/password.
- Go to https://console.cloud.google.com
- Create a new project or select existing one
- Enable Google+ API
- Go to Credentials → Create Credentials → OAuth 2.0 Client ID
- Select Web application
- Add authorized redirect URIs:
- For development:
http://localhost:5000/api/auth/google/callback - For production:
https://prepgrid-1-9bl2.onrender.com/api/auth/google/callback
- For development:
- Copy your Client ID and Client Secret
- Paste into
.env:GOOGLE_CLIENT_ID=your_client_id.apps.googleusercontent.com GOOGLE_CLIENT_SECRET=your_client_secret GOOGLE_REDIRECT_URI=http://localhost:5000/api/auth/google/callback SESSION_SECRET=your_session_secret_or_jwt_secret
If GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET are not set, Google login will be disabled (but the app will still work fine).
git init
git add .
git commit -m "Initial commit — PrepGrid"
git branch -M main
git remote add origin https://github.com/YOUR_USERNAME/prepgrid.git
git push -u origin main-
Go to https://render.com and sign up (free)
-
Click "New +" → "Web Service"
-
Connect your GitHub repo
-
Configure:
- Name:
prepgrid-backend - Root Directory:
backend - Environment:
Node - Build Command:
npm install - Start Command:
npm start - Plan: Free
- Name:
-
Add Environment Variables (click "Add Environment Variable" for each):
Key Value NODE_ENVproductionMONGO_URIyour Atlas connection string JWT_SECRETrun node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"JWT_REFRESH_SECRETanother random 64-char string JWT_EXPIRES_IN1hJWT_REFRESH_EXPIRES_IN7dSESSION_SECREToptional, defaults to JWT_SECRET GROQ_API_KEYyour Groq API key GROQ_MODELllama3-8b-8192MAIL_HOSTyour Mailtrap/Gmail host MAIL_PORT2525or587MAIL_USERyour mail user MAIL_PASSyour mail password MAIL_FROMnoreply@prepgrid.devCLIENT_URLhttps://prepgrid-pold.vercel.app(fill after Vercel deploy)ADMIN_EMAILadmin@prepgrid.devADMIN_PASSWORDAdmin@123456PISTON_URLhttps://emkc.org/api/v2/pistonGOOGLE_CLIENT_ID(Optional) your Google OAuth Client ID GOOGLE_CLIENT_SECRET(Optional) your Google OAuth Client Secret GOOGLE_REDIRECT_URIhttps://prepgrid-backend.onrender.com/api/auth/google/callback -
Click "Create Web Service"
-
Wait for deploy (2–3 minutes)
-
Your backend URL will be:
https://prepgrid-1-9bl2.onrender.com
⚠️ Render free tier spins down after 15 minutes of inactivity. First request after idle takes ~30 seconds to wake up. This is normal for free tier.
Seed the production database:
# Set your prod MONGO_URI temporarily and run seed
MONGO_URI="your_atlas_uri" node backend/src/utils/seed.js-
Go to https://vercel.com and sign up with GitHub (free)
-
Click "Add New Project"
-
Import your GitHub repository
-
Configure:
- Framework Preset: Vite
- Root Directory:
frontend - Build Command:
npm run build - Output Directory:
dist
-
Add Environment Variables:
Key Value VITE_API_URLhttps://prepgrid-1-9bl2.onrender.com/api -
Click "Deploy"
-
Your frontend URL will be:
https://prepgrid-pold.vercel.app -
Update CORS on Render: Go back to Render → your backend service → Environment → update
CLIENT_URLtohttps://prepgrid-pold.vercel.app
□ MongoDB Atlas cluster created and connection string copied
□ Groq API key obtained (console.groq.com)
□ Mailtrap/Gmail credentials set
□ Google OAuth credentials obtained (optional - https://console.cloud.google.com)
□ Backend deployed to Render with all env vars
□ Backend URL noted (e.g. https://prepgrid-backend.onrender.com)
□ Health check endpoint verified at: https://prepgrid-backend.onrender.com/api/health
□ Frontend deployed to Vercel with VITE_API_URL set
□ Render CLIENT_URL updated to Vercel URL
□ If using Google OAuth, update GOOGLE_REDIRECT_URI on Render
□ Database seeded (admin + 15 questions)
□ Test register/login on live URL
□ Test Google OAuth login (if enabled)
□ Test code execution on live URL
□ Test AI interview on live URL
Run everything locally with Docker:
# Copy env file
cp backend/.env.example backend/.env
# Edit backend/.env with your values
# Build and start all services
docker-compose up --build
# Access:
# Frontend: http://localhost:5173 (or http://localhost:80 in prod mode)
# Backend: http://localhost:5000
# MongoDB: localhost:27017
# Stop
docker-compose down
# Stop and remove volumes
docker-compose down -vPOST /api/auth/register Register new user
POST /api/auth/login Login
POST /api/auth/refresh Refresh access token
POST /api/auth/forgot-password Send OTP to email
POST /api/auth/reset-password Reset with OTP
GET /api/auth/me Get current user (requires auth)
GET /api/auth/google Start Google OAuth flow (only if enabled)
GET /api/auth/google/callback Google OAuth callback (only if enabled)
GET /api/practice/questions List questions (filter: difficulty, topic, search)
GET /api/practice/questions/:id Get single question
POST /api/practice/run Run code (Piston API)
POST /api/practice/submit Submit code (run all test cases)
POST /api/practice/hint Get AI hint for current code
POST /api/practice/bookmark/:questionId Toggle bookmark
GET /api/practice/submissions My submission history
POST /api/interview/start Start new session (requires interview tier)
POST /api/interview/answer Submit answer, get next question
GET /api/interview/sessions List my sessions
GET /api/interview/sessions/:id Get session with transcript
POST /api/quiz/generate Generate MCQ quiz (Groq AI)
POST /api/quiz/submit Submit answers, get results
GET /api/quiz/leaderboard/:topic Top scores for topic
GET /api/quiz/my-attempts My quiz history
GET /api/user/dashboard Dashboard data
PUT /api/user/profile Update name/bio
POST /api/user/payment/order Create sandbox order
POST /api/user/payment/confirm Confirm sandbox payment (upgrades to Pro)
GET /api/user/payment/history Billing history
GET /api/admin/stats Platform analytics
GET /api/admin/users All users
GET /api/admin/questions All questions (including test cases)
POST /api/admin/questions Create question
PUT /api/admin/questions/:id Update question
DELETE /api/admin/questions/:id Soft delete question
| Feature | Free | Pro (₹199/mo sandbox) |
|---|---|---|
| AI Interviews | 5/month | Unlimited |
| Code Submissions | 10/month | Unlimited |
| AI Quizzes | Unlimited | Unlimited |
| Practice Problems | Unlimited | Unlimited |
| Leaderboards | ✓ | ✓ |
| Bookmarks | ✓ | ✓ |
| Session History | ✓ | ✓ |
- Check your
GROQ_API_KEYis set correctly in.env - Verify at https://console.groq.com your key is active
- Check rate limits (free: ~30 req/min)
- Try switching model:
GROQ_MODEL=llama3-70b-8192
- Piston is a public free API — occasionally slow or down
- Check status: https://emkc.org/api/v2/piston/runtimes
- No key needed — if it fails, it's a temporary outage
- Check your Atlas connection string format
- Ensure your IP is whitelisted in Atlas (add
0.0.0.0/0for all IPs) - Check username/password in the connection string are URL-encoded if they contain special chars
- Render free tier spins down after 15 min idle
- First request takes 30–60 seconds to wake up
- This is expected — upgrade to paid ($7/mo) to avoid this
- Check Mailtrap inbox at https://mailtrap.io/inboxes
- OTP is valid for 10 minutes
- If using Gmail, ensure App Password (not account password) is used
- Ensure
CLIENT_URLin backend.envmatches your frontend URL exactly (no trailing slash) - For local dev:
CLIENT_URL=http://localhost:5173 - For production:
CLIENT_URL=https://prepgrid-pold.vercel.app
- Ensure both
GOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRETare set in.env - Check the redirect URI matches exactly in Google Console settings
- For local dev:
http://localhost:5000/api/auth/google/callback - For production:
https://prepgrid-1-9bl2.onrender.com/api/auth/google/callback - If not using Google OAuth, simply leave these variables empty — email/password auth will still work
- Monthly limits reset on the 1st of each month
- Upgrade via the Billing page (sandbox, no real payment)
# Install all dependencies
npm run install:all
# Start both servers (dev mode with hot reload)
npm run dev
# Start only backend
npm run dev:backend
# Start only frontend
npm run dev:frontend
# Seed database
cd backend && npm run seed
# Build frontend for production
npm run build
# Generate JWT secrets
node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"Log in as admin → go to /admin → click "Add Question" tab.
Or add them directly in the seed file at backend/src/utils/seed.js and re-run npm run seed.
Each question supports:
- Title, description, difficulty, topic
- Examples (shown to user)
- Test cases (hidden, used for judge)
- Starter code in 5 languages
- Hints (revealed on demand)
- No Judge0 — code execution uses the free Piston API (emkc.org) which supports 75+ languages with no key required
- No OpenAI — AI powered by Groq (free LLaMA 3) via standard OpenAI-compatible REST API
- No Razorpay/Stripe — payments are fully sandboxed with no external gateway
- JWT stored in localStorage with automatic refresh token rotation
- Soft deletes on questions —
isActive: falseinstead of actual deletion - Monthly usage counters reset automatically when a new month starts
MIT License — free to use, modify, and deploy.
Built for DevFusion Hackathon 2026 · ⚡ PrepGrid