Prepare is a full-stack educational SaaS platform that helps students learn smarter through AI-generated practice exams, conversational AI tutoring, and session-based note management β all in one place.
- Enter any topic (or upload a PDF) and get 10 auto-generated MCQ questions powered by Google Gemini
- 2-minute countdown timer with color warnings
- Visual question navigation panel (unanswered β marked β answered)
- Instant score + detailed answer explanations on submission
- Chat with an AI that explains topics interactively with examples
- Real-time streaming responses β no waiting for full replies
- Full chat history saved and accessible from your dashboard
- Markdown rendering for clean, structured answers
- Create, edit, and delete notes directly within a chat session
- Notes are auto-saved on page leave
- Organized per user and per session
- Soft-delete support (notes are recoverable)
- Email verification on signup (account inactive until verified)
- Secure password reset via tokenized email links
- Daily usage quotas β 3 exam generations and 10 chat interactions per day (auto-reset every 24 hours)
| Layer | Technology |
|---|---|
| Backend | Django 5.2.5 (Python) |
| Relational DB | PostgreSQL via Neon, Render |
| Document DB | MongoDB Atlas (via MongoEngine ODM) |
| AI | Google Gemini 2.5 Flash API |
| Frontend | Django Templates + Tailwind CSS |
| JS | Vanilla JavaScript + Fetch API |
| Markdown | Marked.js |
| Gmail SMTP | |
| Static Files | Whitenoise |
| Containerization | Docker |
Prepare uses a dual-database architecture:
- PostgreSQL β handles structured, relational data: users, sessions, usage quotas
- MongoDB β handles flexible document storage: chats, exams, notes
βββββββββββββββββββββββββββββββββββββββββββββββ
β Client β
β (Django Templates + Tailwind + JS) β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββ
β
ββββββββββββββββββββββΌβββββββββββββββββββββββββ
β Django Backend β
β Auth β Exam Module β Chat Module β Notes β
ββββββββ¬ββββββββββββββ¬βββββββββββββββ¬ββββββββββ
β β β
PostgreSQL MongoDB Gemini API
(Users, (Exams, (AI responses,
Sessions, Chats, Question gen,
Quotas) Notes) Streaming)
User Input (Topic + Optional PDF)
β
opt1_view β File upload to temp folder
β
Gemini API β Parse JSON questions
β
Store in MongoDB β Set session['exam_id']
β
exam_view β User answers questions
β
update_exam β Save responses + calculate score
create_chat β New MongoDB chat document
β
start_chat β Set session['chat_id']
β
ask_view β Stream response from Gemini
β
save_chat_history β Store in ChatHistory
β
Frontend renders Markdown response
β
create_note β Attach notes to session
| Endpoint | Method | Description |
|---|---|---|
/api/get-gen-ques/ |
GET | Fetch generated exam questions |
/api/update-exam/ |
POST | Save user answers & score |
/api/create_chat/ |
POST | Create a new chat session |
/api/ask/ |
POST | Send message (streaming response) |
/api/get-chats/ |
GET | List all user chats |
/api/get-chathis/ |
GET | Fetch chat message history |
/api/create-note/ |
POST | Create a new note |
/api/get-noteslist/ |
GET | List all notes |
/api/update-note/ |
POST | Update note content |
/api/delete-note/ |
DELETE | Delete a note (soft delete) |
- Python 3.x
- Node.js (for Tailwind CSS compilation)
- MongoDB Atlas account
- PostgreSQL database (Neon recommended)
- Google Gemini API key
- Gmail account (for SMTP)
git clone https://github.com/lubaid-01/Prepare.git
cd preparepython -m venv venv
source venv/bin/activate # macOS/Linux
venv\Scripts\activate # Windowspip install -r requirements.txtCreate a .env file in the project root:
DJANGO_SECRET_KEY=your_secret_key
DJANGO_DEBUG=True
DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1
DATABASE_URL=your_postgresql_connection_string
MONGO_URI=your_mongodb_atlas_connection_string
GEMINI_API_KEY=your_google_gemini_api_key
EMAIL_HOST_USER=your_gmail_address
GMAIL_PASSWORD=your_gmail_app_passwordpython manage.py migratenpm install
npx tailwindcss -i ./static/css/input.css -o ./static/css/output.css --watchpython manage.py runserverVisit http://127.0.0.1:8000 in your browser.
docker build -t prepare .
docker run -p 8000:8000 --env-file .env prepare- CSRF protection on all POST requests
@login_requiredenforced on all protected endpoints- Users remain inactive until email is verified
- Token-based password reset
- Secrets managed via
.env(never committed to version control)
prepare/
βββ project/
β βββ core/ # Main app (exam, chat, notes)
β β βββ views.py # All core view logic
β β βββ templates/core/ # HTML templates
β βββ accounts/ # Auth, registration, verification
β βββ static/
β β βββ js/
β β βββ exam.js # Timer, navigation, submission
β β βββ opt2.js # Streaming chat, notes panel
β β βββ profile.js # Dashboard: history, results
β βββ settings.py
βββ Dockerfile
βββ requirements.txt
βββ .env.example
| Feature | Daily Limit | Reset |
|---|---|---|
| Exam Generation | 3 per day | Every 24 hours |
| Chat Interactions | 10 per day | Every 24 hours |
Contributions are welcome! Please open an issue first to discuss any changes you'd like to make, then submit a pull request.
This project is licensed under the MIT License.
Built with β€οΈ using Django, MongoDB, and Google Gemini.