CrimeLens
Crime reporting, verification, mapping, and analytics platform built with React, Node.js, Supabase, PostgreSQL, and Leaflet.
- React
- TypeScript
- Node.js
- Express
- PostgreSQL

1. Overview
CrimeLens is a full-stack crime reporting, verification, mapping, and analytics platform. The idea behind it is simple: crime data becomes much more useful when it is reported in a structured way, verified properly, and presented through maps and statistics that people can actually understand.
The platform connects four main types of users: public visitors, citizens, police users, and admins. Public users can explore approved crime data through a map and statistics dashboard. Citizens can create an account, complete their profile, submit crime reports, and track their reports. Police users can verify pending reports and manage approved crime records. Admins can manage police agents, police branches, branch heads, and CSV-based crime data imports.
CrimeLens is not just a map with markers. It is a complete workflow around crime data: reporting, verification, correction, administration, and analytics.

2. Motivation
One of the main reasons I built CrimeLens is the gap that often exists between normal citizens and police systems. Many crimes remain unreported because citizens may not know the right process, may not feel comfortable reporting directly, or may feel that the verification process is too complicated from their side.
There is also another side to the problem. Even when a crime is reported, progress can be hard to track. Citizens may not receive proper updates, and police teams may need a better way to organize, verify, and analyze reports. As a result, many incidents can go unnoticed, and the bigger crime pattern of an area becomes harder to understand.
CrimeLens was built to bridge that gap. It gives citizens a structured way to submit reports, gives police a controlled verification workflow, and turns approved crime records into useful public data through maps and analytics. The goal is not only to collect crime reports, but also to make the data easier to verify, manage, and study.
3. Description
CrimeLens is divided around role-specific workflows.
3.1 Public View
For public users, the system provides access to approved crime data. They can open the map, apply filters, view crime statistics, and get a better idea of what is happening in different zones of the city.
3.2 Citizen Reporting
For citizens, the system provides authentication, profile completion, crime reporting, and report tracking. A citizen must be logged in before submitting a report. During report submission, the user can provide crime details and select the location manually, from the current device location, or by picking a point on the map.
3.3 Police Verification
For police users, the system provides a verification workflow. Police users can review pending citizen reports, approve or reject them, and update approved crime records later. When approving or updating a record, the selected crime location is validated against the selected zone boundary.
3.4 Admin Management
For admins, the system provides management controls. Admins can verify police agent requests, create police branches, create police agents directly, assign or clear branch heads, view agent records, and upload crime data through CSV.
This role-based structure keeps the platform organized. Each user type gets access to the features they need, while sensitive operations stay protected.
4. Key Features
CrimeLens is built around a few main features that work together: public visibility, citizen reporting, police verification, and administrative control.
4.1 Interactive Crime Map
CrimeLens includes an interactive crime map where approved crime records can be explored visually. Users can filter records by crime type, zone, date range, and other available options. This makes the map useful not only for viewing incidents, but also for understanding patterns.
4.2 Crime Statistics
The platform also includes crime statistics and dashboard views. These summaries help convert raw records into useful information, such as crime distribution by type, zone-based counts, and trends over time.
4.3 Citizen Reporting And Google OAuth
Citizen reporting is one of the main features of the system. Citizens can sign up using email/password or Google OAuth through Supabase Auth. After completing their profile, they can submit crime reports and track their submitted records from the citizen dashboard.
4.4 Location Selection
Location selection is handled in multiple ways. A user can manually enter latitude and longitude, use the current device location, or select a location from the map. This same location selection approach is also used in police approval and update workflows, where accuracy matters more because the final approved record becomes part of the public dataset.
4.5 Police Crime Management
For police users, CrimeLens provides report verification and crime record management. Police users can approve or reject reports, update existing crime records, and soft-delete records when needed. Soft delete means the record is not physically removed from the database; instead, its status changes so it no longer appears in approved public data.
4.6 Admin Controls
For admins, the system includes branch and police agent management. Admin users can create branches, assign branch heads, create police agents, verify agent requests, and upload crime data in bulk using CSV files.
5. Technologies Used
5.1 Frontend
The frontend is built with React, TypeScript, and Vite. React Router handles page routing, while Redux Toolkit and local storage are used for role-related state and session flow. The map experience is built with Leaflet and React Leaflet. Recharts is used for statistics and dashboard charts. Supabase's JavaScript client is used for citizen authentication flows.
5.2 Backend
The backend is built with Node.js and Express. Sequelize is used for models and database interaction, while raw SQL is also used where joins, views, or geospatial queries make it more practical. JWT is used for admin and police authentication, and bcrypt is used for password hashing. Multer and fast-csv are used for CSV upload and parsing.
5.3 Database And Auth
CrimeLens uses Supabase PostgreSQL as the main database. PostGIS is used for geospatial data, including crime locations and zone boundaries. Supabase Auth handles citizen authentication, including email/password login and Google OAuth. Admin and police users use a separate JWT-based authentication flow through the backend.
5.4 Other
The project uses REST APIs between the frontend and backend. Git and GitHub are used for version control.
6. Architecture
At a high level, CrimeLens follows a simple full-stack architecture:
React frontend
-> Express backend API
-> Sequelize models and raw SQL queries
-> Supabase PostgreSQL + PostGIS6.1 Frontend And Backend Split
The frontend is responsible for the user interface, routing, dashboards, forms, map views, and role-specific navigation. The backend handles authentication, authorization, validation, business logic, and database access.
6.2 Authentication Flow
Citizen authentication is handled through Supabase Auth. This includes email/password signup and login, as well as Google OAuth. Admin and police authentication is handled separately through the backend, which issues JWT tokens after validating staff credentials.
6.3 Public Data Flow
Public pages, such as the map and statistics pages, only use approved crime data. Pending citizen reports are not shown publicly until police users verify and approve them.
7. Challenges
The main challenges in CrimeLens were not only about building forms and dashboards. They were mostly about keeping location data, user roles, and verification flows consistent.
7.1 City Zones And Boundaries
One of the biggest challenges was dividing the city map into zones and defining zone boundaries. A normal location marker is simple, but a verified crime record also needs to belong to the correct zone. That means the system needs to understand whether a selected latitude and longitude point is actually inside the selected zone boundary.
7.2 Separate Authentication Systems
Another challenge was handling different authentication flows. Citizens use Supabase Auth and Google OAuth, while police and admin users use backend JWT authentication. Keeping these flows separate, while still making the frontend feel consistent, required careful handling of sessions, role state, redirects, and protected routes.
7.3 Role-Specific Dashboards
Role-specific dashboards were also important. Public users, citizens, police users, and admins should not see the same controls. The dashboard and sidebar behavior had to reflect the current role clearly, so that each user only sees the features they are allowed to use.
8. System Architecture
CrimeLens is organized as a full-stack application with separate frontend route groups, backend modules, database entities, and geospatial support.
8.1 Frontend Routes
The frontend routes are separated into public routes, citizen-protected routes, and staff-protected routes. Public routes include the homepage, map, statistics, login pages, registration, and police agent request page. Citizen-protected routes include profile completion, citizen dashboard, and crime report submission. Staff-protected routes are used for police and admin workflows.
8.2 Backend Modules
The backend is organized into route modules for authentication, citizens, crimes, reports, agents, admin controls, statistics, and zones. Middleware is used to verify tokens and enforce role-based permissions.
8.3 Database Entities
The database contains several main entities:
Crimestores crime records, status, location, zone, crime type, and latest updater.CrimeSubmissionlinks citizen submitters to submitted crimes.CrimeReportsSubmitterstores citizen profile information connected to Supabase Auth.UserandRolestore admin and police users.Zonestores zone boundaries using PostGIS geometry.PoliceBranchstores police branch information and branch heads.PoliceAgentRequeststores police agent account requests.UploadLogstores CSV upload summaries.
8.4 SQL Views
The project also uses SQL views for read-heavy joined data, such as crime records, pending submissions, and agent records. Views help keep repeated query patterns cleaner, especially when the frontend needs data from multiple related tables.
8.5 PostGIS Support
PostGIS is an important part of the architecture. It allows the system to store crime locations as points, zones as polygons, and perform location-boundary checks when police users approve or update crime records.
9. Performance & Scalability
Performance in CrimeLens mostly depends on how efficiently the system can read public crime data, run filters, and keep multi-step database operations consistent.
9.1 Indexes For Common Queries
CrimeLens uses database indexes for fields that are commonly filtered or queried, such as crime status, crime type, reported date, zone, and geospatial location. These indexes are important because public map and statistics pages can become read-heavy as the dataset grows.
9.2 Views For Cleaner Reads
Database views are also useful for performance and maintainability. Instead of writing the same complex joins again and again, views can provide a cleaner read layer for common screens like pending submissions, all crime records, and agent records.
9.3 Transactions For Consistency
For data consistency, transaction-based handling is important in multi-step workflows. Report submission, report approval, and CSV imports can involve multiple related changes. Wrapping those operations in transactions helps prevent partial updates if something fails midway.
9.4 Safer CSV Imports
CSV upload also includes validation and duplicate checking before inserting records. This helps keep imported data cleaner and avoids filling the database with repeated crime entries.
10. Security Considerations
CrimeLens uses role-based access control to keep public, citizen, police, and admin features separated.
10.1 Public Data Protection
Public users can access map and statistics data, but only approved crime records are exposed publicly. Pending reports stay hidden until police users verify them.
10.2 Citizen Authentication
Citizen reporting requires authentication. Citizens can sign up and log in using email/password or Google OAuth through Supabase Auth. They also need to complete their profile before submitting reports.
10.3 Staff Authorization
Admin and police users authenticate through the backend using JWT-based login. Backend middleware checks the token and role before allowing access to protected routes. Admin-only features include CSV upload, police agent management, branch creation, direct police agent creation, and branch head assignment. Police-only features include crime verification and crime record management.
10.4 Zone-Boundary Validation
Another security-related rule is zone-boundary validation. When police users approve or update a crime record, the selected location must be inside the selected zone boundary. This prevents verified records from being saved with mismatched zone and location data.
10.5 Soft Delete
Crime deletion is handled as a soft delete. Instead of permanently removing a crime record, the system changes its status to deleted. This keeps the data safer and avoids accidental permanent loss.
10.6 Future Hardening
Future security improvements could include rate limiting, IP monitoring, IP blacklisting for suspicious behavior, and stronger audit logging for sensitive operations.
11. Future Improvements
CrimeLens already covers the main reporting, verification, and analytics workflow, but there are several useful directions where the project can grow.
11.1 Image And Video Evidence
One future improvement is media support during crime reporting. Citizens could upload images or videos as supporting evidence when submitting a crime report. These files should not be stored directly in the primary database. A better approach would be to store media files in a separate service such as Cloudinary, then save only the media URLs and metadata in Supabase PostgreSQL.
11.2 Crime Heatmap
Another useful feature would be a heatmap layer. The current map can show crime locations, but a heatmap would make it easier to understand crime density across the city at a glance.
11.3 Caching Layer
A caching layer would also help as the platform grows. Public map and statistics endpoints can be requested frequently, so caching approved crime data and analytics responses could reduce database load.
11.4 Rate Limiting And Monitoring
Security and monitoring can also be improved. Rate limiting, IP monitoring, suspicious activity detection, blacklisting, and improved logging would make the system more production-ready.
11.5 Better Tracking And Testing
Other future improvements include better report progress tracking for citizens, richer analytics, more admin reporting tools, and automated tests for important backend and frontend workflows.
12. Screenshots





13. Live Demo
Coming soon.