This repository contains a minimal but working skeleton for the Smart Campus Assistant MVP:
- Backend: FastAPI, async SQLAlchemy, basic RAG stub using sentence-transformers + FAISS.
- Frontend: Single-page React UI (via CDN) with Tailwind CSS and a clean chat interface.
backend/app/– FastAPI applicationmain.py– FastAPI app + routingconfig.py– settings and environment configurationdb.py– async SQLAlchemy engine & sessionmodels.py– database models (timetables, bus, events, faculty, exams, FAQs)schemas.py– Pydantic models for API responses & chat payloadsrag.py– minimal RAG engine + FAISS index handlingrouters/core.py– main REST endpoints and/api/chat
requirements.txt– backend dependencies
frontend/index.html– React + Tailwind chat UI (CDN-based)
datasets/– place your CSV/JSON/PDF source data here (to be wired into RAG + DB import scripts)
From the backend directory:
cd backend
python -m venv venv # if you don't already have one
venv\Scripts\activate # on Windows
pip install -r requirements.txt
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000The FastAPI docs will be available at:
http://localhost:8000/docshttp://localhost:8000/redoc
Key endpoints:
GET /api/health– health checkGET /api/timetable– timetable entries (filters:program,semester,section)GET /api/bus_schedule– bus routesGET /api/events– campus eventsGET /api/faculty_directory– faculty listPOST /api/chat– chatbot endpoint
For now, tables are auto-created on startup using SQLite (smart_campus.db). You can switch to Postgres later by changing database_url in app/config.py.
The frontend is intentionally very light for the MVP:
cd frontend
python -m http.server 5173Then open:
http://localhost:5173
The UI will talk to http://localhost:8000/api/chat by default. Make sure the backend is running.
- Prepare datasets (CSV/JSON) for:
- Timetables, bus schedules, events, exam schedules, faculty directory, FAQs.
- Write small import scripts that:
- Read CSVs from
datasets/ - Map rows into ORM models in
app/models.py - Insert into the DB using an
AsyncSession.
- Read CSVs from
- Build the RAG index:
- Extract text from PDFs / notices into plain text chunks.
- Call
RAGEngine.build_index(documents)with(text, source_id)tuples. - Persisted FAISS index will then be used automatically by
/api/chat.
Once those are in place, the MVP will answer queries both via structured tables and retrieved campus documents from the RAG pipeline.