Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“š Smart Shiksha

AI-powered, multilingual educational platform designed for students in rural India.

Smart Shiksha uses Retrieval-Augmented Generation (RAG) to deliver personalized, curriculum-aligned lessons in 5 Indian languages. It combines real-time web search with a large language model to generate comprehensive study material, quizzes, flashcards, and competitive exam preparation โ€” all accessible from a Flutter app or a lightweight web portal.


โœจ Features

Feature Description
AI Lesson Generation Ask any academic question and get a detailed, structured Markdown lesson powered by Groq LLM + Google Search (RAG pipeline)
30 Indian Curricula CBSE, ICSE, all state boards โ€” 1,311 subjects and 17,038 chapters pre-seeded
5 Languages English, Hindi (เคนเคฟเคจเฅเคฆเฅ€), Kannada (เฒ•เฒจเณเฒจเฒก), Telugu (เฐคเฑ†เฐฒเฑเฐ—เฑ), Tamil (เฎคเฎฎเฎฟเฎดเฏ)
Quizzes Auto-generated chapter quizzes โ€” MCQ, multi-select, and numerical questions
Flashcards Quick-review flashcard decks per chapter
Competitive Exam Prep Mock tests for JEE Mains, JEE Advanced, NEET, and Board Exams
AI Tutor Chat Conversational tutoring on any academic topic
Offline Revision Lessons cached locally via SQLite for offline access (desktop/mobile)
Dev-Mode Login Email-based authentication for development; Auth0 Google Sign-In for production
Web Portal Material 3 multi-view SPA with dashboard, AI tutor chat, lesson viewer, and dark mode โ€” matches the Flutter app UI

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      Clients                             โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚ Flutter App  โ”‚  โ”‚  Web Portal โ”‚  โ”‚  REST Clients    โ”‚ โ”‚
โ”‚  โ”‚ (Windows/    โ”‚  โ”‚  (Material  โ”‚  โ”‚  (Swagger /      โ”‚ โ”‚
โ”‚  โ”‚  Android)    โ”‚  โ”‚   3 SPA)    โ”‚  โ”‚   Postman)       โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚                โ”‚                   โ”‚
          โ–ผ                โ–ผ                   โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                  FastAPI Backend                         โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚  Auth    โ”‚ โ”‚ Lessons  โ”‚ โ”‚  Quiz     โ”‚ โ”‚Competitiveโ”‚  โ”‚
โ”‚  โ”‚ (Auth0  โ”‚ โ”‚ (RAG)    โ”‚ โ”‚ Generator โ”‚ โ”‚ Mock Testsโ”‚  โ”‚
โ”‚  โ”‚  + JWT)  โ”‚ โ”‚          โ”‚ โ”‚           โ”‚ โ”‚           โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                โ”‚
โ”‚  โ”‚ Syllabus โ”‚ โ”‚ Progress โ”‚ โ”‚  Users    โ”‚                โ”‚
โ”‚  โ”‚ Browser  โ”‚ โ”‚ Tracker  โ”‚ โ”‚  Profile  โ”‚                โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚                       โ”‚
           โ–ผ                       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  SQLite / Postgres โ”‚  โ”‚    External APIs                โ”‚
โ”‚  (10 tables)       โ”‚  โ”‚  โ€ข Groq (Llama 3.3 70B)        โ”‚
โ”‚                    โ”‚  โ”‚  โ€ข Serper (Google Search)       โ”‚
โ”‚                    โ”‚  โ”‚  โ€ข Auth0 (Google OAuth)         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“‚ Project Structure

