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.