How ahmadtariq1/taiyaari works
Purpose and Entry Points
Taiyaari is an MDCAT preparation platform: authenticated study dashboards, topic/full-length tests, performance tracking, notes, leaderboard, daily planning, and AI tutoring. The two deployable applications are a FastAPI backend at backend/app/main.py (also backend/run.py) and a Next.js frontend rooted at frontend/src/app/layout.js and frontend/src/app/page.js.
Frontend Application Shell
The frontend uses Next.js App Router with page-level routes for dashboard, test-taking/results, progress, planner, leaderboard, profile, and AI tutor. Shared dashboard composition and a floating chat wrapper establish the main learner experience.
• frontend/src/app/dashboard/page.js
• frontend/src/components/dashboard/dashboard-layout.js
• frontend/src/components/floating-chat/ChatLayoutWrapper.js
Authentication state is managed client-side through Firebase integration and propagated through the app context; API calls are centralized separately.
• frontend/src/contexts/AuthContext.js
• frontend/src/lib/firebase.js
• frontend/src/lib/api.js
HTTP API and Access Boundary
FastAPI organizes versioned REST endpoints under the v1 router. Endpoint modules expose the domain surface: auth/users, subjects/topics/questions, tests/full-length tests, notes, performance, leaderboard, chatbot, and fine-tuned answers. Dependencies and security form the request authentication/authorization boundary before domain work.
• backend/app/api/v1/router.py
• backend/app/api/dependencies.py
• backend/app/core/security.py
Study Content and Assessment Domain
SQLAlchemy-style model/schema layers represent the durable academic system: subject/topic hierarchy, question banks, test definitions/sources, full-length question material, and submitted results. Test UI renders question navigation and then results/review analytics; API endpoints own server-side retrieval/submission behavior.
• backend/app/models/question.py
• backend/app/models/test.py
• backend/app/models/test_result.py
• frontend/src/components/test-interface/QuestionDisplay.js
• frontend/src/components/test-results/TestResultsContent.js
• backend/app/api/v1/endpoints/tests.py
Learner State, Analytics, and Planning
User-specific state includes performance records, notes, and daily tasks. Performance and leaderboard endpoints convert assessment/user data into progress views; the daily-task service is the key backend planning logic consumed by dashboard and planner UI.
• backend/app/models/performance.py
• backend/app/models/user_daily_task.py
• backend/app/services/daily_tasks.py
• frontend/src/components/dashboard/performance-overview.js
• frontend/src/components/dashboard/daily-planner.js
• backend/app/api/v1/endpoints/leaderboard.py
AI Tutor and Retrieval-Augmented Generation
Chat and fine-tuned-answer capabilities sit behind dedicated API endpoints. The RAG pipeline loads/extracts learning content, retrieves subject-scoped context, and accesses persisted vector indexes. This is distinct from relational test/user data and is the primary AI integration boundary.
• backend/app/api/v1/endpoints/chatbot.py
• backend/app/services/rag/pipeline.py
• backend/app/services/rag/retriever.py
Vector data is checked into local subject-specific stores, while source textbooks/past papers are prepared in extraction notebooks and processed text/JSON assets.
• backend/app/services/rag/vector_store.py
• backend/vector_db/biology/
• data_extraction/processed_json_files/
Persistence, Imports, and Runtime Dependencies
Backend configuration and database initialization are centralized in core modules. SQLite database artifacts are present at both root and data/; import scripts populate question and full-length-test content. Firebase is the explicit external identity service indicated by frontend integration and setup documentation. The operational runtime is Python/FastAPI plus Node.js/Next.js; local vector indexes support AI retrieval.
• backend/app/core/config.py
• backend/app/core/database.py
• backend/scripts/import_questions.py
• data/taiyaari.db
• backend/scripts/import_full_length_tests.py
• FIREBASE_SETUP.md
Main entry points: layout.js App shell and routes · router.py Versioned REST API · api.js API client · test_result.py Study models
Components 23
Next.js learner app
- App shell and routes · Dashboard, tests, progress, planner, leaderboard, profile, and tutor routes.
frontend/src/app/layout.js - Dashboard composition
frontend/src/components/dashboard/dashboard-layout.js - Test and results UI
frontend/src/components/test-interface/QuestionDisplay.js - Performance and planner UI
frontend/src/components/dashboard/performance-overview.js - Floating tutor chat
frontend/src/components/floating-chat/ChatLayoutWrapper.js - Client auth state
frontend/src/contexts/AuthContext.js - API client
frontend/src/lib/api.js
FastAPI application
- FastAPI entrypoint
backend/app/main.py - Versioned REST API · Exposes auth, content, tests, learner state, leaderboard, and AI endpoints.
backend/app/api/v1/router.py - Request access boundary
backend/app/api/dependencies.py
Study and learner domain
- Assessment endpoints · Retrieves tests and accepts submissions.
backend/app/api/v1/endpoints/tests.py - Study models · Questions, tests, and submitted results.
backend/app/models/test_result.py - Learner state models · Performance, notes, and daily tasks.
backend/app/models/performance.py - Daily task service
backend/app/services/daily_tasks.py - Leaderboard analytics
backend/app/api/v1/endpoints/leaderboard.py - Question import
backend/scripts/import_questions.py
AI retrieval pipeline
- Tutor and answer API
backend/app/api/v1/endpoints/chatbot.py - RAG pipeline
backend/app/services/rag/pipeline.py - Subject context retriever
backend/app/services/rag/retriever.py - Local vector indexes · Subject-specific retrieval indexes.
- Processed learning assets
Other components
- Firebase identity
frontend/src/lib/firebase.js - SQLite academic data
data/taiyaari.db
Connections 25
- App shell and routes → Dashboard composition: composes
- App shell and routes → Test and results UI: renders
- App shell and routes → Performance and planner UI: renders
- App shell and routes → Floating tutor chat: hosts
- Client auth state → Firebase identity: authenticates with
- App shell and routes → Client auth state: uses
- Dashboard composition → API client: loads learner data
- Test and results UI → API client: loads and submits
- Floating tutor chat → API client: sends prompts
- API client → FastAPI entrypoint: HTTP requests
- FastAPI entrypoint → Versioned REST API: mounts
- Versioned REST API → Request access boundary: enforces access
- Versioned REST API → Assessment endpoints: routes
- Versioned REST API → Leaderboard analytics: routes
- Versioned REST API → Tutor and answer API: routes
- Assessment endpoints → Study models: reads and writes
- Leaderboard analytics → Learner state models: aggregates
- Daily task service → Learner state models: manages
- Study models → SQLite academic data: persists in
- Learner state models → SQLite academic data: persists in
- Question import → Study models: populates
- Tutor and answer API → RAG pipeline: invokes
- RAG pipeline → Subject context retriever: retrieves context
- Subject context retriever → Local vector indexes: searches
- Processed learning assets → Local vector indexes: supplies indexed content