smartsiksha/
โ”œโ”€โ”€ .env                          # API keys & secrets (not committed)
โ”œโ”€โ”€ .env.example                  # Template for .env
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ README.md                     # โ† you are here
โ”œโ”€โ”€ HOW_TO_RUN.md                 # Detailed setup & run guide
โ”‚
โ”œโ”€โ”€ backend/                      # FastAPI backend
โ”‚   โ”œโ”€โ”€ requirements.txt          # Python dependencies (pinned)
โ”‚   โ””โ”€โ”€ app/
โ”‚       โ”œโ”€โ”€ main.py               # App entry point, lifespan, middleware
โ”‚       โ”œโ”€โ”€ config.py             # Pydantic settings from .env
โ”‚       โ”œโ”€โ”€ auth.py               # Auth0 JWKS token verification + JWT
โ”‚       โ”œโ”€โ”€ database.py           # SQLAlchemy async engine + sessions
โ”‚       โ”œโ”€โ”€ models.py             # 10 ORM models (User, Lesson, Quiz, etc.)
โ”‚       โ”œโ”€โ”€ schemas.py            # Pydantic request/response schemas
โ”‚       โ”œโ”€โ”€ routers/
โ”‚       โ”‚   โ”œโ”€โ”€ auth.py           # POST /api/auth/google, GET /api/auth/me
โ”‚       โ”‚   โ”œโ”€โ”€ lessons.py        # POST /api/ask, save/load lessons
โ”‚       โ”‚   โ”œโ”€โ”€ quiz.py           # Generate & fetch quizzes
โ”‚       โ”‚   โ”œโ”€โ”€ competitive.py    # Mock tests for JEE/NEET
โ”‚       โ”‚   โ”œโ”€โ”€ syllabus.py       # Browse curricula/subjects/chapters
โ”‚       โ”‚   โ”œโ”€โ”€ progress.py       # User progress tracking
โ”‚       โ”‚   โ””โ”€โ”€ users.py          # User registration & profile
โ”‚       โ””โ”€โ”€ services/
โ”‚           โ”œโ”€โ”€ groq_service.py   # Groq LLM wrapper
โ”‚           โ”œโ”€โ”€ serper_service.py # Google Search via Serper API
โ”‚           โ”œโ”€โ”€ rag_pipeline.py   # Search โ†’ Context โ†’ LLM โ†’ Response
โ”‚           โ””โ”€โ”€ syllabus_seed.py  # Seeds 30 curricula on first boot
โ”‚
โ”œโ”€โ”€ flutter_app/                  # Cross-platform Flutter client
โ”‚   โ”œโ”€โ”€ pubspec.yaml              # Dart dependencies
โ”‚   โ””โ”€โ”€ lib/
โ”‚       โ”œโ”€โ”€ main.dart             # App entry point
โ”‚       โ”œโ”€โ”€ app.dart              # MaterialApp with routing
โ”‚       โ”œโ”€โ”€ core/                 # API client, constants, theme
โ”‚       โ”œโ”€โ”€ l10n/                 # Localization (5 languages)
โ”‚       โ”œโ”€โ”€ models/               # User, Lesson, Syllabus models
โ”‚       โ”œโ”€โ”€ services/             # Auth, API, DB, localization services
โ”‚       โ””โ”€โ”€ screens/              # 12 screens (login โ†’ dashboard โ†’ lessons โ†’ quiz)
โ”‚
โ”œโ”€โ”€ web/                          # Material 3 web portal (SPA)
โ”‚   โ”œโ”€โ”€ index.html                # Multi-view SPA: login, dashboard, tutor, lessons
โ”‚   โ”œโ”€โ”€ css/style.css             # Material 3 CSS with dark mode & responsive grid
โ”‚   โ”œโ”€โ”€ js/
โ”‚   โ”‚   โ”œโ”€โ”€ auth.js               # Auth0 + dev-mode email login + JWT
โ”‚   โ”‚   โ”œโ”€โ”€ app.js                # SPA navigation stack, dashboard, AI chat
โ”‚   โ”‚   โ”œโ”€โ”€ markdown.js           # Secure Markdown โ†’ HTML renderer
โ”‚   โ”‚   โ””โ”€โ”€ i18n.js               # Client-side internationalization
โ”‚   โ””โ”€โ”€ locales/                  # en, hi, kn, te, ta JSON files
โ”‚
โ””โ”€โ”€ tasks/                        # Development task tracking

๐Ÿš€ Quick Start

Prerequisites: Python 3.11+, Flutter 3.22+ (optional for Flutter client), Git

1. Clone & configure

git clone <repository-url>
cd smartsiksha
cp .env.example .env
# Edit .env โ€” add your GROQ_API_KEY and SERPER_API_KEY

2. Start the backend

cd backend
pip install -r requirements.txt
python -m uvicorn app.main:app --host 0.0.0.0 --port 8001

The database auto-initializes and seeds 30 curricula on first boot. API docs are at http://localhost:8001/docs.

3. Run a client

Web portal:

cd web
python -m http.server 5500
# Open http://localhost:5500

Flutter (Windows desktop):

cd flutter_app
flutter pub get
$env:CL = "/FS"
flutter run -d windows

Flutter (Android emulator):

cd flutter_app
flutter pub get
flutter emulators --launch <emulator-name>
flutter run -d <emulator-id>

