An AI-powered study companion for BSIT and college students — built as a portfolio-quality SaaS application.
Live Demo: https://ai-study-assistant-sigma-ten.vercel.app
| Feature | Description |
|---|---|
| AI Chat | Chat with Gemini AI — supports multi-turn conversations saved to DB |
| Flashcard Generator | AI generates Q&A flashcards from any topic; 3D flip study mode |
| Reviewer Generator | AI creates structured study reviewers (comprehensive, Q&A, key concepts) |
| PDF Summarizer | Upload PDFs → AI extracts text and generates summaries |
| Code Debugger | Paste broken code → AI explains the bug and provides a fix |
| Notes | Markdown note editor with 2-second auto-save |
| Bookmarks | Save any item (flashcard set, reviewer, note, material) for quick access |
| Admin Panel | Manage users, view AI usage charts, ban/unban accounts |
| Dark Mode | Full dark mode support with system preference detection |
| Layer | Technology |
|---|---|
| Frontend | React 19 · Vite 8 · Tailwind CSS v4 · React Router v7 |
| Backend | Node.js 20 · Express 5 · CommonJS |
| Database | PostgreSQL via Neon (free tier) |
| ORM | Prisma 7 with pg driver adapter |
| Auth | JWT (7-day expiry) + bcrypt (10 rounds) |
| AI | Google Gemini 2.5 Flash (free tier) |
| File Storage | Cloudinary (free tier — 25 GB storage) |
| Deployment | Vercel (frontend) · Render (backend) |
AI_Study_Assistant/
├── client/ # React + Vite frontend (→ Vercel)
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ │ ├── admin/ # Admin panel components
│ │ │ ├── chat/ # Chat UI components
│ │ │ ├── debugger/ # Code debugger components
│ │ │ ├── flashcards/ # Flashcard components
│ │ │ ├── layout/ # Sidebar, Topbar, DashboardLayout
│ │ │ ├── notes/ # Note editor
│ │ │ ├── pdf/ # PDF uploader and summary viewer
│ │ │ ├── reviewer/ # Reviewer generator components
│ │ │ └── ui/ # Button, Card, Badge, Avatar, BookmarkButton
│ │ ├── context/ # AuthContext, ThemeContext
│ │ ├── hooks/ # useChat
│ │ ├── pages/ # One file per route
│ │ ├── services/ # Axios API wrappers (one per feature)
│ │ └── utils/ # cn(), formatDate(), timeAgo()
│ ├── vercel.json # SPA routing config
│ └── .env.example
│
├── server/ # Node.js + Express backend (→ Render)
│ ├── controllers/ # HTTP handlers — thin, call services
│ ├── middleware/ # auth, admin, upload, validate, rateLimiter
│ ├── prisma/ # schema.prisma + migrations
│ ├── routes/ # Express router files
│ ├── services/ # Business logic: AI, PDF, Cloudinary, DB
│ └── utils/ # prismaClient, jwt.utils, logger
│
├── render.yaml # Render deployment config
└── README.md
- Node.js 20+
- A Neon free PostgreSQL database
- A Cloudinary free account
- A Google AI Studio API key
git clone https://github.com/Iya15/AI-Study-Assistant.git
cd AI-Study-Assistant# Backend
cd server && npm install
# Frontend (new terminal)
cd client && npm install# Backend
cd server
cp .env.example .env
# Edit .env with your actual values (see Environment Variables section below)
# Frontend
cd client
cp .env.example .env
# Leave VITE_API_URL empty for development (Vite proxy handles it)cd server
# Apply all migrations to your Neon database
npx prisma migrate deploy
# Generate the Prisma client
npx prisma generate# Terminal 1 — Backend (http://localhost:5000)
cd server && npm run dev
# Terminal 2 — Frontend (http://localhost:5173)
cd client && npm run dev| Variable | Description | Example |
|---|---|---|
PORT |
Server port | 5000 |
NODE_ENV |
Environment | development / production |
CLIENT_URL |
Frontend URL for CORS | https://your-app.vercel.app |
DATABASE_URL |
Neon PostgreSQL connection string | postgresql://...?sslmode=require |
JWT_SECRET |
64-char random hex string | node -e "console.log(require('crypto').randomBytes(64).toString('hex'))" |
JWT_EXPIRES_IN |
Token lifetime | 7d |
GEMINI_API_KEY |
Google AI Studio key | AIza... |
CLOUDINARY_CLOUD_NAME |
Cloudinary cloud name | mycloud |
CLOUDINARY_API_KEY |
Cloudinary API key | 123456789012345 |
CLOUDINARY_API_SECRET |
Cloudinary API secret | abc123... |
| Variable | Description | Example |
|---|---|---|
VITE_API_URL |
Backend API base URL | https://your-api.onrender.com/api |
Development: Leave
VITE_API_URLempty — Vite proxies/apitolocalhost:5000automatically.
- Go to neon.tech → Sign up for free
- Create a new project (e.g.
ai-study-assistant) - Go to Connection Details → copy the connection string
- It looks like:
postgresql://neondb_owner:password@ep-xxx.region.aws.neon.tech/neondb?sslmode=require - Save this as your
DATABASE_URL
- Go to cloudinary.com → Sign up for free
- From the Dashboard, copy:
- Cloud Name
- API Key
- API Secret
- Free tier: 25 GB storage + 25 GB bandwidth/month — enough for hundreds of PDFs
- Go to aistudio.google.com/app/apikey
- Click Create API key → select an existing Google Cloud project or create new
- Copy the key (starts with
AIza...) - Free tier: 15 requests/minute, 1500 requests/day — sufficient for student usage
- Go to render.com → Sign up (free tier available)
- Click New → Web Service
- Connect your GitHub repository
- Configure:
- Root Directory:
server - Build Command:
npm install && npm run build - Start Command:
npm start - Node Version: 20
- Root Directory:
- Add all environment variables from the table above (set
NODE_ENV=production) - Click Create Web Service
- Wait for deploy (~3 min). Note your service URL:
https://your-service.onrender.com
Run migrations after first deploy:
# In your local terminal (one-time setup):
cd server
DATABASE_URL="your-production-neon-url" npx prisma migrate deployFree tier note: Render free services spin down after 15 minutes of inactivity. The first request after spin-down takes ~30 seconds. Upgrade to Render Starter ($7/mo) to avoid this.
- Go to vercel.com → Sign up with GitHub (free)
- Click Add New Project → import your GitHub repo
- Configure:
- Framework Preset: Vite
- Root Directory:
client - Build Command:
npm run build - Output Directory:
dist
- Add environment variable:
VITE_API_URL=https://your-service.onrender.com/api
- Click Deploy
Auto-deploy: Every push to main automatically re-deploys both services.
After Vercel deploys:
- Copy your Vercel URL (e.g.
https://ai-study-assistant.vercel.app) - Go to Render → your service → Environment
- Set
CLIENT_URL=https://ai-study-assistant.vercel.app - Render will restart automatically
After deploying, register a user via the app, then manually promote them in Neon:
-- Run in Neon SQL Editor:
UPDATE users SET role = 'ADMIN' WHERE email = 'your@email.com';- All secrets in environment variables (none hardcoded)
- CORS locked to
CLIENT_URLonly - Rate limiting on all AI routes (per-user, DB-backed)
- JWT expiry set to 7 days
- bcrypt 10 rounds for password hashing
- User enumeration prevented (identical error for wrong email/password)
- Admin routes double-protected (JWT + role check)
-
console.logsuppressed in production vialogger.js - Morgan HTTP logs use
combinedformat in production - Error handler hides stack traces in production
- File uploads capped at 10 MB
- Prisma
isActivecheck prevents banned users from logging in - SPA routing handled by
vercel.json -
prisma generateruns during Render build step
Pull requests welcome. For major changes, open an issue first to discuss what you'd like to change.
MIT