DEV Community

Ritik Ahirwar
Ritik Ahirwar

Posted on

Campus Copilot — AI Academic Assistant for a College Student

Hacktoberfest Weekend Challenge: Build for a Friend Submission 🤝

This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend.

What I Built

College students often have information scattered across attendance, assignments, exams, notes, and to-do lists. A generic chatbot can give advice, but it does not necessarily understand the student's actual academic situation.

I built Campus Copilot, an AI-powered academic assistant designed around that problem.

It combines deterministic academic logic with an open-weight AI workflow to turn campus context into concrete actions.

What it does

  • Dashboard — attendance ring, warnings, deadlines, and today's recommended actions
  • Attendance — subject-level attendance, 75% warnings, and skip/attend simulation
  • Academics — assignments, exams, and notes CRUD
  • Productivity — tasks and study plans ranked by risk and due dates
  • Assistant — contextual chat with structured actions such as:
    • create_task
    • start_study_block
    • flag_attendance
  • Daily Priorities — personalised academic priority planning
  • Summarize — converts study material into concise bullet points
  • Quiz Generator — generates interactive MCQs with explanations
  • Flashcards — generates tap-to-flip Q&A cards
  • AI Study Plan — enhances the deterministic study plan with AI recommendations

The key idea is simple: instead of saying "study DSA today", the assistant can use actual attendance risk, deadlines, tasks, and academic context to recommend what the student should do next.

All AI features have graceful rule-based fallbacks when Ollama is unavailable, so the core application remains functional without a GPU.


Demo

Live Demo

Frontend:

https://campus-chatbot-kbkdt49ms-ritikahirwar8168-dev.vercel.app

Backend API:

https://campus-chatbot-bzk0.onrender.com

Demo Login

Field Value
Username demo
Password campus

The seeded demo student is Ritik, a B.Tech CSE semester 5 student with subjects, assignments, exams, notes, and tasks.


Code

GitHub Repository:

https://github.com/ritikahirwar8168-dev/campus-chatbot

The repository contains both the FastAPI backend and React/Vite frontend:

campus-chatbot/
├── backend/
└── frontend/
Enter fullscreen mode Exit fullscreen mode

How I Built It

Campus Copilot is built around Gemma 3 4B, Google's open-weight model, served locally through Ollama during development.

AI stack

  • Model: Gemma 3 4B
  • Inference: Ollama
  • Backend: FastAPI + SQLAlchemy + SQLite
  • Frontend: React 18 + Vite 6 + Tailwind CSS 3
  • Authentication: JWT + bcrypt
  • Deployment: Render + Vercel

The backend keeps the AI integration in a dedicated service:

backend/app/services/ollama_service.py
Enter fullscreen mode Exit fullscreen mode

Prompt templates are separated into:

backend/app/services/prompts.py
Enter fullscreen mode Exit fullscreen mode

The assistant and AI endpoints then use the shared AI service rather than exposing model calls directly to the browser.

Deterministic + AI architecture

I deliberately kept academic calculations deterministic.

For example:

  • attendance calculations are handled by application logic
  • deadlines and risk ranking are handled by application logic
  • study-plan structure is generated deterministically
  • AI is used for contextual language generation, summaries, quizzes, flashcards, priorities, and enhanced recommendations

This prevents an LLM from becoming the source of truth for calculations that should be exact.

Graceful fallback

The project is designed to work even when the local model is unavailable.

If Ollama is offline:

  • the assistant can fall back to rule-based responses
  • AI tools can return fallback behavior
  • attendance, academics, productivity, and other core workflows continue to work

This also makes the application practical to demo without requiring a GPU.


Why Does Open Innovation Matter?

Using an open-weight model made the AI layer more transparent and controllable during development.

With Gemma + Ollama, I could:

  • run the model locally
  • keep the inference architecture under my control
  • develop without requiring a hosted proprietary AI endpoint
  • isolate the model behind my own FastAPI service
  • design deterministic fallbacks instead of making the entire application dependent on an external model API

For an academic assistant, this architecture is particularly useful because the application works with structured student context. The AI is an enhancement on top of the application logic rather than the entire application itself.

The result is a hybrid design:

Student Context
      ↓
Deterministic Academic Logic
      ↓
AI Context + Prompts
      ↓
Gemma via Ollama
      ↓
Personalised Assistance
Enter fullscreen mode Exit fullscreen mode

My Agent Session

Optional: Add your DevRelay / agent session link here if you have one.

The project was developed with an AI-assisted coding workflow, while keeping the application architecture, deterministic logic, deployment setup, and integration under project control.


Deployment

Frontend — Vercel

The React/Vite frontend is deployed on Vercel.

  • Root directory: frontend
  • Framework: Vite
  • Environment variable:
VITE_API_URL=https://campus-chatbot-bzk0.onrender.com
Enter fullscreen mode Exit fullscreen mode

Live frontend:

https://campus-chatbot-kbkdt49ms-ritikahirwar8168-dev.vercel.app

Backend — Render

The FastAPI backend is deployed on Render.

  • Root directory: backend
  • Build command:
pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode
  • Start command:
uvicorn app.main:app --host 0.0.0.0 --port $PORT
Enter fullscreen mode Exit fullscreen mode

Production configuration includes:

OLLAMA_ENABLED=false
CORS_ORIGINS=https://campus-chatbot-kbkdt49ms-ritikahirwar8168-dev.vercel.app
Enter fullscreen mode Exit fullscreen mode

Backend:

https://campus-chatbot-bzk0.onrender.com

Production AI note

The production Render deployment currently has:

OLLAMA_ENABLED=false
Enter fullscreen mode Exit fullscreen mode