The Android emulator connects to the backend via http://10.0.2.2:8001/api. Internet permission and cleartext traffic are pre-configured.

See HOW_TO_RUN.md for detailed setup instructions, troubleshooting, and all run options.


๐Ÿ”‘ Environment Variables

Variable Required Description
GROQ_API_KEY Yes API key from console.groq.com
GROQ_MODEL No LLM model name (default: llama-3.3-70b-versatile)
SERPER_API_KEY Yes API key from serper.dev
DATABASE_URL No SQLAlchemy URL (default: local SQLite)
AUTH0_DOMAIN Yes Auth0 tenant domain (e.g. xxx.us.auth0.com)
AUTH0_CLIENT_ID Yes Auth0 SPA application client ID
JWT_SECRET_KEY Yes Random secret for JWT signing โ€” generate with python -c "import secrets; print(secrets.token_urlsafe(64))"
JWT_EXPIRE_MINUTES No Token lifetime in minutes (default: 60)
DEBUG No Enable dev-mode auth bypass (default: false)
UNSPLASH_ACCESS_KEY No Unsplash API key for lesson images

๐Ÿ“ก API Endpoints

Method Endpoint Auth Description
GET /api/health โ€” Health check
GET /api/languages โ€” List supported languages
POST /api/auth/login โ€” Auth0 Sign-In (ID token โ†’ JWT)
GET /api/auth/me JWT Current user profile
POST /api/auth/onboarding JWT Complete curriculum onboarding
PATCH /api/auth/profile JWT Update profile fields
POST /api/ask JWT Generate AI lesson (RAG pipeline)
POST /api/lessons/save JWT Save a lesson
GET /api/lessons/mine JWT Get current user's saved lessons
GET /api/syllabus/curricula โ€” List all 30 curricula
GET /api/syllabus/subjects โ€” Subjects for curriculum/class
GET /api/syllabus/chapters/{subject_id} โ€” Chapters for a subject
POST /api/quiz/generate JWT Generate quiz for a chapter
GET /api/competitive/exams JWT List competitive exams
POST /api/competitive/mock-test/generate JWT Generate mock test

Full interactive docs: http://localhost:8001/docs


๐Ÿ›ก๏ธ Security

  • Authentication: Auth0 Google Sign-In (RS256 ID token verified via JWKS) โ†’ backend-issued JWT (HS256); dev-mode email login available when DEBUG=true
  • Authorization: All user-data endpoints enforce ownership checks
  • Rate limiting: slowapi โ€” 10 req/min for AI generation, 30 req/min default
  • Input validation: Pydantic schemas on all request bodies
  • XSS protection: Escape-first Markdown renderer, CSP headers on web portal
  • CORS: Restricted to explicit localhost origins (no wildcards)
  • Secrets: .env excluded via .gitignore, no defaults for critical keys

๐Ÿ› ๏ธ Tech Stack

Layer Technology
Backend FastAPI ยท Python 3.11 ยท SQLAlchemy (async) ยท Pydantic
Database SQLite (dev) / PostgreSQL (prod)
AI / LLM Groq Cloud โ€” Llama 3.3 70B Versatile
Search Serper API (Google Search)
Auth Auth0 (JWKS / RS256) ยท python-jose JWT
Flutter App Flutter 3.22+ ยท Dart ยท Provider ยท sqflite
Web Portal Material 3 SPA ยท Vanilla JS ยท Custom Markdown renderer ยท i18n ยท Dark mode
Platforms Windows ยท Web ยท Android ยท iOS

๐ŸŒ Supported Languages

Code Language Script
en English Latin
hi เคนเคฟเคจเฅเคฆเฅ€ (Hindi) Devanagari
kn เฒ•เฒจเณเฒจเฒก (Kannada) Kannada
te เฐคเฑ†เฐฒเฑเฐ—เฑ (Telugu) Telugu
ta เฎคเฎฎเฎฟเฎดเฏ (Tamil) Tamil

All AI-generated content (lessons, quizzes, flashcards) is produced natively in the selected language. The UI is fully localized across all 5 languages for both the Flutter app and the web portal.


๐Ÿ“„ License

This project was developed as part of an academic research initiative. See Smart_Shiksha_IEEE_Paper.tex for the accompanying IEEE paper.


๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Commit changes (git commit -m "Add your feature")
  4. Push to the branch (git push origin feature/your-feature)
  5. Open a Pull Request

Please ensure all API endpoints remain backward-compatible and include tests for new features.

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages