How rajverma04/ai_personalized_learning works
Project Type and Primary Purpose
• This is a full-stack interactive learning platform. It features multiple study modes (flashcards, MCQs, case studies, summarization, etc.) and integrates AI capabilities via the Google Gemini API.
• The application is split into two primary services: a Node.js based backend (handling routes, API endpoints, controllers, static files, and templates) and a Python-based AI service (running Flask in the ai_service directory).
File Structure
• Top-level Directories and Files:
• ai_service/: Contains the Flask application (app.py) and its Python dependency file (requirements.txt). This component likely handles AI-specific functionalities like text summarization and possibly processing voice input.
• backend/: Contains all Node.js code with sub-directories for controllers (business logic for AI operations), models (database interactions), routes (API endpoints), static assets (CSS, JS, images), templates (HTML files for the UI), and uploads (likely handling user-uploaded content).
• Other files like .gitignore, netlify.toml, and readme.md are for configuration and project documentation.
• Architectural Implications:
• The frontend is embedded within the backend (using templates and static directories) and is served to clients.
• The backend (Node.js) acts as an API server and includes controllers and models – suggestive of an MVC pattern.
• The ai_service (Python/Flask) likely functions as a microservice offering AI/processing capabilities that the backend calls via APIs.
Core Components & Their Relationships
• Frontend/UI Layer:
• Built with HTML/CSS/JavaScript and served through the backend’s templates and static directories.
• Responsible for presenting learning modes and interacting with users.
• Backend Service (Node.js):
• Routes: api.js (defines API endpoints) which connect the frontend with the business logic.
• Controllers & Models: Handle logic and database interactions respectively.
• Server Entry Point: server.js (starts the Node.js server).
• Data Flow: Receives user interactions and requests data from both local models and through calls to external services.
• AI Service (Flask):
• API Endpoint: app.py (entry point for AI-related requests).
• Dependencies: Python modules that facilitate integration with the Gemini API and other AI functionalities.
• Data Flow: Receives requests (likely from the backend) for AI tasks such as summarization or Q&A responses.
• External Services:
• Google Gemini API: Used for AI capabilities; configured via environment variables in the .env file.
Architectural Patterns and Design Principles
• Separation of Concerns:
• The system is clearly divided between user interface (frontend), business logic & API (backend), and specialized AI processing (ai_service).
• Microservices or Service-oriented Architecture:
• The ai_service (Flask) is a standalone service that can be scaled independently or integrated as an API consumed by the backend.
• MVC-Like Structure in Backend:
• Controllers, Models, and Routes in the backend enforce a separation between presentation, business logic, and data management.