Project AI / Machine Learning · 2026
CitizenCare
A public-safety platform: citizen crime reports, real-time SOS, and YOLOv8 CCTV analysis
- Type
- Project
- Status
- Built
- Year
- 2026
- My role
- Developer — published and documented in my GitHub repository
01Overview
CitizenCare is a full-stack public safety platform. Citizens report incidents with photos, video and a map pin and can send an SOS; police verify reports and respond from a live command view; and a separate YOLOv8 service analyses connected camera feeds and raises alerts in real time.
- Citizens report incidents with photos, video and a map pin, and can send an SOS
- Police verify reports, answer SOS alerts and watch camera feeds from one command view
- A Flask + YOLOv8 service analyses about one CCTV frame per second
- JWT auth, bcrypt, rate limits, an audit log and role-checked Socket.IO channels
02The problem
Incident reporting is usually slow, unverified and disconnected from the people who respond. The platform needed three very different users — citizens, police and administrators — to share one system without any of them being able to see or do more than they should.
03Architecture
Three services with clear jobs: a React single-page app, an Express API that owns all data and permissions, and a Python detection service that only ever sees frames. Real-time events (SOS alerts, detections, report updates) travel over Socket.IO; everything else is REST.
- 01React SPACitizen · police · admin · public map
- 02Express APIREST + Socket.IO, JWT, role checks
- 03MongoDBReports, alerts, CCTV events, audit log
- 04YOLOv8 serviceFlask, ~1 frame/sec from the API
- 05Live alertsPushed to police dashboards
The React SPA (Vite, Tailwind) talks to the Express API over REST and Socket.IO. The API stores users, police stations, crime reports, emergency alerts, CCTV events, notifications and an audit log in MongoDB through Mongoose.
For CCTV, the API forwards roughly one frame per second to a Flask service running Ultralytics YOLOv8 and broadcasts any detections to police dashboards. If the AI service is down, cameras keep streaming and the UI says clearly that frames are not being analysed.
Role-specific areas — citizen app, police command view, admin portal — plus a public map that shows verified reports only, with no reporter identity.
04Technologies
05Implementation
- Police accounts are not self-service: an admin creates a station, which generates a registration code that can be revealed, copied and rotated. The registration endpoint ignores any role sent in the request body.
- Every request reloads the account from the database, so a demoted or disabled user loses access immediately rather than when their token expires. Socket.IO handshakes verify the JWT and re-check the account too.
- Passwords are hashed with bcrypt (cost factor 12); login, registration and password changes are rate-limited; Helmet sets security headers.
- Uploads are limited by a MIME allow-list, a 25 MB cap and five files per report, stored on local disk or Cloudinary.
- Unverified reports are visible only to their author and staff; privileged actions are written to an append-only audit log; the last active admin cannot be demoted, disabled or deleted.
- Without a Google Maps key the app degrades gracefully: pickers fall back to coordinate inputs and maps render as tables.
06Challenges
- Preventing role escalation in a system where the most privileged role (police) signs up over the public internet.
- Keeping real-time channels as strictly authorised as the REST API.
- Making the AI service optional, so the rest of the platform still works — and says so honestly — when it is not running.
- Weapon detection: the standard COCO-trained YOLOv8 model has no gun class, so real weapon alerts need a custom-trained model.
07Results
A working three-role platform with documented API, test cases, ER diagram and a deployment checklist, released under the MIT licence. It runs locally from a seed script; it is not deployed publicly.
08Limitations
- Weapons are not detected out of the box — the bundled yolov8n.pt has no gun class; a custom model must be trained first. No detection accuracy has been measured.
- CCTV analysis samples about one frame per second, so it is not frame-accurate.
- Maps and address search need a billed Google Maps key.
- Not deployed publicly; no real-world usage data.
09Screenshots
Taken from the project's own repository (view on GitHub).