A vocabulary-learning web app that helps users build their English vocabulary through personal flashcards, dictionary lookups, AI-powered word insights, and daily language content. It combines a Django REST backend, a MongoDB database, and a vanilla HTML/CSS/JavaScript frontend, with Google Gemini providing the AI features.
- User accounts — sign up and log in with token-based sessions; each user's flashcards are private to them.
- Flashcards — add, list, search, and delete flashcards (word, meaning, example sentence, synonyms, antonyms).
- Dictionary lookup — definitions, synonyms, and antonyms sourced from the Free Dictionary API, with Datamuse and NLTK WordNet as fallbacks.
- AI word lookup — Google Gemini generates a meaning, example sentence, synonyms, and antonyms for any word.
- Daily content — AI-generated Word of the Day, Phrase of the Day, and This Day in Language, cached per day in MongoDB.
- CLI quiz — a terminal flashcard quiz (main.py) for the MongoDB-backed deck.
| Layer | Technology |
|---|---|
| Backend | Django 5.2, django-cors-headers |
| Database | MongoDB (via PyMongo) |
| AI | Google Gemini (google-generativeai, Gemini 1.5 Flash/Pro) |
| NLP | NLTK (WordNet) |
| External | Free Dictionary API, Datamuse API |
| Frontend | HTML, CSS, vanilla JavaScript |
.
├── main.py # CLI flashcard quiz entry point
├── backend/
│ ├── manage.py # Django management entry point
│ ├── ai_agent.py # Google Gemini integration (word/phrase/daily content)
│ ├── quiz.py # CLI quiz logic
│ ├── backend/ # Django project config (settings, urls, wsgi/asgi)
│ ├── api/ # REST API app (views, urls)
│ └── database/
│ ├── db.py # MongoDB connection & collections
│ ├── flashcards.py # Flashcard data access
│ ├── dictionary.py # Dictionary lookup (FreeDict → Datamuse → WordNet)
│ ├── daily_content.py # Daily AI content with per-day caching
│ └── session_manager.py # Token-based session handling
└── frontend/
├── index.html # Vocabulary lookup page
├── login.html / login.js # Auth UI
├── dashboard.html / .js # Flashcard dashboard
└── *.css, script.js # Styles and shared scripts
- Python 3.13 (a
myenv/virtualenv is included in the repo) - MongoDB running locally at
mongodb://localhost:27017/(database:vocab_db) - A Google AI (Gemini) API key
-
Clone and enter the project
git clone <repo-url> cd "Learning Human Language with AI"
-
Create and activate a virtual environment (or use the bundled
myenv/)python -m venv myenv # Windows myenv\Scripts\activate # macOS/Linux source myenv/bin/activate
-
Install dependencies
pip install Django django-cors-headers pymongo google-generativeai python-dotenv nltk requests
-
Configure your API key — create a
.envfile in thebackend/directory:GOOGLE_AI_API_KEY=your_gemini_api_key_here
-
Start MongoDB (ensure the local server is running on port 27017).
cd backend
python manage.py runserverThe API is served under http://localhost:8000/api/.
Open the HTML files in frontend/ directly in a browser, or serve them with a static
file server (e.g. python -m http.server) and start from login.html.
python main.pyAll endpoints are prefixed with /api/. Flashcard endpoints require an
Authorization: Token <token> header.
| Method | Endpoint | Description |
|---|---|---|
| POST | /signup/ |
Register a new user |
| POST | /login/ |
Log in, returns a session token |
| POST | /add/ |
Add a flashcard |
| GET | /all/ |
List the user's flashcards |
| GET | /search/?query= |
Search flashcards by word or meaning |
| DELETE | /delete/ |
Delete a flashcard by id |
| GET | /lookup-word/?word= |
Dictionary lookup (FreeDict/Datamuse/WordNet) |
| GET | /lookup-word/ai/?word= |
AI-generated word details (Gemini) |
| GET | /daily-content/ |
Daily word, phrase, and language fact |
⚠️ This is a learning/student project. A few things are intentionally simple and not production-ready:
- Passwords are stored in plain text (no hashing).
- MongoDB connection details and
SECRET_KEYare hardcoded;DEBUG = True.CORS_ALLOW_ALL_ORIGINS = True.Harden these (password hashing, environment-based secrets, restricted CORS,
DEBUG = False) before any real deployment.