Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

AntiRagging ๐Ÿ›ก๏ธ

Rapid incident reporting, evidence preservation, and realโ€‘time response coordination for campus safety.

AntiRagging is a fullโ€‘stack platform that empowers university students, security guards, and administrators to collaboratively maintain a safe campus environment. Students can discreetly report incidents with photo evidence, guards receive instant alerts and can respond in seconds, and administrators get a bird'sโ€‘eye view with analytics and guard management โ€” all in real time.


Overview

AntiRagging solves the critical gap between incident occurrence and institutional response. When a student witnesses or experiences harassment, they can file a detailed report (anonymously if preferred) that instantly notifies onโ€‘duty guards and administrators. The platform preserves evidence (photos, timestamps, GPS location) for investigations and provides a complete audit trail from report to resolution.

The system is built as a monorepo with three distinct subโ€‘projects:

Directory Purpose Tech Stack
backend/ REST API + WebSocket server Node.js, Express, MongoDB, Socket.io
web/ Admin & Guard dashboard React + Vite, Tailwind CSS, Zustand, Recharts
mobile/ Student reporting app React Native + Expo

Tech Stack

Backend

Technology Purpose
Node.js (18+) Runtime
Express HTTP server & routing
MongoDB + Mongoose Database & ODM
Socket.io Realโ€‘time bidirectional communication
JWT (jsonwebtoken) Authentication tokens
bcryptjs Password hashing
Cloudinary Image/evidence upload hosting
Nodemailer Email notifications (SMTP)
Twilio SMS notifications
Multer File upload middleware

Web Dashboard

Technology Purpose
React 19 UI framework
Vite 8 Build tool & dev server
Tailwind CSS 4 Utilityโ€‘first styling
React Router 7 Clientโ€‘side routing
Zustand State management
Recharts Data visualization (charts)
Socket.ioโ€‘client Realโ€‘time updates
Axios HTTP client
React Hot Toast Toast notifications
Lucide React Icon library

Mobile App

Technology Purpose
React Native (0.85) Crossโ€‘platform mobile framework
Expo SDK 56 Development & build toolchain
React Navigation Screen navigation (stack + tabs)
Axios HTTP client
Socket.ioโ€‘client Realโ€‘time updates
Expo Location GPS tracking
Expo Image Picker Camera/gallery evidence capture
Expo Notifications Push notifications
React Native Maps Map view for guard tracking

Features

๐Ÿ” Incident Reporting (Mobile + Web)

  • File detailed reports with title, description, severity level, and type
  • Capture and upload photo/video evidence via camera or gallery
  • Automatic GPS location tagging
  • Anonymous reporting option
  • View and track your own incident history

๐Ÿ†˜ SOS Emergency Button (Mobile)

  • Oneโ€‘tap emergency alert to all onโ€‘duty guards
  • Sends live GPS coordinates and triggers highโ€‘severity alert
  • Realโ€‘time notification to admin dashboard with critical priority

โšก Realโ€‘time Alerts (WebSocket)

  • New incidents appear instantly on guard and admin dashboards
  • Incident status changes update in real time (assigned โ†’ inโ€‘progress โ†’ resolved)
  • Guard location tracking updates on admin map view
  • Toast notifications for critical alerts

๐Ÿ‘ฎ Guard Management & Tracking

  • Add, edit, and remove security personnel
  • Assign zones and shifts to each guard
  • Track guard availability status: Available / On Duty / Off Duty
  • View live guard locations on a map (admin)

๐Ÿ“Š Admin Dashboard & Analytics

  • Highโ€‘level stats: total incidents, resolution rate, active guards, avg response time
  • Data visualizations: severity distribution (bar), status distribution (pie), incidents over time (line)
  • Hotspot locations ranked by incident frequency
  • Full incident triage: assign guards, update status, add timeline notes

๐Ÿ”‘ OTPโ€‘based Authentication

  • Admin login: email + password
  • Guard login: phone + PIN
  • Student login: university email + password
  • Roleโ€‘based routing and access control

Project Structure

antiragging/
โ”œโ”€โ”€ backend/                          # Express API server
โ”‚   โ”œโ”€โ”€ middleware/
โ”‚   โ”‚   โ”œโ”€โ”€ adminAuth.js              # Admin role verification
โ”‚   โ”‚   โ”œโ”€โ”€ auth.js                   # JWT authentication
โ”‚   โ”‚   โ”œโ”€โ”€ guardAuth.js             # Guard role verification
โ”‚   โ”‚   โ”œโ”€โ”€ upload.js                # Multer file upload config
โ”‚   โ”‚   โ””โ”€โ”€ validate.js              # Request validation
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ”œโ”€โ”€ Admin.js                 # Admin schema (name, email, password)
โ”‚   โ”‚   โ”œโ”€โ”€ Evidence.js              # Evidence schema (file URL, type, incidentId)
โ”‚   โ”‚   โ”œโ”€โ”€ Guard.js                 # Guard schema (name, phone, pin, status, zones)
โ”‚   โ”‚   โ”œโ”€โ”€ Incident.js              # Incident schema (title, severity, status, location, evidence)
โ”‚   โ”‚   โ”œโ”€โ”€ OTP.js                   # OTP schema for phone verification
โ”‚   โ”‚   โ”œโ”€โ”€ NotificationLog.js       # Notification audit log
โ”‚   โ”‚   โ””โ”€โ”€ Student.js               # Student schema (name, email, rollNo, campus)
โ”‚   โ”œโ”€โ”€ routes/
โ”‚   โ”‚   โ”œโ”€โ”€ authRoutes.js            # POST /auth/login, /auth/verify-otp
โ”‚   โ”‚   โ”œโ”€โ”€ incidentRoutes.js        # CRUD incidents, respond, assign
โ”‚   โ”‚   โ”œโ”€โ”€ guardRoutes.js           # Guard CRUD, status management
โ”‚   โ”‚   โ”œโ”€โ”€ evidenceRoutes.js        # Upload evidence files
โ”‚   โ”‚   โ””โ”€โ”€ adminRoutes.js           # Analytics, guard oversight
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”œโ”€โ”€ cloudinaryService.js     # Cloudinary image upload
โ”‚   โ”‚   โ”œโ”€โ”€ emailService.js          # Nodemailer email dispatch
โ”‚   โ”‚   โ”œโ”€โ”€ smsService.js            # Twilio SMS dispatch
โ”‚   โ”‚   โ””โ”€โ”€ guardLocator.js          # Nearest guard calculation
โ”‚   โ”œโ”€โ”€ socket/
โ”‚   โ”‚   โ””โ”€โ”€ alertSocket.js           # Socket.io event handlers
โ”‚   โ”œโ”€โ”€ uploads/                     # Temporary file storage
โ”‚   โ”œโ”€โ”€ .env.example                 # Environment config template
โ”‚   โ””โ”€โ”€ server.js                    # App entry point
โ”‚
โ”œโ”€โ”€ web/                             # React + Vite web dashboard
โ”‚   โ”œโ”€โ”€ public/                      # Static assets
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Sidebar.jsx          # Roleโ€‘based navigation sidebar
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Header.jsx           # Top bar with user dropdown
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ DataTable.jsx        # Reusable table (search, sort, paginate)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ IncidentCard.jsx     # Incident feed card
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ StatusBadge.jsx      # Colorโ€‘coded status chips
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ LoadingSpinner.jsx   # Animated loader
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ EmptyState.jsx       # Empty state placeholder
โ”‚   โ”‚   โ”œโ”€โ”€ pages/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ LoginPage.jsx        # Roleโ€‘based login (admin/guard/student)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ AdminDashboard.jsx   # Overview stats & incident triage
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ AdminGuardManagement.jsx  # Guard CRUD with modals
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ AdminAnalytics.jsx   # Charts & hotspot analysis
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ GuardDashboard.jsx   # Incident feed & status toggle
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ StudentDashboard.jsx # Student incident history
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ IncidentDetailPage.jsx # Full incident view
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ NotFoundPage.jsx     # 404 page
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ useAuth.js           # Auth state selector
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ useSocket.js         # WebSocket event listener
โ”‚   โ”‚   โ”œโ”€โ”€ store/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ authStore.js         # Auth state (Zustand)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ incidentStore.js     # Incident state (Zustand)
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ guardStore.js        # Guard state (Zustand)
โ”‚   โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ api.js               # Axios instance with interceptors
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ socket.js            # Socket.io client management
โ”‚   โ”‚   โ”œโ”€โ”€ router.jsx               # Route definitions & guards
โ”‚   โ”‚   โ”œโ”€โ”€ App.jsx                  # Root layout component
โ”‚   โ”‚   โ””โ”€โ”€ main.jsx                 # Entry point
โ”‚   โ”œโ”€โ”€ index.html
โ”‚   โ”œโ”€โ”€ vite.config.js
โ”‚   โ”œโ”€โ”€ tailwind.config.js
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ””โ”€โ”€ mobile/                          # React Native + Expo app
    โ”œโ”€โ”€ assets/                      # App icons & splash
    โ”œโ”€โ”€ src/
    โ”‚   โ”œโ”€โ”€ components/              # Shared UI components
    โ”‚   โ”œโ”€โ”€ navigation/              # Stack & tab navigators
    โ”‚   โ”œโ”€โ”€ screens/                 # Screen views (report, SOS, history)
    โ”‚   โ”œโ”€โ”€ services/                # API & socket clients
    โ”‚   โ””โ”€โ”€ utils/                   # Helpers & constants
    โ”œโ”€โ”€ app.json
    โ””โ”€โ”€ package.json

Getting Started

Prerequisites

  • Node.js 18 or higher
  • npm 9 or higher
  • MongoDB 6+ (local or Atlas connection)
  • Cloudinary account (for evidence image uploads)
  • Twilio account (for SMS notifications โ€” optional)
  • SMTP credentials (for email notifications โ€” optional)
  • Expo CLI (npm install -g expo-cli) โ€” for mobile development

Clone & Install

# Clone the repository
git clone https://github.com/your-org/antiragging.git
cd antiragging

# Install backend dependencies
cd backend
npm install

# Install web dashboard dependencies
cd ../web
npm install

# Install mobile app dependencies
cd ../mobile
npm install

Configure Environment

Copy the example environment file and fill in your credentials:

cd backend
cp .env.example .env

Edit .env with your values (see Environment Variables section below).

Run Backend Server

cd backend
npm start           # or: node server.js

The API server starts on http://localhost:3000 (or the PORT you configured).

Run Web Dashboard

cd web
npm run dev          # starts Vite dev server on port 5173 by default

For production:

cd web
npx vite build       # builds to dist/
npx vite preview     # serves the build on port 4173

Run Mobile App

cd mobile
npx expo start       # starts Expo dev server

Scan the QR code with the Expo Go app on your phone, or press a for Android emulator / i for iOS simulator.


API Overview

Authentication

Method Endpoint Description
POST /api/auth/login Login โ€” accepts { email, password, role } or { phone, pin, role }
POST /api/auth/verify-otp Verify OTP for phone login (guard)
POST /api/auth/logout Invalidate session

Incidents

Method Endpoint Description
GET /api/incidents List all incidents (admin/guard)
GET /api/incidents/my-incidents List current student's incidents
GET /api/incidents/:id Get single incident details
POST /api/incidents Create new incident
PATCH /api/incidents/:id/status Update incident status
POST /api/incidents/:id/assign Assign guard to incident
POST /api/incidents/:id/respond Guard accepts/responds to incident

Evidence

Method Endpoint Description
POST /api/evidence/upload Upload evidence file (image/video)
DELETE /api/evidence/:id Remove evidence

Guards

Method Endpoint Description
GET /api/guards List all guards
POST /api/guards Add new guard
PATCH /api/guards/:id Update guard details
DELETE /api/guards/:id Remove guard
PATCH /api/guards/status Update own status (guard)
GET /api/guards/locations Get live guard locations (admin)

Admin

Method Endpoint Description
GET /api/admin/analytics Dashboard analytics (stats, charts, hotspots)

Environment Variables

Variable Description Default
PORT API server port 3000
NODE_ENV Environment mode development
MONGO_URI MongoDB connection string mongodb://localhost:27017/anti-ragging
JWT_SECRET JWT signing key (must change in production)
CLOUDINARY_CLOUD_NAME Cloudinary cloud name โ€”
CLOUDINARY_API_KEY Cloudinary API key โ€”
CLOUDINARY_API_SECRET Cloudinary API secret โ€”
SMTP_HOST SMTP server host smtp.mailtrap.io
SMTP_PORT SMTP server port 2525
SMTP_USER SMTP username โ€”
SMTP_PASS SMTP password โ€”
EMAIL_FROM From address for emails no-reply@antiragging.edu
TWILIO_ACCOUNT_SID Twilio account SID โ€”
TWILIO_AUTH_TOKEN Twilio auth token โ€”
TWILIO_PHONE_NUMBER Twilio SMS number โ€”

Web Environment Variables

Create web/.env:

VITE_API_URL=http://localhost:3000/api
VITE_SOCKET_URL=http://localhost:3000

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Please ensure:

  • Code follows the existing style (ESLint configs are in each subโ€‘project)
  • New components are properly typed/documented
  • Tests pass (run npm test in the relevant subโ€‘project)
  • API changes are reflected in the route files and documented in this README

License

Distributed under the MIT License. See LICENSE for more information.


AntiRagging โ€” Building safer campuses, one report at a time.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages