An intelligent web application that automatically generates assessment questions from uploaded documents using advanced AI and natural language processing. Perfect for educators, trainers, and content creators who need to quickly create comprehensive assessments.
- Document Upload: Support for PDF, DOCX, DOC, and TXT files
- AI-Powered Question Generation: Uses OpenAI GPT models to create relevant questions
- Multiple Question Types: Radio options, checkboxes, yes/no, scaled ratings, and text responses
- Assessment Organization: Groups questions by learning outcomes and topics
- Interactive Testing Interface: User-friendly question display with real-time responses
- Radio Options: Single-choice questions with multiple options
- Checkboxes: Multiple selection questions
- Yes/No: Binary choice questions
- Scaled: Numeric range questions (1-10 scale)
- Rating: 1-5 star rating questions
- Text Response: Open-ended questions
- SQLite Database: Efficient storage of vector embeddings and document chunks
- Vector Search: Fast similarity search using embedded document chunks
- Persistent Storage: All documents and questions stored securely
- Metadata Tracking: File information, upload dates, and processing statistics
- Modern Design: Clean, responsive interface built with Tailwind CSS
- Drag & Drop: Intuitive file upload experience
- Progress Tracking: Real-time feedback during document processing
- Mobile Friendly: Responsive design that works on all devices
- Next.js 15: React framework with App Router
- TypeScript: Type-safe development
- Tailwind CSS: Utility-first CSS framework
- Radix UI: Accessible component primitives
- Lucide React: Beautiful icons
- Next.js API Routes: Serverless API endpoints
- LangChain: AI orchestration and prompt management
- OpenAI GPT-4: Advanced language model for question generation
- SQLite: Lightweight database for data persistence
- OpenAI Embeddings: Text embeddings for semantic search
- Recursive Text Splitting: Intelligent document chunking
- Prompt Engineering: Optimized prompts for question generation
- Node.js 18+ and npm
- OpenAI API key
- SQLite3 (automatically installed)
-
Clone the repository
git clone <repository-url> cd question-generation-app
-
Install dependencies
npm install
-
Environment Setup Create a
.env.localfile in the root directory:OPENAI_API_KEY=your_openai_api_key_here
-
Run the development server
npm run dev
-
Open your browser Navigate to http://localhost:3000
- Drag and drop or click to select a PDF, DOCX, DOC, or TXT file
- Maximum file size: 10MB
- The app will automatically process and chunk the document
- Click "Upload and Generate Questions"
- The AI will analyze the document content
- Questions are generated based on learning outcomes and key concepts
- Navigate to the test page using the provided link
- Answer questions using the interactive interface
- Questions are organized by category for better assessment flow
- Submit answers to see detailed feedback
- View performance analysis and recommendations
- Retake the assessment as needed
POST /api/upload- Upload and process documentsGET /api/upload- Health check
POST /api/questions- Generate questions from processed documents{ "documentId": "doc_1234567890_file.pdf", "count": 10 }
POST /api/grade- Grade submitted answersGET /api/grade- Health check
The application uses SQLite with the following tables:
document_id(TEXT, PRIMARY KEY)original_content(TEXT)created_at(DATETIME)updated_at(DATETIME)
id(INTEGER, PRIMARY KEY)document_id(TEXT, FOREIGN KEY)chunk_text(TEXT)chunk_index(INTEGER)embedding(TEXT) - JSON string of vector embeddingsmetadata(TEXT) - JSON string of chunk metadatacreated_at(DATETIME)
OPENAI_API_KEY: Your OpenAI API key (required)NODE_ENV: Environment mode (development/production)
- Chunk Size: 1000 characters
- Overlap: 200 characters
- Embedding Model: text-embedding-3-small
- Language Model: gpt-4o-mini
my-app/
βββ app/
β βββ api/
β β βββ upload/route.ts # Document upload endpoint
β β βββ questions/route.ts # Question generation
β β βββ grade/route.ts # Answer grading
β β βββ test/route.ts # Test utilities
β βββ test/page.tsx # Assessment interface
β βββ page.tsx # Upload page
β βββ layout.tsx # App layout
βββ components/
β βββ ui/ # Reusable UI components
β βββ question-display.tsx # Question rendering
βββ lib/
β βββ document-store.ts # SQLite database service
β βββ utils.ts # Utility functions
βββ data/ # SQLite database files
βββ uploads/ # Temporary file storage
βββ public/ # Static assets
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Use TypeScript for all new code
- Follow the existing code style and patterns
- Add tests for new features
- Update documentation as needed
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenAI for providing powerful language models
- LangChain for AI orchestration framework
- Next.js for the excellent React framework
- Tailwind CSS for beautiful styling utilities
- Radix UI for accessible component primitives
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Contact the maintainers
- Support for additional file formats (PPT, XLS, etc.)
- Advanced question customization options
- Collaborative assessment creation
- Integration with learning management systems
- Analytics dashboard for assessment performance
- Multi-language support
- Question bank management
- Automated difficulty assessment
- Integration with external quiz platforms
Made with β€οΈ using Next.js, TypeScript, and AI