A full-stack civic legal platform enabling citizens to file FIR complaints digitally and police officers to review, accept, or reject them โ built with Spring Boot and React.
- Overview
- Features
- Tech Stack
- Architecture
- Project Structure
- Getting Started
- Environment Variables
- API Reference
- Security
- Screenshots
- Team
- License
The eFIR Complaint System digitizes the First Information Report process. Citizens can register, verify via OTP, and file complaints online. Police officers access a dedicated dashboard to manage incoming complaints with pagination and verdict controls. All sensitive PII fields are AES-256-ECB encrypted on the frontend before transmission โ the backend stores and returns them as-is, ensuring data privacy.
- Registration with AES-encrypted PII fields (Aadhaar, name, address)
- Email OTP verification for account activation
- JWT-based login with auto-expiry detection
- File FIR complaints with victim, accused, and incident details
- Track complaint status (Processing โ Succeeded / Rejected)
- AI Legal Assistant powered by Groq (LLaMA 3) for guidance
- Separate police login with role-based access
- Paginated complaint dashboard with sorting
- Accept or reject complaints with one-click verdict
- Seeded admin account auto-created on startup
- AES-256-ECB client-side encryption for all PII
- BCrypt password hashing
- JWT authentication (24h expiry)
- Role-based route protection (frontend + backend)
- CORS policy locked to allowed origins
| Technology | Purpose |
|---|---|
| Java 17+ | Language |
| Spring Boot 3.4.2 | Application framework |
| Spring Security 6.x | JWT authentication & authorization |
| Spring Data JPA / Hibernate | ORM & database access |
| MySQL 8 | Relational database |
| MapStruct | DTO โ Entity mapping |
| Lombok | Boilerplate reduction |
| Springdoc OpenAPI | Swagger UI auto-documentation |
| JavaMailSender | OTP email delivery |
| WebClient (WebFlux) | Groq AI API integration |
| Technology | Purpose |
|---|---|
| React 19 | UI library |
| Vite 6 | Build tool & dev server |
| TailwindCSS 3.4 | Utility-first styling |
| React Router v7 | Client-side routing |
| Formik + Yup | Form management & validation |
| Axios | HTTP client |
| CryptoJS | AES-256 client-side encryption |
| react-hot-toast | Toast notifications |
| react-icons | Icon library |
| react-markdown | AI response rendering |
flowchart TB
subgraph Frontend["๐ฅ๏ธ Frontend โ React 19 + Vite"]
direction LR
Landing["Landing Page"]
Register["Register"]
OTP["OTP Verify"]
Login["Citizen Login"]
PLogin["Police Login"]
Dashboard["Citizen Dashboard"]
PDashboard["Police Dashboard"]
AI["AI Chat Assistant"]
Landing --> Register --> OTP --> Login --> Dashboard
Landing --> PLogin --> PDashboard
Dashboard --> AI
end
subgraph Security["๐ Security Layer"]
AES["AES-256-ECB\n(Client Encryption)"]
JWT["JWT Authentication\nFilter"]
BCrypt["BCrypt\n(Password Hashing)"]
end
subgraph Backend["โ๏ธ Backend โ Spring Boot 3.4"]
direction TB
Controllers["Controllers\nUser ยท Complaint ยท Police ยท AI"]
subgraph Services["Service Layer (SOLID)"]
direction LR
AuthSvc["Auth\nService"]
RegSvc["Registration\nService"]
OTPSvc["OTP\nService"]
ProfileSvc["Profile\nService"]
ComplaintSvc["Complaint\nService"]
PoliceSvc["Police\nService"]
AISvc["AI Chat\nService"]
end
subgraph Infra["Infrastructure"]
direction LR
Repos["JPA\nRepositories"]
Mappers["MapStruct\nMappers"]
Strategy["OTP Delivery\nStrategy Pattern"]
end
end
subgraph Data["๐๏ธ Data Layer"]
MySQL[("MySQL 8\nefir_db")]
Groq["Groq API\n(LLaMA 3)"]
Mail["SMTP\n(Gmail)"]
end
Frontend -- "REST API\n(JSON + JWT)" --> JWT
JWT --> Controllers
AES -.-> Frontend
BCrypt -.-> Backend
Controllers --> Services
Services --> Infra
Repos --> MySQL
AISvc --> Groq
Strategy --> Mail
eFIR-Complaint-System/
โ
โโโ Backend/eFIR/
โ โโโ Dockerfile # [NEW] Multi-stage backend build
โ โโโ .dockerignore # [NEW] Backend build ignore rules
โ โโโ pom.xml
โ โโโ src/main/java/com/efir/
โ โ โโโ EfirApplication.java
โ โ โโโ config/ # Security, CORS, JWT, Mail, OpenAPI
โ โ โโโ controller/ # UserController, ComplaintController,
โ โ โ # PoliceController, AiController
โ โ โโโ service/
โ โ โ โโโ auth/ # Registration + Authentication
โ โ โ โโโ otp/ # OTP (Strategy Pattern)
โ โ โ โโโ user/ # Profile retrieval
โ โ โ โโโ complaint/ # Complaint filing
โ โ โ โโโ police/ # Police operations
โ โ โ โโโ ai/ # Groq AI integration
โ โ โโโ entity/ # User, Complaint, Person, Incidence,
โ โ โ # Address, OtpRecord
โ โ โโโ dto/ # Request & Response DTOs
โ โ โโโ repository/ # JPA repository interfaces
โ โ โโโ mapper/ # MapStruct mappers
โ โ โโโ security/ # JWT provider, filter, UserDetails
โ โ โโโ exception/ # Custom exceptions + GlobalHandler
โ โ โโโ util/ # OtpGenerator, RoleValidator
โ โโโ src/main/resources/
โ โโโ application.properties
โ
โโโ Frontend/efir-complaint-system/
โ โโโ Dockerfile # [NEW] Multi-stage frontend build (Nginx)
โ โโโ .dockerignore # [NEW] Frontend build ignore rules
โ โโโ nginx.conf # [NEW] Nginx SPA routing config
โ โโโ package.json
โ โโโ index.html
โ โโโ tailwind.config.js
โ โโโ vite.config.js
โ โโโ src/
โ โโโ App.jsx
โ โโโ main.jsx
โ โโโ api/ # Axios instance
โ โโโ context/ # AuthContext, DecryptionHelper
โ โโโ utils/ # AES encryption, session management
โ โโโ components/
โ โโโ Landing.jsx
โ โโโ Register.jsx
โ โโโ Login.jsx
โ โโโ PoliceLogin.jsx
โ โโโ Verification.jsx
โ โโโ Navigation.jsx
โ โโโ ChatBox.jsx # AI assistant
โ โโโ ComplaintList.jsx
โ โโโ PoliceDashboard.jsx
โ โโโ ProtectedRoute.jsx
โ โโโ DashBoard/
โ โ โโโ Dashboard.jsx
โ โ โโโ ComplaintSubmission.jsx
โ โ โโโ Complaints.jsx
โ โ โโโ Overview.jsx
โ โ โโโ SideBar.jsx
โ โโโ ui/ # ErrorBoundary, LoadingSpinner
โ
โโโ README.md โ You are here
| Tool | Version |
|---|---|
| Java | 17 or higher |
| Maven | 3.8+ |
| Node.js | 18+ |
| npm | 9+ |
| MySQL | 8.0+ |
CREATE DATABASE efir_db;cd Backend/eFIR
# Configure your database credentials in application.properties
# (or use environment variables โ see below)
# Build & Run
mvn clean install
mvn spring-boot:runThe backend starts on http://localhost:8085 Swagger UI is available at http://localhost:8085/swagger-ui.html
Note: A police admin account (
admin_police/Police@123) is auto-seeded on first startup.
cd Frontend/efir-complaint-system
# Create .env file
cp .env.example .env
# Install dependencies
npm install
# Start development server
npm run devThe frontend starts on http://localhost:5173
The entire system (MySQL + Backend + Frontend) can be launched using a single command:
- Docker and Docker Compose installed.
- Ensure your environment variables are set in
docker-compose.yml(e.g.,MAIL_USERNAME,GROQ_API_KEY).
# Build and start all services
docker-compose up -d --build- Frontend: http://localhost:5173
- Backend: http://localhost:8085
- MySQL: localhost:3306
| Variable | Default | Description |
|---|---|---|
DB_USERNAME |
root |
MySQL username |
DB_PASSWORD |
โ | MySQL password |
JWT_SECRET |
โ | JWT signing secret (min 32 chars) |
MAIL_USERNAME |
โ | Gmail address for OTP |
MAIL_PASSWORD |
โ | Gmail app password |
GROQ_API_KEY |
โ | Groq API key for AI assistant |
| Variable | Default | Description |
|---|---|---|
VITE_API_BASE_URL |
http://localhost:8085 |
Backend API base URL |
All endpoints are documented via Swagger at /swagger-ui.html. Summary:
| Method | Endpoint | Description |
|---|---|---|
POST |
/user/register |
Register new user |
POST |
/user/login |
Citizen login โ JWT (text/plain) |
POST |
/user/login/police |
Police login โ JWT (text/plain) |
POST |
/user/sendOtp |
Send OTP to email |
POST |
/user/verifyOtp |
Verify OTP โ JWT (text/plain) |
| Method | Endpoint | Description |
|---|---|---|
GET |
/user/get |
Get user profile |
POST |
/complaint/save |
File a new complaint |
GET |
/complaint/fetch |
Get user's complaints |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/police/complaints |
Paginated complaint list |
POST |
/api/police/update |
Accept/reject a complaint |
| Method | Endpoint | Description |
|---|---|---|
POST |
/ai/api/groq |
AI legal assistant chat |
| Layer | Mechanism |
|---|---|
| Password Storage | BCrypt (Spring Security) |
| PII Protection | AES-256-ECB (client-side via CryptoJS) |
| Authentication | JWT (24h expiry, HS256) |
| Authorization | Role-based (USER / POLICE) on both frontend routes and backend endpoints |
| Session | Stateless (no server-side session) |
| CORS | Restricted to configured origins |
| Input Validation | Jakarta Bean Validation on all DTOs |
Visit the Live Demo or run locally at
http://localhost:5173to explore the full UI.
| Page | Route | Description |
|---|---|---|
| ๐ Landing | / |
Hero section with feature highlights |
| ๐ Register | /register |
Citizen registration with encrypted fields |
| ๐ Login | /login |
Citizen OTP-based login flow |
| ๐ฎ Police Login | /police-login |
Police credentials login |
| โ Verification | /verification |
OTP input screen |
| ๐ Dashboard | /dashboard |
File complaints, view status, AI chat |
| ๐๏ธ Police Dashboard | /police-dashboard |
Review & verdict complaints |
| Role | Contributor |
|---|---|
| Backend Development | Shrihari Kulkarni |
| Frontend Development | Athrav Katavkar |
| Architecture & Design | Sanidhya Kulkarni |
This project is licensed under the MIT License โ see the LICENSE file for details.
Built for Web Technology Laboratory Mini Project
Spring Boot ยท React ยท MySQL ยท AES-256 ยท JWT
citizen_user Citizen@123
admin_police Police@123