because the deployed Render service does not run a local Ollama/Gemma instance.

The application therefore uses its graceful fallback behavior in production. Gemma + Ollama is fully supported for local development and is the open-weight AI technology used to build the AI layer.


Prize Categories

🏆 Best Use of Render — $200

Why this project fits:

Campus Copilot uses Render to host the production FastAPI backend.

The backend is responsible for:

  • authentication
  • student context
  • attendance logic
  • academic data
  • productivity workflows
  • assistant actions
  • AI endpoints
  • fallback behavior

Render deployment:

Repository: ritikahirwar8168-dev/campus-chatbot
Root Directory: backend
Build: pip install -r requirements.txt
Start: uvicorn app.main:app --host 0.0.0.0 --port $PORT
Enter fullscreen mode Exit fullscreen mode

Live backend:

https://campus-chatbot-bzk0.onrender.com


🏆 Best Use of Gemma — $200

Why this project fits:

Campus Copilot uses Gemma 3 4B, Google's open-weight model, as its primary AI model during local development.

Gemma powers the project's AI-oriented features, including:

  • contextual academic assistance
  • daily priorities
  • summarization
  • quiz generation
  • flashcard generation
  • AI-enhanced study plans

The model is served through Ollama, with the AI integration isolated in:

backend/app/services/ollama_service.py
Enter fullscreen mode Exit fullscreen mode

This keeps the model layer replaceable and prevents direct AI calls from the frontend.

Local setup:

ollama pull gemma3:4b
ollama serve
Enter fullscreen mode Exit fullscreen mode

Architecture

Local / AI-enabled

┌─────────────────────┐        ┌──────────────────────┐
│   React Frontend    │        │    Ollama Server     │
│   Vite + Tailwind   │        │    gemma3:4b         │
└────────┬────────────┘        └──────────┬───────────┘
         │                                │
         │ HTTP                           │ HTTP
         ▼                                │
┌────────────────────────────────────────────────────┐
│                  FastAPI Backend                   │
│                                                    │
│  Routers → Services → ollama_service.py           │
│      │          │                                  │
│      ▼          ▼                                  │
│   Models      Prompts                              │
│      │                                             │
│      ▼                                             │
│   SQLite                                           │
└────────────────────────────────────────────────────┘
Enter fullscreen mode Exit fullscreen mode

Production

┌──────────────────────────┐
│     Vercel Frontend      │
│     React + Vite         │
└────────────┬─────────────┘
             │ HTTPS
             ▼
┌──────────────────────────┐
│     Render Backend       │
│     FastAPI + SQLite     │
│                          │
│  Deterministic logic    │
│  + AI fallback logic    │
└──────────────────────────┘
             │
             └── OLLAMA_ENABLED=false
Enter fullscreen mode Exit fullscreen mode

Key Design Decisions

  • AI calls are never exposed directly to the frontend — they go through the backend.
  • Ollama configuration lives in environment variables, not hard-coded application logic.
  • The AI provider is isolated in ollama_service.py.
  • Deterministic logic such as attendance calculations and deadlines is never delegated to AI.
  • Every AI endpoint has a graceful fallback when Ollama is offline.
  • The application remains usable for core academic workflows without a GPU.
  • Frontend and backend are deployed separately using Vercel and Render.

API Highlights

Area Endpoint Purpose
Auth POST /api/auth/login Login and JWT
Attendance GET /api/attendance Subject attendance
Attendance POST /api/attendance/simulate What-if simulator
Dashboard GET /api/dashboard Academic dashboard
Academics GET /api/academics/assignments Assignments
Productivity GET /api/productivity/study-plan Study plan
Assistant POST /api/assistant/chat Contextual chat
Assistant POST /api/assistant/apply Apply recommended action
AI POST /api/ai/summarize Summarization
AI POST /api/ai/quiz Quiz generation
AI POST /api/ai/flashcards Flashcard generation
AI GET /api/ai/daily-priorities Daily priorities

What I Learned

Building Campus Copilot reinforced an important lesson about AI applications:

The best AI feature is not always the part that generates the answer. It is the system that gives the model the right context and knows when not to use the model.

For this project, deterministic academic logic provides the reliable foundation, while Gemma adds natural-language reasoning and personalised assistance on top.

That combination made it possible to build an academic assistant that is useful, explainable, and still functional when the model is unavailable.


Future Improvements

If I continue developing Campus Copilot, I would like to add:

  • persistent production database storage
  • hosted Gemma inference for production AI features
  • richer student-context retrieval
  • calendar integration
  • notifications for attendance and deadlines
  • more personalised study analytics
  • stronger evaluation of AI-generated quizzes and study plans

Top comments (3)

Collapse
 
ssapable profile image
ssapable •

Keeping the attendance math deterministic and putting the open model on top is the decision I'd point other student-app builders at, so I turned the post into a 54-second hand-drawn cartoon: the scattered attendance, assignments, exams, notes and to-do, the generic "study DSA today", the 75% line, the ring with the warning, the skip-or-attend simulation, the three structured actions, and the "no GPU, the rules still work" fallback. No strings, yours to use or ignore, on a plain page with no sign-up:

ssap-pa.github.io/scripttoon-samples/

If any detail is off, name the shot and I'll re-render it. One question: when Ritik runs the skip-or-attend simulation, does it show the attendance for the rest of the semester if he skips today, or only the immediate change?

Collapse
 
harsh_vardhanpandey_08fc profile image
Harsh Vardhan Pandey •

great work!!!

Collapse
 
pranjal_manhgaye_d94d7a8f profile image
Pranjal Manhgaye •

looks amazing, nice