Skip to content

Smart campus system with AI study assistant, face recognition attendance, student/teacher portals, and admin dashboard

License

Notifications You must be signed in to change notification settings

omprakashnahak9/IQ

Repository files navigation

πŸŽ“ IQ Campus Connect - Smart Campus Management System

Complete campus management solution with AI-powered study assistant, face recognition attendance, student/teacher portals, and admin dashboard.

🎯 System Components

πŸ“± IQ Campus Connect App (Android)

Student & Teacher Portal

  • πŸ” Secure login for students and teachers
  • οΏ½ Student Dashboard: View attendance, profile, statistics
  • οΏ½β€πŸ« Teacher Dashboard: Manage students, view department stats
  • πŸ€– AI Study Assistant "Topper Bhaiya": Desi-style AI tutor
    • Multi-language support (English/Hindi/Hinglish)
    • Voice input/output
    • Real-time chat with Gemini 2.5 Flash
    • Relatable examples from Indian student life
  • οΏ½ Real-time attendance tracking
  • οΏ½ Profile management

Backend: Vercel (https://iq-backend.vercel.app)

πŸšͺ Gate Verification App (Android)

Security & Attendance System

  • πŸ“Έ Live camera preview with CameraX
  • πŸ€– ML Kit face detection
  • πŸ‘οΈ Liveness detection (blink/movement)
  • βœ… Real-time face verification
  • πŸ“ Automatic attendance marking
  • πŸ”’ Anti-spoofing measures

Backend: Local (http://localhost:3000) - Accesses AI service

🌐 Admin Web Dashboard

Complete System Management

  • πŸ‘₯ Student registration with face enrollment
  • πŸ“Š Real-time attendance tracking and analytics
  • ⚠️ AI-powered compliance monitoring
  • πŸ“ˆ Interactive charts and statistics
  • πŸ“₯ Export attendance reports to CSV
  • πŸ” Secure admin authentication
  • πŸ‘¨β€πŸ’Ό Staff management

Backend: Vercel (https://iq-backend.vercel.app)

πŸ”§ Backend API (Node.js + Express)

Centralized API Server

  • πŸ”„ REST API endpoints
  • πŸ—„οΈ Supabase integration
  • πŸ–ΌοΈ Image processing pipeline
  • πŸ“ Verification logging
  • οΏ½ AI Chat integration (Gemini 2.5 Flash)
  • πŸ” JWT authentication
  • πŸ“Š Student/Teacher management

Deployed: https://iq-backend.vercel.app

🧠 AI Face Recognition Service (Python + FastAPI)

Face Verification Engine

  • 🎭 DeepFace embeddings
  • πŸ” pgvector similarity search
  • πŸ“š Student face enrollment
  • βœ… Real-time face verification
  • 🚨 Anomaly detection

Local: http://localhost:8000

πŸ’Ύ Supabase Database (PostgreSQL + pgvector)

Data Storage & Management

  • πŸ‘€ Student & teacher records
  • πŸ”’ Face embeddings (128D vectors)
  • πŸ“‹ Attendance verification logs
  • ⚠️ Compliance logs
  • πŸ” Row Level Security (RLS)
  • πŸ”„ Real-time subscriptions

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  IQ Campus App  β”‚     β”‚  Gate Verify    β”‚     β”‚  Admin Web      β”‚
β”‚  (Students/     β”‚     β”‚  App (Security) β”‚     β”‚  Dashboard      β”‚
β”‚   Teachers)     β”‚     β”‚                 β”‚     β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚ HTTPS                 β”‚ HTTP (Local)          β”‚ HTTPS
         β”‚                       β”‚                       β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β–Ό
                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                     β”‚  Backend API        β”‚
                     β”‚  (Vercel)           β”‚
                     β”‚  - Auth             β”‚
                     β”‚  - Student/Teacher  β”‚
                     β”‚  - AI Chat (Gemini) β”‚
                     β”‚  - Gate Verify      β”‚
                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                β–Ό                               β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  AI Face Service    β”‚         β”‚  Supabase Database  β”‚
    β”‚  (Local Python)     β”‚         β”‚  (PostgreSQL)       β”‚
    β”‚  - DeepFace         │◄─────────  - Students         β”‚
    β”‚  - Face Verify      β”‚         β”‚  - Attendance       β”‚
    β”‚  - Enrollment       β”‚         β”‚  - Face Embeddings  β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Key Features

πŸ€– AI Study Assistant "Topper Bhaiya"

  • Personality: Friendly college senior with desi vibes
  • Languages: English, Hindi, Hinglish (auto-detects)
  • Features:
    • Voice input/output
    • Real-time chat
    • Detailed explanations with relatable examples
    • Study tips and guidance
  • Powered by: Google Gemini 2.5 Flash

πŸ”’ Face Recognition Attendance

  • Live Detection: Real-time face detection with ML Kit
  • Anti-Spoofing: Liveness checks (blink/movement)
  • Accuracy: DeepFace embeddings with pgvector search
  • Speed: < 2 seconds verification time
  • Security: Encrypted embeddings, audit logs

πŸ“Š Comprehensive Dashboards

  • Students: View attendance, profile, chat with AI
  • Teachers: Manage students, view department stats
  • Admins: Complete system control, analytics, reports

πŸš€ Quick Start

Option 1: Start Everything (Recommended)

# Starts Supabase + AI Service + Backend + Admin Web
start_all_with_admin.bat

Option 2: Start Gate System Only

# Starts Supabase + AI Service + Local Backend
start_gate_system.bat

Manual Setup

1. Setup Supabase

  1. Create project at https://supabase.com
  2. Run migrations in supabase/migrations/
  3. Copy credentials to .env files

2. Start AI Face Recognition Service

cd ai-model
pip install -r requirements.txt
cp .env.example .env
# Edit .env with Supabase credentials
python api.py
# Service runs on http://localhost:8000

3. Backend API

Production (Already Deployed):

Local Development:

cd backend
npm install
cp .env.example .env
# Edit .env with credentials
npm start
# Runs on http://localhost:3000

4. Admin Web Dashboard

cd admin-web
npm install
cp .env.example .env
# Edit .env with backend URL
npm run dev
# Access at http://localhost:5173

5. Build Android Apps

IQ Campus Connect App:

cd campus-connect-app
build_and_install.bat
# Or manually:
# gradlew.bat assembleDebug
# gradlew.bat installDebug

Gate Verification App:

cd gate-verification-app/app-frontend
rebuild_and_install.bat
# Or manually:
# gradlew.bat assembleDebug
# gradlew.bat installDebug

πŸ“¦ Project Structure

iq-campus-connect/
β”œβ”€β”€ campus-connect-app/          # IQ Campus Connect Android App
β”‚   β”œβ”€β”€ app/src/main/java/       # Kotlin source code
β”‚   β”‚   β”œβ”€β”€ ui/                  # UI screens (Login, Dashboard, AI Assistant)
β”‚   β”‚   β”œβ”€β”€ viewmodel/           # ViewModels
β”‚   β”‚   β”œβ”€β”€ data/                # Repositories, API, Models
β”‚   β”‚   └── di/                  # Dependency Injection
β”‚   └── build_and_install.bat    # Build & install script
β”‚
β”œβ”€β”€ gate-verification-app/       # Gate Verification Android App
β”‚   └── app-frontend/
β”‚       β”œβ”€β”€ app/src/main/java/   # Kotlin source code
β”‚       └── rebuild_and_install.bat
β”‚
β”œβ”€β”€ admin-web/                   # Admin Web Dashboard
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ pages/               # React pages
β”‚   β”‚   β”œβ”€β”€ components/          # React components
β”‚   β”‚   └── lib/                 # Supabase client
β”‚   └── start_admin_web.bat
β”‚
β”œβ”€β”€ backend/                     # Backend API (Node.js)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ controllers/         # API controllers
β”‚   β”‚   β”œβ”€β”€ routes/              # API routes
β”‚   β”‚   └── config/              # Supabase config
β”‚   └── start_backend.bat
β”‚
β”œβ”€β”€ ai-model/                    # AI Face Recognition Service
β”‚   β”œβ”€β”€ services/                # Face recognition logic
β”‚   β”œβ”€β”€ utils/                   # Image preprocessing
β”‚   β”œβ”€β”€ api.py                   # FastAPI server
β”‚   └── start_ai_service.bat
β”‚
β”œβ”€β”€ supabase/                    # Database
β”‚   β”œβ”€β”€ migrations/              # SQL migrations
β”‚   └── config.toml              # Supabase config
β”‚
β”œβ”€β”€ start_all_with_admin.bat     # Start all services
β”œβ”€β”€ start_gate_system.bat        # Start gate system
└── README.md                    # This file

πŸ“Š API Endpoints

Authentication

  • POST /api/auth/login - Student/Teacher login
  • POST /api/auth/change-password - Change password

Student

  • GET /api/student/profile/:id - Get student profile
  • GET /api/student/attendance/:id - Get attendance history

Teacher

  • GET /api/teacher/profile/:id - Get teacher profile
  • GET /api/teacher/students - Get students list
  • GET /api/teacher/stats/department - Department statistics

AI Assistant

  • POST /api/ai/chat - Chat with Topper Bhaiya
    Request: { "message": "explain photosynthesis" }
    Response: { "success": true, "message": "Arre bhai, photosynthesis..." }

Gate Verification

  • POST /gate/verify - Verify face and mark attendance
  • POST /gate/enroll - Enroll new student face
  • GET /health - Health check
  • POST /verify - Face verification
  • POST /enroll - Enroll new student
  • GET /health - Health check

οΏ½ Configuration

Environment Variables

Backend (.env):

PORT=3000
SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_anon_key
GEMINI_API_KEY=your_gemini_api_key
AI_MODEL_SERVICE_URL=http://localhost:8000

AI Service (.env):

SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_service_role_key

Admin Web (.env):

VITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_ANON_KEY=your_anon_key
VITE_BACKEND_URL=https://iq-backend.vercel.app

Android App Configuration

IQ Campus Connect:

  • Backend URL: https://iq-backend.vercel.app/api
  • File: campus-connect-app/app/src/main/java/com/campus/connect/data/network/ApiService.kt

Gate Verification:

  • Backend URL: http://YOUR_LOCAL_IP:3000
  • File: gate-verification-app/app-frontend/app/src/main/java/com/campus/gateverification/network/ApiService.kt
  • Network Security: app/src/main/res/xml/network_security_config.xml

πŸ› οΈ Troubleshooting

App Not Getting AI Responses

  1. Force stop the app
  2. Clear app cache in phone settings
  3. Reopen the app

Gate App Can't Connect

  1. Ensure PC and phone are on same network
  2. Update IP address in ApiService.kt
  3. Add IP to network_security_config.xml
  4. Rebuild and install app

Backend Issues

# Check Vercel logs
vercel logs

# Test endpoint
curl https://iq-backend.vercel.app/health

AI Service Issues

# Check if service is running
curl http://localhost:8000/health

# Restart service
cd ai-model
python api.py

🎯 Hybrid Backend Architecture

Why Hybrid?

  • Vercel can't access localhost services
  • Gate app needs local AI service for face recognition
  • IQ Campus app works from anywhere (uses Vercel)

Setup:

πŸ”’ Security Features

  • βœ… JWT-based authentication
  • βœ… Row Level Security (RLS) in Supabase
  • βœ… Live face detection with ML Kit
  • βœ… Anti-spoofing (liveness checks)
  • βœ… Encrypted face embeddings
  • βœ… Audit logging for all verifications
  • βœ… HTTPS for all external communications

πŸš€ Deployment

Backend (Vercel)

cd backend
vercel --prod

Admin Web (Vercel/Netlify)

cd admin-web
npm run build
# Deploy dist/ folder

AI Service (Local/VPS)

cd ai-model
python api.py
# Keep running on server

πŸ“± Tech Stack

Mobile Apps:

  • Kotlin
  • Jetpack Compose
  • CameraX
  • ML Kit
  • Ktor Client
  • Hilt (DI)

Backend:

  • Node.js
  • Express.js
  • Supabase JS Client
  • Google Generative AI (Gemini)

AI Service:

  • Python
  • FastAPI
  • DeepFace
  • NumPy

Admin Web:

  • React
  • Vite
  • Tailwind CSS
  • Recharts
  • Supabase JS Client

Database:

  • PostgreSQL (Supabase)
  • pgvector extension

πŸ‘₯ Team

Built with ❀️ for smart campus management

πŸ“ License

Apache License 2.0 - See LICENSE file for details.

Copyright 2026 IQ Campus Connect

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.