AI-powered exam generation system that creates intelligent questions from PDF documents using Google's Gemini AI technology.
Exam Generator is a full-stack web application that allows users to upload PDF documents and automatically generate comprehensive exam questions. The system uses advanced AI to analyze document content and create various question types with appropriate difficulty levels.
- PDF Document Processing: Upload and extract text from PDF files
- AI-Powered Question Generation: Uses Google Gemini 2.5 Pro for intelligent question creation
- Multiple Question Types:
- Multiple Choice Questions
- True/False Questions
- Fill in the Blank Questions
- Open-ended Questions
- Configurable Difficulty: Easy, Medium, and Hard difficulty levels
- User Authentication: Secure user registration and login system
- Interactive Exam Interface: User-friendly exam taking experience
- Detailed Results: Comprehensive exam results with feedback and explanations
- Responsive Design: Modern, mobile-friendly interface
- FastAPI: Modern, fast web framework for building APIs
- MongoDB: NoSQL database for storing user data and exam content
- Google Gemini AI: Advanced AI for question generation
- PyPDF2: PDF text extraction library
- JWT: Secure authentication tokens
- Python 3.10+: Programming language
- React 19: Modern frontend framework
- Tailwind CSS: Utility-first CSS framework
- Radix UI: Accessible component library
- React Router: Client-side routing
- Axios: HTTP client for API communication
Before running this application, ensure you have the following installed:
- Node.js 18 or higher
- Python 3.10 or higher
- MongoDB (local installation or cloud service)
- Google AI API key
git clone https://github.com/mertcaliskan34/exam-generator.git
cd exam-generatorNavigate to the backend directory and set up the Python environment:
cd backend
python -m venv venv
# Activate virtual environment
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate
# Install dependencies
pip install -r requirements.txtNavigate to the frontend directory and install dependencies:
cd frontend
npm install
# or
yarn installCreate environment files for both backend and frontend:
Backend (.env file in backend directory):
MONGO_URL=mongodb://localhost:27017
DB_NAME=exam_generator
CORS_ORIGINS=*
GOOGLE_AI_KEY=your_google_ai_api_key_hereFrontend (.env file in frontend directory):
REACT_APP_BACKEND_URL=http://localhost:8000
WDS_SOCKET_PORT=3000
REACT_APP_ENABLE_VISUAL_EDITS=true
ENABLE_HEALTH_CHECK=falseStart MongoDB using Docker:
docker run -d -p 27017:27017 --name mongodb mongo:latestOr install MongoDB locally and start the service.
cd backend
uvicorn server:app --reload --host 0.0.0.0 --port 8000The backend API will be available at http://localhost:8000
cd frontend
npm start
# or
yarn startThe frontend application will be available at http://localhost:3000
- Frontend Application: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- User Registration: Create a new account or login with existing credentials
- Upload PDF: Upload a PDF document containing the content for exam generation
- Configure Exam Settings:
- Select question type (multiple choice, true/false, fill in blank, open-ended, or mixed)
- Choose difficulty level (easy, medium, hard)
- Specify number of questions (5-50)
- Generate Exam: The AI will analyze the PDF and create exam questions
- Take Exam: Answer the generated questions through the interactive interface
- View Results: Review detailed results with correct answers and explanations
POST /api/auth/register- User registrationPOST /api/auth/login- User login
POST /api/exams/create- Create exam from PDF uploadGET /api/exams- Retrieve user's examsGET /api/exams/{exam_id}- Get specific exam details
POST /api/exams/submit- Submit exam answersGET /api/results- Get user's exam resultsGET /api/results/{result_id}- Get specific result details
exam-generator/
├── backend/
│ ├── server.py # Main FastAPI application
│ ├── requirements.txt # Python dependencies
│ └── .env # Environment variables
├── frontend/
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Application pages
│ │ ├── hooks/ # Custom React hooks
│ │ └── lib/ # Utility functions
│ ├── public/ # Static assets
│ ├── package.json # Node.js dependencies
│ └── .env # Frontend environment variables
├── .gitignore # Git ignore rules
├── LICENSE # MIT License
└── README.md # This file
The backend can be configured through environment variables:
MONGO_URL: MongoDB connection stringDB_NAME: Database nameCORS_ORIGINS: Allowed CORS originsGOOGLE_AI_KEY: Google AI API keySECRET_KEY: JWT secret key (optional)
The frontend can be configured through environment variables:
REACT_APP_BACKEND_URL: Backend API URLWDS_SOCKET_PORT: Webpack dev server portREACT_APP_ENABLE_VISUAL_EDITS: Enable visual editing featuresENABLE_HEALTH_CHECK: Enable health check features
The backend uses FastAPI with automatic API documentation. After starting the server, visit http://localhost:8000/docs for interactive API documentation.
The frontend uses React with hot reloading. Changes to the source code will automatically refresh the browser.
- Backend: Python with type hints and FastAPI best practices
- Frontend: React with modern hooks and functional components
- Styling: Tailwind CSS for consistent design
- Components: Radix UI for accessible components
- Install production dependencies
- Set up environment variables
- Configure MongoDB connection
- Deploy using uvicorn or similar ASGI server
- Build the production bundle:
npm run build - Serve the built files using a web server
- Configure environment variables for production
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Commit your changes:
git commit -m 'Add new feature' - Push to the branch:
git push origin feature/new-feature - Open a Pull Request
This project is licensed under the MIT License. See the LICENSE file for details.
For support and questions, please open an issue on the GitHub repository.
- Google Gemini AI for advanced question generation capabilities
- Radix UI for accessible and beautiful components
- Tailwind CSS for efficient styling
- FastAPI for the robust and fast backend framework