LexiLearn AI is a full-stack, AI-enhanced web application designed to optimize learning through an intelligent Spaced Repetition System (SRS). It goes beyond traditional flashcards by verifying user answers for semantic correctness and providing dynamic AI-generated hints, ensuring a truly adaptive and effective study experience.
LexiLearn AI combines proven learning science with modern AI capabilities:
- Spaced Repetition System (SRS): Implements an efficient algorithm (based on SM-2 principles) using a Priority Queue (Min-Heap) to intelligently schedule card reviews, prioritizing cards the user is most likely to forget.
- AI-Powered Answer Verification: Utilizes the Groq API (Llama 3) to perform semantic analysis of user-typed answers, ensuring correctness based on meaning, not just exact string matching.
- AI-Generated Hints: Provides on-demand, context-aware hints generated by AI to guide users without giving away the answer.
- Secure User Authentication: Features a robust JWT-based authentication system, ensuring each user's decks and progress are private.
- Full CRUD Operations: Seamlessly Create, Read, Update, and Delete decks and flashcards.
- Modern Full-Stack Architecture: Built with a decoupled React frontend and FastAPI backend, following professional design patterns.
- Dynamic & Responsive UI: Clean, dark-themed interface built with React Hooks and Context API for efficient state management.
LexiLearn AI leverages a modern, robust technology stack chosen for performance, scalability, and developer experience.
- Language: Python 3.9+
- Framework: FastAPI (async capabilities + Pydantic validation)
- Server: Uvicorn (ASGI server)
- Database: SQLAlchemy ORM with SQLite (easily adaptable to PostgreSQL)
- AI Integration: Groq API (via
groqlibrary) - Authentication:
python-jose(JWT),passlib[bcrypt](Password Hashing) - Data Structures: Python’s built-in
heapqfor Priority Queue - Architecture: MVC-like pattern — Routers, Services, Models, Schemas for clear separation of concerns
- Language: JavaScript (ES6+)
- Framework: React 18+ (using Hooks)
- Build Tool: Vite
- Routing:
react-router-dom - State Management: React Context API
- API Communication:
axios - Styling: CSS Variables + Component-scoped Inline Styles
LexiLearn AI isn’t just any CRUD app — it integrates intelligent logic for adaptive learning.
- Each flashcard tracks
next_review_date,interval, andease_factor. - When fetching the next card, the backend queries all due cards.
- These cards are inserted into a Min-Heap using Python’s
heapq. - Extracting the minimum (
heapq.heappop) guarantees the most overdue card is selected first. Time complexity:O(log n).
- User input is sent to the backend.
- The
_verify_answer_with_aiservice function sends a crafted prompt to the Groq API. - The AI compares semantic meaning between the user's and correct answer.
- Returns a Boolean (
TrueorFalse) based on conceptual correctness. - The result updates SRS parameters (interval, ease factor, next review).
get_hint_for_cardsends the card’s question and answer to the Groq API.- The AI generates a concise hint that helps without revealing the full answer.
Follow these steps to get LexiLearn AI running locally.
- Python 3.9+
- Node.js (v16+) & npm
- Git
- Clone the Repository
git clone [https://github.com/your-username/lexilearn-ai.git](https://github.com/your-username/lexilearn-ai.git) cd lexilearn-ai - Navigate to Backend Directory
cd backend - Create and Activate Virtual Environment
# For Windows python -m venv venv .\venv\Scripts\activate # For macOS/Linux python3 -m venv venv source venv/bin/activate
- Install Dependencies
pip install -r requirements.txt
- Configure Environment Variables
Create a
.envfile in thebackenddirectory and add your Groq API key:DATABASE_URL="sqlite:///./lexilearn.db" GROQ_API_KEY="your_groq_api_key_here"
- Start the Backend Server
(Leave this terminal running)
The backend API will be available at
python -m uvicorn app.main:app --reload
http://localhost:8000.
- Open a New Terminal
- Navigate to Frontend Directory
cd frontend - Install Dependencies
npm install
- Start the Frontend Server
(Leave this terminal running)
The frontend application will be available at
npm run dev
http://localhost:5173.
The backend API includes automatically generated, interactive documentation powered by Swagger UI. Once the backend server is running, you can access it at:
http://localhost:8000/docs
This allows you to explore and test all available API endpoints directly.