AI-powered Assessment Creator
Structured Generation โข Validation โข Async Processing โข Real-Time Updates
A system design-focused project that generates exam-ready question papers using AI, with a focus on reliability, structured output, and continuous improvement.
๐ https://youtu.be/Rtrf6n0DlC8
A few outputs generated by the system:
๐ Sample Paper 1
๐ Sample Paper 2
โก These outputs are generated by the current system. Quality and validation are actively being improved over time.
Assignly is a system design-oriented project focused on building a reliable AI pipeline for generating structured question papers.
Instead of directly using AI responses, the system processes outputs through multiple stages to improve consistency and usability.
Parse โ Validate โ Normalize โ Store โ Deliver
This project follows a controlled AI execution approach:
- Input is structured before sending to AI
- AI output is treated as untrusted data
- Validation layers refine and filter output
- Requests are queued using BullMQ
- Workers process jobs independently
- Helps handle multiple requests efficiently
- Retry mechanism for failures
- Invalid outputs are rejected
- Basic fallback strategies applied
- WebSockets provide live updates
- Reduces polling
- Improves responsiveness
| Layer | Technologies |
|---|---|
| Frontend | Next.js, TypeScript, Tailwind CSS |
| Backend | Node.js, Express, TypeScript |
| Database | MongoDB Atlas |
| Queue/Cache | Redis + BullMQ |
| Real-Time | WebSockets |
| AI | Gemini / LLM APIs |
| Deployment | Vercel, Render, Upstash |
- AI-based question paper generation
- Structured input with difficulty control
- Validation pipeline for output quality
- Background job processing (BullMQ)
- Real-time updates via WebSockets
- Basic credit-based usage system
- Users log in via Google OAuth
- Backend generates a JWT token
- Token is used for all protected API requests
- Users submit assignment requests from the frontend
- Request passes through:
- Auth Middleware
- Validation Middleware (Zod)
- Controller receives validated request
- System verifies user credits:
- โ No credits โ Prompt upgrade/login
- โ Credits available โ Proceed
- Creates a pending assignment in MongoDB
- Pushes job to Bull Queue (Redis-based)
- Worker consumes job asynchronously
- Heavy processing handled outside request-response cycle
- AI (Gemini with fallback) generates the assignment
- Built-in retry mechanism on failure
- Parsing โ Converts raw AI output into structured JSON
- Validation โ Ensures correctness & completeness
- Distribution Logic โ Verifies marks distribution & difficulty balance
- Final assignment stored in MongoDB
- Cached in Redis for fast retrieval
- Worker emits events via Socket.io
- Frontend receives live updates:
processingcompleted
- Frontend fetches final assignment
- Displays the generated paper to the user
- Queue-based async processing with Bull + Redis
- AI fallback mechanism for reliability
- Real-time updates via Socket.io
- Credit-based access control
- Clean layered architecture (Controller โ Service โ Worker)
- Designed to be scalable and production-ready
- Prompt Builder โ structured input
- AI Generation โ raw output
- Parser โ JSON extraction
- Validator โ removes invalid data
- Normalizer โ formatting & deduplication
- Difficulty-based distribution
- Weighted marks allocation
- Maintains total marks consistency
- Retry mechanism (up to 3 attempts)
- Invalid output rejection
- Basic fallback generation
- Duplicate removal
- Redis caching
- Asynchronous processing
- Cache-first fetching
| Service | Platform |
|---|---|
| Frontend | Vercel |
| Backend | Render |
| Redis | Upstash |
| Database | MongoDB Atlas |
- Improve AI validation and consistency
- Add export formats (PDF, DOCX)
- Better difficulty balancing
- Answer key validation system
- Fork the repository
- Create a new branch
- Commit your changes
- Open a Pull Request
MIT License
Made with โค๏ธ by Nikhil Gupta
โก Learning, building, and improving systems step by step



