Spring Boot backend service for the CrimeLink platform. This service provides authentication, officer/admin APIs, crime reporting, duty scheduling, weapon and vehicle management, and integrations with AI microservices for call analysis and facial recognition.
- Java 21
- Spring Boot 3.5.8
- Spring Security (JWT-based auth)
- Spring Data JPA
- PostgreSQL (Supabase-compatible)
- Maven Wrapper (
./mvnw) - Docker (multi-stage build, JRE 21)
src/main/java/com/crimeLink/analyzercontroller/REST API endpointsservice/business logicrepository/database accessentity/JPA entitiesconfig/security, JWT filter, CORS config
src/main/resources/application.propertiesruntime configuration.env.exampleenvironment variable templatedatabase/SQL scripts for schema/dataDockerfilecontainer build and runtime setup
- Java 21 installed
- PostgreSQL database available (local or cloud/Supabase)
- Network access to required Python services:
- Call Analysis service URL
- Facial Recognition service URL
- (Optional) Docker for containerized run
Create your environment file from template:
cp .env.example .envSet values in .env (minimum required):
DB_URLDB_USERNAMEDB_PASSWORDJWT_SECRETPYTHON_CALL_ANALYSIS_URLPYTHON_FACIAL_RECOGNITION_URLSUPABASE_URLSUPABASE_SERVICE_KEY
Optional values:
SERVER_PORT(default:8080)JWT_EXPIRATION(default:900000)REFRESH_TOKEN_EXPIRATION(default:604800000)SUPABASE_BUCKET(default:criminal-photos)CORS_ALLOWED_ORIGINS(default:*, restrict in production)
If you are setting up a fresh database, apply SQL scripts from database/ as needed:
auth_tables.sqlfacial_recognition_tables.sqlfield_officers_data.sqltest_data.sql
Use your preferred SQL client or psql tool connected to your PostgreSQL database.
From project root:
./mvnw clean spring-boot:runWindows:
mvnw.cmd clean spring-boot:runThe API starts on:
http://localhost:8080(or yourSERVER_PORT)
Build:
./mvnw clean packageRun tests:
./mvnw testRun packaged jar:
java -jar target/*.jarBuild image:
docker build -t crimelink-analyzer-backend .Run container with environment file:
docker run --env-file .env -p 8080:8080 --name crimelink-backend crimelink-analyzer-backendHealth check endpoint:
GET /api/health
Base URL:
http://localhost:8080
Health:
curl http://localhost:8080/api/healthTest endpoint:
curl http://localhost:8080/api/testLogin example:
curl -X POST http://localhost:8080/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"your-email@example.com","password":"your-password"}'If login succeeds, use the returned access token:
curl http://localhost:8080/api/auth/me \
-H "Authorization: Bearer <ACCESS_TOKEN>"/api/authauthentication and token refresh/api/adminadmin users, settings, backups, audit logs/api/crime-reportsreport CRUD, map, evidence upload/download/api/criminalscriminal profile management/api/call-analysisAI call analysis integration/api/facialAI facial recognition integration/api/duty-schedulesOIC duty scheduling/api/dutiesmobile duty retrieval/api/leavesleave request workflow/api/weaponweapon inventory and issue flows/api/vehiclesvehicle management/api/usersofficer/user listings/api/safety-locationssafety location features/api/announcementsofficer announcements
- JWT auth is enabled via Spring Security.
- Some endpoints are public (for example: auth, health checks, selected read APIs).
- Role-based authorization is enforced for many routes (
Admin,OIC,Investigator,FieldOfficer). - Restrict
CORS_ALLOWED_ORIGINSin production. - Never commit real secrets in
.env.
- Call analysis and facial recognition features require external Python services to be running and reachable via configured URLs.
- File/image workflows use Supabase configuration values.
- App fails on startup with datasource error:
- Verify
DB_URL,DB_USERNAME, andDB_PASSWORD.
- Verify
- 401/403 for protected APIs:
- Ensure valid
Authorization: Bearer <token>and correct role permissions.
- Ensure valid
- AI endpoints fail:
- Verify
PYTHON_CALL_ANALYSIS_URLandPYTHON_FACIAL_RECOGNITION_URLare reachable.
- Verify
- CORS issues in frontend:
- Set
CORS_ALLOWED_ORIGINSto your frontend origin(s), comma-separated.
- Set
# Dependency check and compile
./mvnw clean compile
# Run only tests
./mvnw test
# Build without tests
./mvnw clean package -DskipTests