Skip to content

deepaksoni47/CIIS

Repository files navigation

Typing SVG

πŸ›οΈ CampusCare

Smart Campus Infrastructure with Real-Time Heatmaps, AI Insights & Community Rewards

License: MIT Node.js TypeScript Next.js


🌟 Built with Firebase, Gemini AI & Modern Web Technologies 🌟

Firebase Gemini AI Leaflet Railway


Status AI Powered Maps Stars


πŸ“‹ Table of Contents


🎯 The Problem

Campus infrastructure breaks down. A lot. And when it does, the response is almost always reactive rather than preventive:

The Reality:

  • πŸ’§ Water leaks in the same spots, semester after semester
  • ⚑ Power outages disrupt classes without warning
  • πŸ“Ά WiFi dead zones frustrate students and faculty
  • 🚽 Sanitation issues impact health and comfort
  • πŸ”§ Maintenance teams work blind, without data

Why Traditional Systems Fail:

Most campuses rely on scattered complaint emails, phone calls, or paper forms. There's no central intelligence, no pattern recognition, no way to see which buildings are problem hotspots, and no data to justify budget allocation.

The Gap: Without spatial intelligence and trend analysis, every issue feels new. Resources get wasted on symptoms while root causes go unaddressed.


πŸ’‘ Our Solution

CampusCare transforms scattered complaints into actionable intelligence.

We combine real-time geospatial visualization, AI-powered insights, and community engagement to help campuses shift from reactive firefighting to data-driven infrastructure planning.

🎯 How It Works

πŸ“± Report β†’ πŸ—ΊοΈ Visualize β†’ πŸ“Š Analyze β†’ πŸ€– AI Insights β†’ ⚑ Prioritize β†’ βœ… Resolve

✨ What Makes Us Different

πŸ—ΊοΈ See the Patterns
Interactive heatmaps show where problems cluster. One glance reveals chronic trouble zones.

🎯 Know What Matters
AI-powered priority scoring ranks issues by urgency, frequency, and impact - not just chronology.

πŸ€– Understand Why
Gemini AI analyzes trends and explains them in plain English: "Building A has 3x more electrical issues than average."

πŸ† Engage the Community
Voting system lets users upvote critical issues. Leaderboard rewards active reporters with points and recognition.

πŸ“§ Stay Informed
Auto-email notifications when issues are reported, resolved, or deleted - keeping everyone in the loop.

πŸš€ Key Capabilities

Real-Time Intelligence

  • Live heatmaps with severity weighting
  • Dynamic filters (category, time, building)
  • Historical trend analysis

Smart Prioritization

  • AI risk scoring per zone
  • Community voting influence
  • Predictive maintenance queues

Admin Power Tools

  • Complete user & issue management
  • System-wide analytics dashboard
  • Export reports (CSV/JSON)
  • Bulk operations

Community Rewards

  • Points for reporting issues
  • Vote multipliers for engagement
  • Public leaderboard
  • Recognition badges

The Result? Administrators get a data-backed command center. Maintenance teams know where to focus. Students feel heard. And the campus infrastructure actually gets better over time.


�️ Technology Stack

Tech Stack

πŸ’» Frontend

Next.js TypeScript Tailwind CSS Leaflet

  • ⚑ Next.js 14 with App Router
  • 🎨 Tailwind CSS + Shadcn UI
  • πŸ—ΊοΈ Leaflet + OpenStreetMap
  • πŸ“Š Recharts for analytics
  • πŸ”” React Hot Toast notifications

βš™οΈ Backend

Node.js Express TypeScript Firebase

  • πŸ”’ Express + TypeScript APIs
  • πŸ”₯ Firebase Admin SDK
  • πŸ“§ Nodemailer for emails
  • 🐳 Docker containerization
  • πŸš‚ Railway deployment

πŸ’Ύ Database & Storage

Firestore Storage

  • πŸ“„ Firestore NoSQL database
  • πŸ—ΊοΈ GeoPoint for spatial queries
  • πŸ–ΌοΈ Firebase Storage for images
  • ⚑ Real-time data sync
  • πŸ” Composite indexes

πŸ€– AI & Intelligence

Gemini Firebase Auth

  • 🧠 Gemini 1.5 Flash API
  • πŸ” Firebase Authentication
  • πŸ“Š AI-powered insights
  • 🎯 Risk scoring algorithms
  • πŸ“ Natural language reports

✨ Core Features

Features

πŸ—ΊοΈ Interactive Heatmaps

  • Real-time issue density visualization
  • Severity-weighted heat intensity
  • Dynamic filters (category, status, building)
  • Critical zone identification
  • Custom campus boundaries

