How akki2104/jeeprep works
1. Overall shape
- This is a single-APK Android app built around a single-activity, multi-screen Compose UI.
- The core architecture is MVVM + Repository + Room, with Hilt wiring dependencies and Kotlin Coroutines/Flow handling async work and streamed AI output.
2. App entry and bootstrapping
- JeePrepApp.kt is the application entry point and appears responsible for Hilt startup and first-run database seeding.
- MainActivity.kt hosts the Compose root and navigation graph, so the whole app is routed from one UI shell rather than multiple activities.
3. Persistence layer
- The local database is the center of the app’s state. AppDatabase.kt plus the entity/ and dao/ packages define the Room schema and access patterns.
- The schema stores academic content and user state together: subjects, topics, questions, attempts, notes, memory tricks, mock tests, results, and bookmarks.
- DatabaseInitializer.kt and SeedData.kt populate the baseline subject/topic hierarchy and starter question bank on first launch.
4. Primary data flow
- Screen state flows from UI → ViewModel → Repository → DAO / AI layer → Room → UI.
- The repositories are split by responsibility:
- QuestionRepository for practice questions, AI-generated questions, and bookmarks
- NotesRepository for notes and memory tricks
- PerformanceRepository for analytics, weak areas, and progress summaries
5. Offline AI subsystem
- The AI boundary lives under app/ai/ and is built for on-device inference, not a server round trip.
- AiEngine.kt wraps local LLM execution through LiteRT-LM with streaming responses.
- ModelDownloadManager.kt handles the large model download and likely the resume/progress lifecycle for the initial ~2.58 GB payload.
- PromptTemplates.kt centralizes the structured prompts for explanations, MCQ generation, notes, mnemonics, and weakness analysis.
- GeminiApiService.kt is part of that AI boundary, but the repo’s architecture is still centered on local model execution after download, not a permanent cloud dependency.
6. AI content caching boundary
- A key architectural choice is that generated AI output is cached in Room.
- That means explanations, notes, and memory tricks can be reused instantly after first generation, reducing repeated inference and keeping the app usable offline.
7. Practice and PYQ subsystem
- The practice area is organized as a guided flow: subject → topic → question session → submitted answer → AI explanation.
- PracticeScreen, QuestionSessionScreen, and their view models drive this experience.
- The question bank is seeded from repository data and/or assets/questions.json, making PYQ content a local, offline dataset rather than a network-backed catalog.
8. Mock test subsystem
- Mock testing is a separate flow with its own state and results handling.
- MockTestScreen, MockResultScreen, and the mock-test view models support timed exams, question palette behavior, mark-for-review, auto-submit, and result storage.
- Results feed back into the performance tables, so mock tests are both a user feature and a source of analytics data.
9. Study notes and memory tricks
- NotesScreen and NotesViewModels expose AI-generated revision material by topic.
- These outputs are designed to be concise, formula-heavy, and reusable offline once cached.
- PremiumGate.kt suggests some of these higher-cost AI features are expected to be conditionally exposed by plan or quota.
10. Progress and analytics
- ProgressScreen and PerformanceRepository form the analytics subsystem.
- This layer aggregates accuracy, subject-wise breakdown, topic heatmaps, streaks, mock-test progression, and weak-area analysis from user_attempts and mock-test results.
- This is the app’s feedback loop: user actions in practice/tests become stored attempts, which then power progress insights and AI study guidance.
11. Navigation and UI composition
- NavGraph.kt and BottomNav.kt define the app’s primary route structure and persistent navigation affordances.
- The main user-facing sections are split into distinct screens: Home, Practice, Notes, Progress, Mock Test, PYQ, Chat, Download, Premium, and Mistakes.
- ui/theme/ provides Material 3 theming and subject/status colors, which helps make the academic domains visually distinct.
12. Math rendering and content formatting
- The presence of assets/math_renderer.html and MathText.kt shows a dedicated boundary for rendering LaTeX-style math content inside the app.
- This matters because AI-generated notes and explanations can contain formulas, so math rendering is treated as a presentation concern rather than embedded into the data model.
13. Premium and gating
- premium/PremiumManager.kt and ui/components/PremiumGate.kt isolate entitlement checks from the rest of the app.
- Architecturally, this keeps “what the user can access” separate from “how the content is generated or stored,” which is important if free-vs-paid limits are enforced later.
14. Assets and tooling
- questions.json is a local content source for question seeding, and tools/generate_questions.py indicates there is an offline content-generation or dataset-prep workflow outside the Android app.
- The repo is otherwise a standard Android Gradle project with no backend service in the runtime path; the major external dependency is the one-time model download for the on-device LLM.
Main entry points: NavGraph.kt Nav Graph · QuestionRepository.kt Question Repo · AiEngine.kt AI Engine · MockTestScreen.kt Mock Test
Components 34
App shell
Android entry points and root navigation
- JeePrepApp · Hilt app entry and first-run bootstrap
app/src/main/java/com/jeeprep/app/JeePrepApp.kt - MainActivity · Single-activity Compose host
app/src/main/java/com/jeeprep/app/MainActivity.kt
Data layer
Room storage, seeding, and repositories
- App Database · Central Room store
app/src/main/java/com/jeeprep/app/data/db/AppDatabase.kt - Seed Data · Initial subjects and questions
app/src/main/java/com/jeeprep/app/data/SeedData.kt - DB Initializer · First-launch population logic
app/src/main/java/com/jeeprep/app/data/DatabaseInitializer.kt - Question Repo · Practice, bookmarks, and question flows
app/src/main/java/com/jeeprep/app/data/repository/QuestionRepository.kt - Notes Repo · Notes and memory tricks
app/src/main/java/com/jeeprep/app/data/repository/NotesRepository.kt - Performance Repo · Attempts and analytics aggregation
app/src/main/java/com/jeeprep/app/data/repository/PerformanceRepository.kt - Question DAO · Question and bookmark access
app/src/main/java/com/jeeprep/app/data/db/dao/QuestionDao.kt - Subject DAO · Subjects and topics access
app/src/main/java/com/jeeprep/app/data/db/dao/SubjectTopicDao.kt - Other DAOs · Notes, attempts, mock results, and related tables
app/src/main/java/com/jeeprep/app/data/db/dao/OtherDaos.kt - Questions Asset · Seed question dataset
app/src/main/assets/questions.json
AI layer
Local model execution, prompts, and downloads
- AI Engine · Streaming on-device inference
app/src/main/java/com/jeeprep/app/ai/AiEngine.kt - Model Download · Large model fetch and resume handling
app/src/main/java/com/jeeprep/app/ai/ModelDownloadManager.kt - Prompt Templates · Structured prompts for generation tasks
app/src/main/java/com/jeeprep/app/ai/PromptTemplates.kt - Gemini API · External AI boundary in the app
app/src/main/java/com/jeeprep/app/ai/GeminiApiService.kt
UI layer
Compose screens, navigation, and shared components
- Nav Graph · Primary route structure
app/src/main/java/com/jeeprep/app/ui/navigation/NavGraph.kt - Bottom Nav · Persistent section switching
app/src/main/java/com/jeeprep/app/ui/navigation/BottomNav.kt - Home · Landing dashboard
app/src/main/java/com/jeeprep/app/ui/screens/home/HomeScreen.kt - Practice · Subject-topic practice flow
app/src/main/java/com/jeeprep/app/ui/screens/practice/PracticeScreen.kt - Question Session · Answering and explanation flow
app/src/main/java/com/jeeprep/app/ui/screens/practice/QuestionSessionScreen.kt - Notes · Revision notes and mnemonics
app/src/main/java/com/jeeprep/app/ui/screens/notes/NotesScreen.kt - Progress · Analytics and weak areas
app/src/main/java/com/jeeprep/app/ui/screens/progress/ProgressScreen.kt - Mock Test · Timed exam workflow
app/src/main/java/com/jeeprep/app/ui/screens/mocktest/MockTestScreen.kt - Mock Result · Score and result summary
app/src/main/java/com/jeeprep/app/ui/screens/mocktest/MockResultScreen.kt - PYQ · Previous-question-bank browsing
app/src/main/java/com/jeeprep/app/ui/screens/pyq/PYQScreen.kt - Chat · AI help and explanations
app/src/main/java/com/jeeprep/app/ui/screens/chat/ChatScreen.kt - Model Download · Local model download progress
app/src/main/java/com/jeeprep/app/ui/screens/download/ModelDownloadScreen.kt - Premium · Entitlement and upgrade gate
app/src/main/java/com/jeeprep/app/ui/screens/premium/PremiumScreen.kt - Mistakes · Error journal and review
app/src/main/java/com/jeeprep/app/ui/screens/mistakes/MistakeJournalScreen.kt - Math Text · Formula rendering helper
app/src/main/java/com/jeeprep/app/ui/components/MathText.kt - Premium Manager · Access and plan checks
app/src/main/java/com/jeeprep/app/premium/PremiumManager.kt - Theme · Material 3 colors and styling
app/src/main/java/com/jeeprep/app/ui/theme/Theme.kt - Math Renderer · HTML math rendering bridge
app/src/main/assets/math_renderer.html
Connections 45
- JeePrepApp → DB Initializer: boots · Initializes first-run data
- JeePrepApp → MainActivity: starts · Launches the single activity
- MainActivity → Nav Graph: hosts · Sets the root navigation graph
- Nav Graph → Bottom Nav: uses · Provides section switching
- Nav Graph → Home: routes · Home destination
- Nav Graph → Practice: routes · Practice destination
- Nav Graph → Notes: routes · Notes destination
- Nav Graph → Progress: routes · Progress destination
- Nav Graph → Mock Test: routes · Mock test destination
- Nav Graph → PYQ: routes · PYQ destination
- Nav Graph → Chat: routes · Chat destination
- Nav Graph → Model Download: routes · Model download destination
- Nav Graph → Premium: routes · Premium destination
- Nav Graph → Mistakes: routes · Mistakes destination
- Practice → Question Session: opens · Drills into a question session
- Home → Question Repo: loads · Surfaces practice content
- Practice → Question Repo: reads · Fetches subjects, topics, and questions
- Question Session → AI Engine: explains · Requests streamed AI explanations
- Notes → Notes Repo: reads · Fetches cached notes and tricks
- Chat → AI Engine: converses · Streams on-device responses
- Model Download → Model Download: manages · Controls model fetch lifecycle
- Model Download → AI Engine: feeds · Prepares local model execution
- AI Engine → Prompt Templates: formats · Uses structured task prompts
- AI Engine → Gemini API: boundary · External AI interface
- Question Repo → Question DAO: queries · Question storage access
- Question Repo → Subject DAO: queries · Subject and topic hierarchy
- Question Repo → Other DAOs: writes · Bookmarks and attempts persistence
- Notes Repo → Other DAOs: uses · Notes and memory trick storage
- Performance Repo → Other DAOs: aggregates · Builds progress analytics
- Question DAO → App Database: backed by · Room access layer
- Subject DAO → App Database: backed by · Room access layer
- Other DAOs → App Database: backed by · Room access layer
- DB Initializer → Seed Data: populates · Seeds baseline data
- DB Initializer → Questions Asset: loads · Imports local question content
- Mock Test → Question Repo: consumes · Pulls exam questions
- Mock Test → Performance Repo: stores · Persists results and attempts
- Mock Test → Mock Result: navigates · Shows result summary
- Progress → Performance Repo: reads · Displays analytics and trends
- Mistakes → Performance Repo: reads · Builds mistake journal from attempts
- Premium → Premium Manager: checks · Evaluates entitlements
- Notes → Premium Manager: gates · Limits higher-cost features
- Math Text → Math Renderer: renders · Displays formula content
- Theme → Home: styles · Shared UI styling
- Theme → Practice: styles · Shared UI styling
- Theme → Notes: styles · Shared UI styling