This is the backend service for the SOS Emergency Response System, built using Node.js, Express.js, and Supabase. It powers emergency data processing, AI-based request validation, secure user authentication, and communication with the officials' dashboard.
- 📤 Image Upload API – Uploads and stores emergency images for AI validation.
- 🧠 AI Verification – Integrates with a YOLOv8 model (external) to classify emergencies.
- 🔐 Authentication – Auth flow with Supabase Auth.
- 📍 Geolocation API – Stores and fetches user/emergency coordinates.
- 🔗 Encrypted Database Sync – Emergency data is AES-encrypted before being stored in Supabase.
- 👮 Official Review System – Officials fetch and decrypt reports via a secure dashboard.
/routes/
├── fileUpload.ts # Handles file/image uploads
├── requests.ts # Emergency request logic
├── auth.ts # Authentication routes
└── locationsRouter.ts # Location-based APIs
/config/
└── supabase.ts # Supabase client configuration
index.ts # Main Express app
git clone https://github.com/your-username/sos-backend.git
cd sos-backendnpm installCreate a .env file in the root:
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_service_keynpm run dev # for development using ts-node
# or
npm run build && npm start # for productionServer runs on: http://localhost:5000
Upload emergency-related image or video (handled by fileUploadRouter).
Handles signup/login of users via Supabase.
Accepts emergency requests, including media and metadata.
Used by responders to receive real-time locations of emergencies.
- After an image is uploaded and verified via ML,
- The image is encrypted using AES encryption before being stored in the Supabase bucket.
- When fetched by authorized officials, the data is decrypted in real-time on the official dashboard.
- Admins can view decrypted emergency requests.
- They can accept or reject based on AI + manual review.
- Only one responder can lock each request (no duplication).
Arpit Gupta
Feel free to reach out for collaboration or integration assistance.
This project is licensed under the MIT License.