🎯 Smart Prioritization

  • AI-powered risk scoring
  • Community voting system
  • Recurrence analysis
  • Priority-based queues
  • Automated triage

πŸ€– AI Insights (Gemini)

  • Plain-English analysis
  • Pattern recognition
  • Trend reports
  • Root cause suggestions
  • Natural language queries

πŸ† Community Rewards

  • Points for issue reporting
  • Vote multipliers
  • Public leaderboard
  • Recognition badges
  • Engagement tracking

πŸ‘₯ Admin Dashboard

  • User management (CRUD)
  • Issue oversight & bulk actions
  • System-wide analytics
  • Export reports (CSV/JSON)
  • Activity monitoring

πŸ“§ Email Notifications

  • Beautiful HTML templates
  • Issue reported alerts
  • Resolution notifications
  • Deletion confirmations
  • OAuth welcome emails

πŸ” Authentication

  • Email/password login
  • Google OAuth
  • Role-based access control
  • JWT token security
  • Profile management

πŸ“Š Analytics & Trends

  • Historical pattern analysis
  • Category breakdowns
  • Building-wise metrics
  • Time-series charts
  • Predictive insights

πŸ—οΈ System Architecture

%%{init: {'theme':'base', 'themeVariables': { 'primaryColor':'#1976d2','primaryTextColor':'#fff','primaryBorderColor':'#0d47a1','lineColor':'#424242','secondaryColor':'#388e3c','tertiaryColor':'#f57c00','noteBkgColor':'#fff9c4','noteTextColor':'#000'}}}%%
graph TB
    subgraph Frontend["πŸ–₯️ Frontend - Vercel"]
        NextJS["Next.js 14<br/>App Router + RSC"]
        Leaflet["Leaflet Maps<br/>Real-time Heatmaps"]
        AdminUI["Admin Dashboard<br/>Charts & Analytics"]
    end

    subgraph Backend["βš™οΈ Backend - Railway"]
        Express["Express + TypeScript<br/>REST API"]
        AdminModule["Admin Module<br/>User/Issue Management"]
        EmailService["Nodemailer<br/>HTML Templates"]
    end

    subgraph Data["πŸ’Ύ Data Layer"]
        Firestore["Firebase Firestore<br/>GeoPoint Queries"]
        FirebaseAuth["Firebase Auth<br/>JWT Tokens"]
    end

    subgraph AI["πŸ€– AI Layer"]
        Gemini["Gemini 1.5 Flash<br/>Natural Language Insights"]
    end

    NextJS --> Express
    Leaflet --> NextJS
    AdminUI --> AdminModule
    Express --> Firestore
    Express --> FirebaseAuth
    Express --> Gemini
    EmailService --> Express
    AdminModule --> Firestore

    style Frontend fill:#1976d2,stroke:#0d47a1,stroke-width:2px,color:#fff
    style Backend fill:#388e3c,stroke:#2e7d32,stroke-width:2px,color:#fff
    style Data fill:#7b1fa2,stroke:#6a1b9a,stroke-width:2px,color:#fff
    style AI fill:#f57c00,stroke:#e65100,stroke-width:2px,color:#fff
Loading

Architecture Layers

🎨 Frontend

Next.js 14

  • App Router
  • React Server Components
  • Leaflet heatmaps
  • Admin dashboard

βš™οΈ Backend

Express API

  • TypeScript
  • Railway deployment
  • 40+ endpoints
  • Email service

πŸ’½ Database

Firestore

  • GeoPoint queries
  • Composite indexes
  • Real-time sync
  • Role-based access

πŸ€– AI

Gemini AI

  • Plain-English reports
  • Pattern analysis
  • Trend insights
  • 1500 req/day

πŸ› οΈ Technology Stack

Tech Stack

πŸ’» Frontend Stack

Next.js TypeScript Tailwind CSS React

Features:

  • πŸš€ Server-side rendering for performance
  • 🎨 Modern UI with Tailwind CSS
  • πŸ“± Responsive design
  • ⚑ Optimized for speed
  • πŸ—ΊοΈ OpenStreetMap + Leaflet integration

βš™οΈ Backend Stack

Node.js Express Firebase Docker

Features:

  • πŸ”’ Type-safe APIs with TypeScript
  • πŸ”₯ Firebase SDK for database
  • 🐳 Containerized deployment
  • πŸ” Firebase authentication
  • πŸ“Š RESTful architecture
  • πŸ’° 100% Free hosting

☁️ Google Cloud Platform Suite

Cloud Run

Serverless
Containers

Firestore

NoSQL +
Geospatial

Leaflet

Interactive
Maps

Gemini

AI
Insights

Firebase

Auth &
Hosting

OpenStreetMap

Open Source
Maps


πŸ“Š Data Model

Infrastructure Issue Entity

Field Type Description
issue_id UUID Unique identifier
category Enum Water, Electricity, WiFi, Sanitation, etc.
latitude Float Geographic latitude
longitude Float Geographic longitude
severity Integer Severity level (1-5)
timestamp DateTime Issue creation time
status Enum Open, In Progress, Resolved
description Text Issue details
building_id String Associated building identifier (optional)

πŸš€ Quick Start

Getting Started

Setup Difficulty

πŸ“‹ Prerequisites

Node.js

v18 or higher

Firebase

Free Spark Plan

Gemini

From AI Studio

⚑ 3-Step Setup

1️⃣ Firebase Setup

# Create Firebase project
# (console.firebase.google.com)

# Enable Firestore
# Enable Authentication
# Download service account key

Get:

  • Project ID
  • Service account JSON
  • Web app config

πŸ“– Full Guide

2️⃣ Backend Deploy

cd backend
npm install

# Add .env file
FIREBASE_SERVICE_ACCOUNT_KEY='{...}'
GOOGLE_GEMINI_API_KEY='your_key'
EMAIL_USER='your@gmail.com'
EMAIL_PASS='app_password'

# Deploy to Railway
npm run build

πŸ“– Railway Guide

3️⃣ Frontend Deploy

cd frontend
npm install

# Add .env.local
NEXT_PUBLIC_API_URL='https://your-api.railway.app'
NEXT_PUBLIC_FIREBASE_CONFIG='{...}'

# Run locally
npm run dev

# Deploy to Vercel
vercel --prod

πŸ“– Integration Guide

🌐 Access Points

Service URL Description
🎨 Frontend http://localhost:3000 Next.js app with heatmaps
βš™οΈ Backend http://localhost:3001 Express API on Railway
πŸ”₯ Firestore Firebase Console Database & authentication
πŸ“§ Admin Panel /admin/dashboard User/issue management

πŸ”‘ Get API Keys (All Free!)

πŸ€– Gemini API Key (1500 requests/day)
  1. Visit aistudio.google.com
  2. Click "Create API Key"
  3. Copy to GOOGLE_GEMINI_API_KEY in .env
πŸ”₯ Firebase Config (No credit card)
  1. Go to Firebase Console
  2. Create new project
  3. Enable Firestore Database
  4. Enable Authentication (Email & Google)
  5. Project Settings β†’ Service Accounts β†’ Generate new private key
  6. Copy JSON to FIREBASE_SERVICE_ACCOUNT_KEY
πŸ“§ Gmail SMTP (For email notifications)
  1. Enable 2FA on your Google account
  2. Generate App Password: myaccount.google.com/apppasswords
  3. Add to .env:
    EMAIL_USER=your@gmail.com
    EMAIL_PASS=your_16_char_app_password
    

πŸ“„ Environment Variables

Backend (.env):

FIREBASE_SERVICE_ACCOUNT_KEY='{"type":"service_account",...}'
GOOGLE_GEMINI_API_KEY='AIzaSy...'
EMAIL_USER='your@gmail.com'
EMAIL_PASS='your_app_password'
PORT=3001
FRONTEND_URL='http://localhost:3000'

Frontend (.env.local):

NEXT_PUBLIC_API_URL='http://localhost:3001'
NEXT_PUBLIC_FIREBASE_CONFIG='{"apiKey":"...","authDomain":"...",...}'

πŸ“ Project Structure

campuscare/
β”œβ”€β”€ πŸ“„ README.md                    # You are here!
β”œβ”€β”€ 🐳 docker-compose.yml           # Multi-service orchestration
β”œβ”€β”€ πŸ“š docs/                        # Comprehensive documentation
β”‚   β”œβ”€β”€ FIREBASE_SETUP.md          # Firebase configuration guide
β”‚   β”œβ”€β”€ architecture/              # System design docs
β”‚   β”œβ”€β”€ api/                       # API specifications
β”‚   └── prompts/                   # AI prompt templates
β”‚
β”œβ”€β”€ βš™οΈ backend/                     # Node.js + Express + TypeScript
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ config/                # Firebase initialization
β”‚   β”‚   β”œβ”€β”€ modules/               # Feature modules
β”‚   β”‚   β”‚   β”œβ”€β”€ issues/           # Issue management
β”‚   β”‚   β”‚   β”œβ”€β”€ analytics/        # Data analytics
β”‚   β”‚   β”‚   β”œβ”€β”€ ai/               # Gemini integration
β”‚   β”‚   β”‚   └── auth/             # Firebase auth
β”‚   β”‚   β”œβ”€β”€ middlewares/          # Express middleware
β”‚   β”‚   β”œβ”€β”€ types/                # TypeScript definitions
β”‚   β”‚   └── utils/                # Helper functions
β”‚   └── package.json              # Dependencies (Firebase Admin)
β”‚
β”œβ”€β”€ 🎨 frontend/                    # Next.js 14 + TypeScript
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/                  # Next.js app router
β”‚   β”‚   β”œβ”€β”€ components/           # React components
β”‚   β”‚   β”‚   β”œβ”€β”€ Map/             # Leaflet + OpenStreetMap
β”‚   β”‚   β”‚   β”œβ”€β”€ Charts/          # Data visualization
β”‚   β”‚   β”‚   └── Dashboard/       # Admin interface
β”‚   β”‚   β”œβ”€β”€ lib/                 # Firebase SDK & utilities
β”‚   β”‚   └── styles/              # Tailwind CSS
β”‚   └── public/                  # Static assets
β”‚
β”œβ”€β”€ πŸ“Š analytics/                   # Analytics Scripts
β”‚   └── firestore/              # Firestore queries & aggregations
β”‚
└── πŸ—οΈ infra/                       # Infrastructure as Code
    β”œβ”€β”€ firebase.json             # Firebase hosting
    └── firestore.rules           # Firestore security rules

πŸ§ͺ Testing

# Backend tests
cd backend
npm test
npm run test:coverage

# Frontend tests
cd frontend
npm test

πŸ“¦ Deployment

Deployment

Deploy to Google Cloud Platform in Minutes

Cloud Run Firebase CI/CD

βš™οΈ Backend (Cloud Run)

# Build and deploy
cd backend
gcloud run deploy campuscare-backend \
  --source . \
  --platform managed \
  --region us-central1 \
  --allow-unauthenticated

Auto-configured:

  • βœ… Automatic HTTPS
  • βœ… Firebase integration
  • βœ… Environment secrets
  • βœ… Health checks
  • βœ… Free tier: 10GB bandwidth

🎨 Frontend (Firebase/Vercel)

# Build Next.js app
cd frontend
npm run build

# Deploy to Firebase
firebase deploy --only hosting

# Or deploy to Vercel
vercel --prod

Features:

  • βœ… Global CDN
  • βœ… Automatic SSL
  • βœ… Optimized builds
  • βœ… Preview deployments
  • βœ… Analytics included

πŸ”’ Security & Best Practices

πŸ›‘οΈ Authentication

Firebase Auth

  • Multi-provider support
  • JWT token validation
  • Session management
  • Role-based access control

πŸ” Data Protection

Security

  • SQL injection prevention
  • XSS protection
  • CSRF tokens
  • Input sanitization
  • Environment encryption

⚑ Rate Limiting

Rate Limit

  • API throttling
  • DDoS protection
  • Request validation
  • IP whitelisting
  • Quota management

πŸ“ˆ Scalability & Future Roadmap

Built to Scale: Campus β†’ Multi-Campus β†’ Smart City

🏒 Multi-Campus

Status

Extend to multiple institutions with tenant isolation

πŸ“± IoT Integration

Status

Connect real-time sensors for automated monitoring

πŸ“² Mobile Apps

Status

Native iOS/Android apps for field staff

πŸŒ† Smart City

Status

Scale to public infrastructure management


🀝 Contributing

Contributing

Contributors PRs Issues

graph LR
    A[🍴 Fork] --> B[🌿 Branch]
    B --> C[πŸ’» Code]
    C --> D[βœ… Test]
    D --> E[πŸ“ Commit]
    E --> F[πŸš€ Push]
    F --> G[πŸ”„ Pull Request]

    style A fill:#e3f2fd
    style G fill:#c8e6c9
Loading

Quick Steps:

  1. 🍴 Fork the repository
  2. 🌿 Create feature branch (git checkout -b feature/AmazingFeature)
  3. πŸ’» Make your changes
  4. βœ… Add tests
  5. πŸ“ Commit (git commit -m 'Add AmazingFeature')
  6. πŸš€ Push to branch (git push origin feature/AmazingFeature)
  7. πŸ”„ Open a Pull Request

πŸ“„ License

License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

Google Cloud

Cloud Infrastructure

Serverless computing, managed databases, and global CDN

Gemini

AI Intelligence

Natural language insights and automated report generation

Leaflet

Interactive Maps

Open source mapping with no API key required

OpenStreetMap

Open Source Maps

Free, unlimited map tiles with no API key required


πŸ“ž Contact & Support


🌟 Star this repository if you find it useful! 🌟

GitHub stars

Made with Love Google Cloud

Footer

Β© 2025 CampusCare Team | MIT License

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors