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.
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 |
| 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 |
| 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 |
| 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 |
- 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
- 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
- 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
- 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)
- 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
- Admin login: email + password
- Guard login: phone + PIN
- Student login: university email + password
- Roleโbased routing and access control
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
- 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 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 installCopy the example environment file and fill in your credentials:
cd backend
cp .env.example .envEdit .env with your values (see Environment Variables section below).
cd backend
npm start # or: node server.jsThe API server starts on http://localhost:3000 (or the PORT you configured).
cd web
npm run dev # starts Vite dev server on port 5173 by defaultFor production:
cd web
npx vite build # builds to dist/
npx vite preview # serves the build on port 4173cd mobile
npx expo start # starts Expo dev serverScan the QR code with the Expo Go app on your phone, or press a for Android emulator / i for iOS simulator.
| 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 |
| 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 |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/evidence/upload |
Upload evidence file (image/video) |
DELETE |
/api/evidence/:id |
Remove evidence |
| 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) |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/admin/analytics |
Dashboard analytics (stats, charts, hotspots) |
| 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 | โ |
Create web/.env:
VITE_API_URL=http://localhost:3000/api
VITE_SOCKET_URL=http://localhost:3000
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - 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 testin the relevant subโproject) - API changes are reflected in the route files and documented in this README
Distributed under the MIT License. See LICENSE for more information.