Intelligent, AI-Powered Student Productivity & Study Planner
DAI StudyTracker is a state-of-the-art study planning and tracking web application. It empowers students with AI-generated personalized study plans, topic summaries, automated flashcards/quizzes, and a conversational AI Study Coach that can directly read from and write to the user's study dashboard using agentic tool execution.
DAI StudyTracker is structured as a decoupled web application with a Next.js frontend, a Django REST API backend, and an intelligent AI agent layer.
graph TD
Client[Next.js Frontend] <-->|HTTPS / JSON API| Backend[Django API Server]
Backend <-->|Django ORM| DB[(Database / SQLite / Postgres)]
Backend <-->|Redis cache| Redis[(Redis Broker)]
Backend <-->|Smart Router / SDKs| AIProviders{AI Model Providers}
AIProviders <-->|Conversational / Tools| OpenAI[OpenAI / OpenRouter]
AIProviders <-->|Fast Text generation| Gemini[Google Gemini]
- Tech Stack: Next.js 16.2.6 (App Router), TypeScript, Tailwind CSS, Radix UI, Framer Motion, Embla Carousel.
- Key Design Patterns:
- Server & Client Components Separation: Dynamic page routes are rendered as Server Components to handle SEO metadata, while complex user interactions are delegated to modular Client Components under
components/. - Next.js 16 Proxy Router: Implements
proxy.ts(replacing the deprecatedmiddleware.tsnaming convention) to perform edge-level redirect optimizations (lowercase path enforcement, trailing slash removal) without interfering with static or validation crawler routes.
- Server & Client Components Separation: Dynamic page routes are rendered as Server Components to handle SEO metadata, while complex user interactions are delegated to modular Client Components under
- Tech Stack: Python 3.10+, Django, Django REST Framework, SQLite (Development) / PostgreSQL (Production), Redis.
- Key Apps:
users: User authentication, stats tracking, and profile management.study: Core entities includingStudyPlan,Topic,Task, andNote.ai_assistant: Core AI assistant services, serializers, and action schemas.
The backend implements a highly resilient AI service (AIService) in backend/apps/ai_assistant/services.py that handles:
- Dashboard Context Injection: Every user question automatically queries the Django ORM to serialize active study plans and notes, feeding it directly to the system prompt so the AI possesses real-time ground-truth knowledge of the user's dashboard.
- Dual Routing: Dynamically inspects the user prompt; routing conversational requests to fast, cost-efficient chat models (e.g.,
openrouter/free), and structural requests (e.g., generating 4-week study plans or multiple-choice quizzes) to capable reasoning models (e.g.,gpt-4o-mini,gemini-1.5-flash). - Dynamic Failover & Resilience: Caches deprecated or rate-limited model IDs (e.g.,
google/gemma-2-9b-it:free) at the class level and automatically falls back to alternative stable endpoints (such asmeta-llama/llama-3-8b-instruct:freeorqwen-2.5-7b-instruct:free). - Agentic Database Mutations (Tool Calling): When a user instructs the AI to make a change (e.g., "create a plan for Chemistry" or "complete my focus task"), the LLM returns a structured JSON tool call. The backend extracts this, runs the corresponding ORM mutations, feeds the database execution result back into the prompt, and returns a natural language response.
To ensure search engine indexing health, the application is optimized for Google Search Console (GSC) and Google AdSense validation:
- Canonical Validation: Every core landing route (
/,/about,/features,/how-it-works,/pricing) exports explicit, self-referential canonical tags to avoid layout metadata inheritance conflicts. - Sitemap & Robots.txt: Automated sitemap generation (
/sitemap.xml) lists only final, indexable marketing pages, excluding private pages (/dashboard,/login,/register).robots.txtexplicitly allows crawling of features/pricing and disallows dashboard/checkout paths. - Domain Canonization: Non-www to www domain redirections are offloaded directly to Vercel's edge network routing rules. This prevents conflicts and infinite redirect loops with the application-level middleware.
- AdSense Crawling Compliance: The
proxy.tsmatcher explicitly excludes static verification targets:This ensures that Google AdSense can query'/((?!api|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt|ads.txt|.*\\..*).*)'/ads.txtdirectly (returning200 OK) without encountering authentication checks or redirects.
The deployment pipeline is fully automated and designed for cloud scalability:
A custom Bash shell script (deploy.sh) automatically orchestrates environment initialization:
- Installs Docker and Docker Compose if missing.
- Stops any conflicting containers.
- Builds and spins up the backend database (PostgreSQL), Redis broker, and Django API service in detached mode.
- Performs health-check polling on the backend (
/health/). - Installs frontend Next.js packages and fires up the development server on
localhost:3000.
- Frontend: Deployed on Vercel with custom domain configurations (
www.daistudy.online). - Backend API: Hosted on Railway via containerized Docker configurations, pointing to production PostgreSQL and Redis engines.
- DNS & SSL: Managed via Cloudflare for SSL termination, request buffering, and caching optimization.
To set up DAI StudyTracker in your local environment, follow these steps:
- Docker Engine & Docker Compose
- Node.js (v18+) &
npm/pnpm - Python 3.10+ (if running without Docker)
Simply run the root launch script to build the backend containers and boot the frontend:
chmod +x deploy.sh
./deploy.sh-
Backend Configuration:
- Navigate to
backend/and duplicate.env.exampleas.env. - Configure database variables, along with
GOOGLE_AI_API_KEYorOPENAI_API_KEYfor AI features. - Start backend manually:
cd backend docker compose up --build
- Navigate to
-
Frontend Configuration:
- Copy
.env.production(or local env) into the root folder. - Install packages and start the Next.js development server:
npm install npm run dev
- Open http://localhost:3000 in your browser.
- Copy