A full-stack crime intelligence system for law enforcement. Officers can track incidents, profile offenders, view crime hotspots on a live map, and file First Information Reports β all backed by a PostgreSQL database on Supabase.
| Layer | Technology |
|---|---|
| Database | PostgreSQL (Supabase) |
| Backend | Go 1.25 Β· chi router Β· pgx/v5 |
| Frontend | Next.js 16 Β· TypeScript Β· Tailwind |
| Map | React-Leaflet (CartoDB dark tiles) |
| Charts | Recharts |
Crime-Record-Analysis/
βββ api/ # Go backend
β βββ cmd/main.go # Entry point, route registration
β βββ internal/
β β βββ database/db.go # Supabase connection via pgx
β β βββ handlers/ # One file per endpoint
β β βββ models/models.go # Shared struct definitions
β βββ .env.example # Copy to .env and fill in DATABASE_URL
β βββ go.mod
βββ frontend/ # Next.js app
β βββ app/
β β βββ components/Sidebar.tsx
β β βββ crimes/page.tsx
β β βββ offenders/page.tsx
β β βββ map/page.tsx + MapView.tsx
β β βββ fir/page.tsx
β β βββ page.tsx # Dashboard
β βββ lib/api.ts # Centralised Go API client
βββ db/
βββ new.sql # DDL β CREATE TABLE statements
βββ insert.sql # Seed data (10 Chennai locations + crimes)
Run db/new.sql then db/insert.sql in the Supabase SQL Editor.
cd api
cp .env.example .env # Add your Supabase DATABASE_URL
go run ./cmd/main.go # Starts on http://localhost:8080cd frontend
npm install
npm run dev # Starts on http://localhost:3000| Method | Route | Description |
|---|---|---|
| GET | /health |
Server health check |
| GET | /api/locations |
All tracked locations with lat/long + risk level |
| GET | /api/crimes |
All incidents, joined with location. ?type= filter supported |
| GET | /api/offenders |
All offenders ordered by repeat-crime count |
| GET | /api/hotspots |
Crime counts grouped by location (for map) |
| GET | /api/fir |
Fetch all filed FIRs with joined details |
| POST | /api/fir |
File a new FIR (runs a DB transaction) |
| PUT | /api/fir/{id} |
Update FIR investigation status |
| GET | /api/audit |
View system-wide audit trail |
{
"crime_id": 1,
"officer_id": 3,
"status": "Open",
"victim_name": "R. Subramanian",
"victim_age": 45,
"victim_contact": "+91 9876543210",
"victim_address": "Chennai, Tamil Nadu"
}status must be one of: "Open", "Closed", "Under Investigation".
The system automatically logs critical actions to ensure transparency and integrity:
- CREATE_FIR: Logged when a new report is filed, including the officer's name and linked incident.
- IDENTIFY_OFFENDER: Logged when an offender is linked to a crime.
- EVIDENCE_LOGGED: Logged when new evidence is registered.


