Skip to content
AdityaD-2512Public

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DoubtSetu

DoubtSetu is a MERN + Gemini AI study assistant. It supports sessions, document upload, AI chat, summaries, quick quizzes, exam panic mode, learning paths, AI teacher mode, memory heatmaps, retention suggestions, and confusion detection.

Tech Stack

  • Frontend: React + Vite
  • Backend: Node.js + Express
  • Database: MongoDB + Mongoose
  • AI: Gemini API
  • Auth: JWT
  • Uploads: Multer with PDF/DOCX/TXT parsing

Project Structure

DoubtSetu/
  client/          React frontend
  server/          Express API
  README.md
  package.json

Prerequisites

  • Node.js 18+
  • MongoDB Atlas or local MongoDB
  • Gemini API key from Google AI Studio

Setup

  1. Install dependencies:
npm run install:all
  1. Create backend environment file:
cp server/.env.example server/.env

Then edit server/.env:

PORT=5001
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_long_random_jwt_secret
GEMINI_API_KEY=your_gemini_api_key
GEMINI_MODEL=gemini-2.5-flash-lite
GEMINI_ALLOW_FALLBACK=false
CLIENT_URL=http://localhost:5173,http://127.0.0.1:5173
  1. Create frontend environment file:
cp client/.env.example client/.env

Then edit client/.env if needed:

VITE_API_URL=http://localhost:5001/api
  1. Run the full project:
npm run dev

Frontend runs on http://localhost:5173. Backend runs on http://localhost:5001.

Using the App

  • Register or log in.
  • Create a new study session.
  • Upload PDF, DOCX, or TXT notes.
  • Ask doubts in chat.
  • Use Quick Quiz, Exam Panic Mode, Learning Path, AI Teacher Mode, AI Suggestions, Memory Heatmap, and Confusion Detection from each session.

Troubleshooting

Frontend says backend is not reachable

Open the backend terminal and check whether it printed:

DoubtSetu API running on http://localhost:5001

If you see a MongoDB error such as querySrv ECONNREFUSED or ENOTFOUND, the server crashed before opening port 5001. Fix one of these:

  • Make sure server/.env has a valid MONGO_URI.
  • If using MongoDB Atlas, add your current IP address in Atlas Network Access.
  • If using Atlas temporarily for development, allow 0.0.0.0/0.
  • If using local MongoDB, start MongoDB and use mongodb://127.0.0.1:27017/doubtsetu.

After fixing MongoDB, restart:

npm run server

Then test:

curl http://localhost:5001/api/health

You should get:

{"status":"ok","app":"DoubtSetu API"}

Gemini quota or model errors

If the server logs show:

429 Too Many Requests
Quota exceeded
limit: 0

the API key or Google Cloud project currently has no usable quota for that model. Code cannot bypass that quota. Enable Gemini quota/billing in Google AI Studio, create a new API key in a project with available quota, or change GEMINI_MODEL to a model available to your key.

If the server logs show:

model is not found

update server/.env:

GEMINI_MODEL=gemini-2.5-flash-lite

DoubtSetu now reports Gemini quota/model errors clearly instead of silently returning demo/static answers. Set GEMINI_ALLOW_FALLBACK=true only when you intentionally want demo answers during setup.

API Notes

The backend uses Gemini when GEMINI_API_KEY is present. GEMINI_MODEL defaults to gemini-2.5-flash-lite, and you can change it if your API key supports a different model. Set GEMINI_ALLOW_FALLBACK=true only if you want DoubtSetu to show demo fallback answers when Gemini is unavailable.

Important endpoints:

  • POST /api/auth/register
  • POST /api/auth/login
  • GET /api/sessions
  • POST /api/sessions
  • GET /api/sessions/:id
  • POST /api/sessions/:id/upload
  • POST /api/sessions/:id/chat
  • POST /api/sessions/:id/quiz
  • POST /api/sessions/:id/exam-panic
  • POST /api/sessions/:id/learning-path
  • POST /api/sessions/:id/teacher
  • POST /api/sessions/:id/action
  • GET /api/sessions/:id/insights

Production Build

npm run build
npm start

For production, set strong secrets, restrict CORS, and store uploaded files in cloud storage instead of local disk.

DoubtSetu

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages