A comprehensive complaint management platform for educational institutions with role-based access control, real-time tracking, and automated workflows.
Features β’ Tech Stack β’ Installation β’ Usage β’ API Documentation β’ Contributing
- Overview
- Screenshots
- Features
- Tech Stack
- Architecture
- Prerequisites
- Installation
- Configuration
- Usage
- Project Structure
- API Documentation
- Deployment
- Troubleshooting
- Contributing
- License
Smart Campus Complaint System is a full-stack web application designed to streamline complaint management in educational institutions. The platform enables students to submit complaints with multimedia attachments, allows staff members to track and resolve assigned issues, and provides administrators with comprehensive oversight through analytics and management tools.
The system implements a three-tier role-based access control (Student, Staff, Admin) with JWT authentication, real-time status updates, automated email notifications, and a feedback mechanism for continuous improvement.
- Role-Based Access Control - Separate authentication flows for Students, Staff, and Administrators
- JWT Token Management - Secure session handling with JSON Web Tokens
- Password Encryption - bcryptjs hashing for secure credential storage
- Protected Routes - Middleware-based route protection based on user roles
- Complaint Submission - Create complaints with title, description, category, urgency level, and image attachments
- Status Tracking - Three-tier status workflow:
pendingβin-progressβresolved - Image Upload - Multer-based file handling for complaint evidence
- Urgency Levels - Configurable due dates (1, 2, or 3+ days)
- Assigned Complaints Dashboard - View and manage complaints assigned to staff members
- Progress Updates - Add photos and remarks during complaint resolution
- Status Updates - Update complaint status with detailed notes
- Complaint Overview - View all complaints with filtering and search capabilities
- Staff Assignment - Assign complaints to available staff members
- Statistics & Analytics - Real-time metrics on complaints, users, and resolution times
- User Management - Access to staff and student user lists
- Rating System - 5-star rating mechanism for resolved complaints
- Comments - Textual feedback submission
- Performance Tracking - Monitor staff and system performance
- Email Integration - Automated email notifications via Nodemailer
- Resolution Alerts - Notify users when complaints are resolved
| Technology | Version | Purpose |
|---|---|---|
| React | 17.0.2 | UI framework |
| React Router DOM | 5.3.4 | Client-side routing |
| Axios | 0.21.4 | HTTP client for API calls |
| Bootstrap | 5.3.7 | CSS framework for responsive design |
| JWT Decode | 4.0.0 | Token decoding for authentication |
| Technology | Version | Purpose |
|---|---|---|
| Node.js | 18+ | Runtime environment |
| Express.js | 4.21.2 | Web application framework |
| Mongoose | 5.13.23 | MongoDB object modeling |
| jsonwebtoken | 8.5.1 | JWT token generation and verification |
| bcryptjs | 2.4.3 | Password hashing |
| Technology | Version | Purpose |
|---|---|---|
| MongoDB | 5.0+ | NoSQL database for data persistence |
| Technology | Version | Purpose |
|---|---|---|
| Multer | 1.4.2 | File upload middleware |
| Nodemailer | 7.0.4 | Email service integration |
| Socket.io | 4.0.0 | Real-time bidirectional communication |
| dotenv | 10.0.0 | Environment variable management |
| CORS | 2.8.5 | Cross-origin resource sharing |
The application follows a three-tier architecture pattern:
βββββββββββββββββββ
β React Client β (Port 3000)
β (Frontend) β
ββββββββββ¬βββββββββ
β HTTP/REST API
β (Axios)
ββββββββββΌβββββββββ
β Express Server β (Port 5000)
β (Backend) β
ββββββββββ¬βββββββββ
β Mongoose ODM
ββββββββββΌβββββββββ
β MongoDB β
β (Database) β
βββββββββββββββββββ
Data Flow:
- Frontend (React) - User interactions trigger API calls via Axios
- Backend (Express) - RESTful API endpoints handle business logic and authentication
- Database (MongoDB) - Data persistence with Mongoose schemas
- Authentication - JWT tokens stored in localStorage, validated via middleware
- File Storage - Multer processes uploads to
server/uploads/directory - Email Service - Nodemailer sends notifications asynchronously
Before installation, ensure you have the following installed:
- Node.js (v18 or higher) - Download
- npm (v9 or higher) - Comes with Node.js
- MongoDB (v5.0 or higher) - Download or use MongoDB Atlas
- Git - Download
git clone https://github.com/tharani-2006/smart-campus-complaint-system.git
cd smart-campus-complaint-systemInstall server dependencies:
cd server
npm installInstall client dependencies:
cd ../client
npm installCreate a .env file in the server directory:
cd ../server
touch .envAdd the following environment variables (see Configuration for details):
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
PORT=5000
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password
ADMIN_EMAIL=admin@campus.edu
ADMIN_PASSWORD=secure_admin_passwordLocal MongoDB:
# Windows
net start MongoDB
# macOS/Linux
sudo systemctl start mongod
# or
mongodMongoDB Atlas:
- Use your Atlas connection string in
MONGO_URI
Start the backend server:
cd server
npm start
# Server runs on http://localhost:5000Start the frontend client (in a new terminal):
cd client
npm start
# Client runs on http://localhost:3000The application will automatically open in your default browser at http://localhost:3000.
Create a .env file in the server directory with the following variables:
| Variable | Description | Example |
|---|---|---|
MONGO_URI |
MongoDB connection string | mongodb://localhost:27017/campus-complaints or Atlas URI |
JWT_SECRET |
Secret key for JWT token signing | your_super_secret_jwt_key_here |
PORT |
Server port number | 5000 |
EMAIL_USER |
Email address for sending notifications | noreply@campus.edu |
EMAIL_PASS |
Email service app password | your_app_specific_password |
ADMIN_EMAIL |
Default admin email for login | admin@campus.edu |
ADMIN_PASSWORD |
Default admin password | SecurePassword123! |
Local MongoDB:
MONGO_URI=mongodb://localhost:27017/smart-campus-complaintsMongoDB Atlas:
MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/smart-campus-complaints?retryWrites=true&w=majority- Enable 2-Step Verification on your Google Account
- Generate an App Password: Google App Passwords
- Use the generated password in
EMAIL_PASS
- Register/Login at
/register/studentor/login/student - Submit new complaints at
/complaints/new - View personal complaints at
/my-complaints - Track complaint status and updates
- Submit feedback on resolved complaints
- Register/Login at
/register/staffor/login/staff - Access dashboard at
/staff/dashboard - View assigned complaints
- Update complaint status with photos and remarks
- Track resolution progress
- Login at
/login/admin(credentials from.env) - Access admin dashboard at
/admin/dashboard - View all complaints across the system
- Assign complaints to staff members
- Update complaint statuses
- View statistics and analytics
- Manage user accounts
See API Documentation for complete endpoint details.
smart-campus-complaint-system/
β
βββ client/ # React frontend application
β βββ public/
β β βββ index.html # HTML template
β βββ src/
β β βββ api/
β β β βββ auth.js # API service functions
β β βββ assets/
β β β βββ logo.jpeg # Application logo
β β βββ components/
β β β βββ Auth/
β β β β βββ Login.jsx # Login component
β β β β βββ Register.jsx # Registration component
β β β βββ Complaint/
β β β β βββ ComplaintForm.jsx # Complaint submission form
β β β βββ Navbar.jsx # Navigation bar
β β βββ pages/
β β β βββ AdminDashboard.jsx # Admin dashboard page
β β β βββ CenterPage.jsx # Center page component
β β β βββ ComplaintDetail.jsx # Complaint details view
β β β βββ Home.jsx # Home page
β β β βββ MyComplaints.jsx # User's complaints list
β β β βββ StaffDashboard.jsx # Staff dashboard page
β β βββ App.jsx # Main application component
β β βββ index.jsx # Application entry point
β β βββ index.css # Global styles
β βββ package.json # Frontend dependencies
β βββ README.md # Client-specific README
β
βββ server/ # Express backend application
β βββ config/
β β βββ db.js # MongoDB connection configuration
β βββ controllers/
β β βββ authController.js # Authentication logic
β β βββ complaintController.js # Complaint business logic
β β βββ feedbackController.js # Feedback handling
β βββ middleware/
β β βββ authMiddleware.js # JWT authentication middleware
β β βββ isAdmin.js # Admin role verification
β β βββ isStaff.js # Staff role verification
β β βββ upload.js # Multer file upload configuration
β βββ models/
β β βββ Complaint.js # Complaint data model
β β βββ Feedback.js # Feedback data model
β β βββ User.js # User data model
β βββ routes/
β β βββ auth.js # Authentication routes
β β βββ complaint.js # Complaint routes
β β βββ feedback.js # Feedback routes
β β βββ stats.js # Statistics routes
β βββ uploads/ # Uploaded files directory
β βββ utils/
β β βββ emailTest.js # Email testing utility
β β βββ mailer.js # Email service configuration
β βββ app.js # Express application entry point
β βββ package.json # Backend dependencies
β βββ .env # Environment variables (not in repo)
β
βββ Docs/ # Documentation
β βββ ClientSide.md # Client-side documentation
β βββ ServerSide.md # Server-side documentation
β
βββ .gitignore # Git ignore rules
βββ package.json # Root package.json
βββ README.md # This file
POST /api/auth/register
Content-Type: application/json
{
"name": "John Doe",
"email": "john@student.edu",
"password": "password123",
"department": "Computer Science",
"role": "student"
}POST /api/auth/login
Content-Type: application/json
{
"email": "john@student.edu",
"password": "password123",
"role": "student"
}GET /api/auth/profile
Authorization: Bearer <token>POST /api/complaints
Authorization: Bearer <token>
Content-Type: multipart/form-data
{
"title": "Broken Wi-Fi in Library",
"description": "Wi-Fi connection is unstable",
"category": "Infrastructure",
"dueInDays": 2,
"image": <file>
}GET /api/complaints/my
Authorization: Bearer <token>GET /api/complaints
Authorization: Bearer <token>GET /api/complaints/:id
Authorization: Bearer <token>PUT /api/complaints/:id/assign
Authorization: Bearer <token>
Content-Type: application/json
{
"staffId": "staff_user_id"
}PUT /api/complaints/:id/status
Authorization: Bearer <token>
Content-Type: application/json
{
"status": "in-progress"
}POST /api/complaints/:id/staff-update
Authorization: Bearer <token>
Content-Type: multipart/form-data
{
"remarks": "Issue resolved",
"photo": <file>
}GET /api/stats/complaintsGET /api/stats/usersPOST /api/feedback
Authorization: Bearer <token>
Content-Type: application/json
{
"complaintId": "complaint_id",
"rating": 5,
"comment": "Excellent service!"
}- Set Environment Variables in your hosting platform
- Update MongoDB URI to production database
- Configure CORS to allow frontend domain
- Deploy:
cd server
git push heroku main
# or
# Deploy to Render via GitHub integration- Update API Base URL in
client/src/api/auth.js - Build the application:
cd client
npm run build- Deploy the
buildfolder to your hosting platform
Ensure all environment variables are set in your hosting platform's dashboard.
Error: MongoDB connection failed
Solution: Verify MONGO_URI in .env file and ensure MongoDB is running.
Error: Port 5000 is already in use
Solution: Change PORT in .env or kill the process using the port:
# Windows
netstat -ano | findstr :5000
taskkill /PID <PID> /F
# macOS/Linux
lsof -ti:5000 | xargs killError: Token expired
Solution: Log out and log in again to generate a new token.
Error: Multer error
Solution: Ensure server/uploads/ directory exists and has write permissions.
Error: CORS policy blocked
Solution: Verify CORS is enabled in server/app.js and frontend URL is whitelisted.
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Commit your changes:
git commit -m 'Add some amazing feature' - Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
- Follow existing code style and conventions
- Write clear commit messages
- Add comments for complex logic
- Test your changes thoroughly
- Update documentation as needed
- MongoDB for the database solution
- React team for the amazing framework
- Express.js community for the robust backend framework
- All contributors and users of this project
Made with β€οΈ by tharani-2006
β Star this repo if you find it helpful!
