A secure platform for anonymous incident reporting.
This is a state-of-the-art anonymous reporting system built with Next.js 14, designed to provide a secure platform for reporting incidents while maintaining complete anonymity.
- Reactjs
- Mongoose with MongoDB Database
- Nodejs
- Expressjs
- Tailwind CSS
- React Hook Form
- GeminiAI
- Cloudinary
- BCrypt for Password Encryption
-🔥 Tech Stack: MERN | Cloudinary | Gemini AI | Google Maps API | Tailwind CSS 🚀
- Secure Anonymous Reporting: Ensures privacy with robust encryption.
- Role-Based Access: Admin and Police Stations panel for report management.
- Nearest Police Station Detection: Auto-fetches nearest station using lat/lng, with manual selection fallback.
- Real-Time Updates: Instantly see report status changes.
- User Authentication: Powered by NextAuth.js.
- Responsive Design: Optimized for mobile and desktop.
- AI-Powered Insights: Integrated with GeminiAI for advanced reporting.
Make sure you have the following installed:
- Node.js
- npm
- Git
# Clone the repository
git clone <your-repo-url>
cd anonymous-reporting-system
# Install dependencies
npm install
# Set up the database
npx prisma generate
npx prisma db push
# Start the development server
npm run dev
The application can be easily deployed on Vercel:
- Push your code to a Git repository
- Connect your repository to Vercel
- Configure the environment variables
- Deploy!
| Variable | Required | Description |
|---|---|---|
MONGO_URI |
✅ | MongoDB Atlas SRV connection string |
MONGO_EXPLICIT_URI |
Explicit-host fallback used when Node's SRV resolver fails (e.g. querySrv ECONNREFUSED on Windows) |
|
JWT_SECRET |
✅ | Secret for signing auth tokens |
SMTP_HOST / SMTP_PORT / SMTP_USER / SMTP_PASS / EMAIL_FROM |
✅ | SMTP config for all emails (EMAIL_HOST/EMAIL_USER/EMAIL_PASS still accepted as fallback) |
RESEND_API_KEY / RESEND_FROM |
Resend API fallback — used automatically when SMTP fails (or as the only provider if SMTP isn't configured) | |
FRONTEND_URL |
Base URL for login / reset links (defaults to https://safetoreport.vercel.app) |
|
GEMINI_API_KEY |
Primary AI provider (image/video analysis) | |
OPENAI_API_KEY |
Fallback AI provider — auto-used on Gemini rate-limit/quota/5xx (see Brain.md §4) |
|
AI_PRIMARY_PROVIDER / AI_FALLBACK_PROVIDER |
❌ | Defaults: gemini / openai |
CLOUDINARY_*, FOLDER_NAME |
✅ | Media uploads |
Email vars are validated at startup (fail-fast). If emails fail, they are logged and non-blocking — report creation and police-station creation never break because of an email issue.
POST /api/auth/forgot-password— accepts email, issues a single-use, 1-hour reset token (only its hash is stored), emails a secure reset link. Always returns the same message (no account enumeration).POST /api/auth/reset-password— verifies token, updates password, clears the token. Rate-limited.- Admin-created police stations receive an invite email with a "Set Your Password" link (no plaintext passwords in email), plus the login URL.
backend/controllers/ai-adapter.js wraps Gemini with a fallback to OpenAI:
- Primary: Gemini. On rate-limit / quota / 5xx → immediately tries OpenAI.
- Both unavailable → returns
{ aiFailed: true }placeholder to the UI; analysis never blocks report submission (user can fill details manually). - Per-provider circuit breaker: 3 consecutive failures → skip that provider for 60s.
- Prompts come from
backend/config/brainPrompts.js(source of truth:Brain.md).
- Login & reset-password forms have a password show/hide (eye) toggle.
- Header has a responsive profile dropdown (Profile / Settings / Logout) on desktop and mobile.





