A comprehensive Complaint Management System built with Spring Boot 3.5.5, MongoDB, and JWT authentication. This system allows users to submit complaints, staff to manage them, and admins to oversee the entire process.
- User Registration & Authentication - JWT-based secure authentication
- Complaint Submission - Users can submit complaints with location and department details
- Staff Management - Staff can view, update, and manage complaint statuses
- Admin Dashboard - Administrative functions for user and staff management
- OTP Verification - Phone number verification using Twilio SMS
- Email Notifications - Automated email notifications for complaint updates
- Priority Management - Four priority levels: LOW, MEDIUM, HIGH, CRITICAL
- Status Tracking - Real-time complaint status updates (PENDING, IN_PROGRESS, RESOLVED, REJECTED)
- RESTful API - Well-documented REST endpoints with Swagger/OpenAPI
- Role-Based Access Control - Three user roles: USER, STAFF, ADMIN
- Data Validation - Comprehensive input validation using Bean Validation
- Exception Handling - Global exception handling with proper error responses
- Health Monitoring - Spring Boot Actuator for application health checks
- Comprehensive Testing - 80%+ code coverage with unit, integration, and end-to-end tests
- Backend: Spring Boot 3.5.5
- Database: MongoDB
- Security: Spring Security + JWT
- Documentation: Swagger/OpenAPI 3
- Testing: JUnit 5, Mockito, TestContainers
- Code Coverage: JaCoCo
- Build Tool: Maven
- Java Version: 21
- Java 21 or higher
- Maven 3.6+
- MongoDB (running on localhost:27017)
- Gmail account for email notifications
- Twilio account for SMS OTP verification
git clone <repository-url>
cd SIHRun the setup script to configure Twilio credentials:
setup-env.batOr manually set these environment variables:
# Twilio Configuration
TWILIO_ACCOUNT_SID=your_account_sid
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_TRIAL_NUMBER=your_trial_number
# Email Configuration
[email protected]
MAIL_PASSWORD=your_app_password
# JWT Secret
JWT_SECRET=your_jwt_secret_keyEnsure MongoDB is running on localhost:27017
mvn spring-boot:runThe application will start on http://localhost:8080
Once the application is running, access the interactive API documentation:
- Swagger UI: http://localhost:8080/swagger-ui.html
- OpenAPI JSON: http://localhost:8080/v3/api-docs
POST /public/signup- User registrationPOST /public/login- User loginPOST /otp/send- Send OTP for phone verificationPOST /otp/verify- Verify OTP
POST /user/newComplaint- Submit a new complaintGET /user/getAll- Get all user's complaintsGET /user/id/{complaintId}- Get specific complaintDELETE /user/id/{complaintId}- Delete complaint
GET /staff/complaints- Get all complaintsPUT /staff/complaints/{complaintId}/status- Update complaint statusGET /staff/complaints/{complaintId}- Get specific complaint
GET /admin/users- Get all usersPUT /admin/users/{userId}/role- Update user roleGET /admin/staff- Get all staff members
src/
βββ main/java/com/SIH/SIH/
β βββ config/ # Configuration classes
β βββ controller/ # REST controllers
β βββ dto/ # Data Transfer Objects
β βββ entity/ # MongoDB entities
β βββ exception/ # Custom exceptions
β βββ filter/ # Security filters
β βββ repostitory/ # MongoDB repositories
β βββ services/ # Business logic
β βββ util/ # Utility classes
βββ test/ # Comprehensive test suite
βββ controller/ # Controller tests
βββ services/ # Service tests
βββ integration/ # Integration tests
βββ builder/ # Test data builders
The project includes comprehensive testing with 80%+ code coverage:
mvn test# Unit tests only
mvn test -Dtest=*Test
# Integration tests only
mvn test -Dtest=*IntegrationTest
# Controller tests only
mvn test -Dtest=*ControllerTestmvn test jacoco:reportCoverage report will be available at: target/site/jacoco/index.html
{
"id": "string",
"firstName": "string",
"lastName": "string",
"email": "string",
"password": "string (encrypted)",
"city": "string",
"phoneNumber": "string",
"department": "string (for staff)",
"designation": "string (for staff)",
"active": "boolean",
"verified": "boolean",
"role": "USER|STAFF|ADMIN",
"createdAt": "LocalDateTime",
"updatedAt": "LocalDateTime"
}{
"id": "string",
"title": "string",
"pincode": "integer",
"city": "string",
"state": "string",
"description": "string",
"department": "string",
"priority": "LOW|MEDIUM|HIGH|CRITICAL",
"status": "PENDING|IN_PROGRESS|RESOLVED|REJECTED",
"userId": "string",
"staffId": "string",
"createdAt": "LocalDateTime",
"updatedAt": "LocalDateTime"
}- JWT Authentication - Secure token-based authentication
- Password Encryption - BCrypt password hashing
- Role-Based Authorization - Different access levels for USER, STAFF, ADMIN
- Input Validation - Comprehensive validation using Bean Validation
- CORS Configuration - Cross-origin resource sharing setup
- Security Headers - Security headers for protection against common attacks
- SMTP Configuration - Gmail SMTP integration
- Automated Notifications - Email notifications for complaint updates
- Template Support - Customizable email templates
- OTP Verification - Phone number verification via SMS
- Trial Account Support - Works with Twilio trial accounts
- International Support - Global SMS delivery
mvn clean package
java -jar target/SIH-0.0.1-SNAPSHOT.jardocker build -t sih-app .
docker run -p 8080:8080 sih-appKey configuration options in application.yml:
spring:
data:
mongodb:
uri: mongodb://localhost:27017
database: Complaint_system
mail:
host: smtp.gmail.com
port: 587
username: ${MAIL_USERNAME}
password: ${MAIL_PASSWORD}
twilio:
accountSid: ${TWILIO_ACCOUNT_SID}
authToken: ${TWILIO_AUTH_TOKEN}
trialNumber: ${TWILIO_TRIAL_NUMBER}
management:
endpoints:
web:
exposure:
include: health- 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
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the repository
- Check the TESTING_GUIDE.md for testing information
- Review the API documentation at
/swagger-ui.html
- File upload support for complaint attachments
- Real-time notifications using WebSockets
- Advanced reporting and analytics dashboard
- Mobile app integration
- Multi-language support
- Advanced search and filtering capabilities
Built with β€οΈ using Spring Boot and MongoDB