A mobile-first emergency response web application for road accidents. RoadSoS uses the device's location to find nearby hospitals, police stations, ambulance stations, and vehicle rescue services, and presents them with one-tap calling and navigation.
Notice: RoadSoS is a prototype. In an emergency, call your local emergency number directly (112 in India). When live data is unavailable, the application shows sample entries marked "(Demo)", which are not real services.
RoadSoS is designed for use under stress, with a single prominent SOS button, large touch targets, and a high-contrast interface. A FastAPI backend queries OpenStreetMap through the Overpass API and ranks results by distance, so the application needs no paid map or places API key.
- SOS button: a single tap requests the device location and loads nearby services
- Ranked service lists: hospitals, police, ambulance, and vehicle rescue, sorted by straight-line distance
- Tap to call and navigate: direct
tel:links and Google Maps directions for every result - Interactive map: Leaflet map with OpenStreetMap tiles and custom markers, with a list and map toggle on mobile
- Accident report sharing: generates a report containing the location, time, description, and a map link, ready to share through WhatsApp
- Bilingual interface: one-tap switching between English and Hindi
- Emergency helplines: national and regional helpline directory, with a built-in copy if the API is unreachable
- Cached results: the last successful search is stored in
localStorageand shown with its age when the device is offline - Fallback behavior: uses Bengaluru coordinates in a labeled demo mode when location access is unavailable, and sample entries when the Overpass API fails or returns nothing
| Layer | Technology |
|---|---|
| Frontend | React 19, TypeScript, Vite |
| Styling | Tailwind CSS 4, Lucide icons |
| Maps | Leaflet, OpenStreetMap tiles |
| Localization | i18next, react-i18next |
| Backend | FastAPI, Uvicorn, Pydantic, Requests |
| Data source | OpenStreetMap Overpass API |
flowchart LR
A[SOS button] --> B[Browser geolocation]
B --> C[POST /api/nearby]
C --> D[FastAPI backend]
D --> E[Overpass API]
E --> D
D --> F[Categorized results sorted by distance]
F --> G[Lists, map, and localStorage cache]
RoadSoS/
├── backend/
│ ├── main.py API routes, Overpass query, and distance logic
│ └── requirements.txt
├── frontend/
│ ├── src/
│ │ ├── App.tsx Application interface and state
│ │ ├── i18n.ts English and Hindi translations
│ │ ├── index.css
│ │ └── main.tsx
│ └── package.json
└── README.md
- Node.js 18 or later
- Python 3.9 or later
cd backend
pip install -r requirements.txt
python main.pyThe API runs at http://127.0.0.1:8000.
cd frontend
npm install
npm run devThe application runs at http://localhost:5173.
No API keys are required. The frontend reads one optional variable:
| Variable | Default | Purpose |
|---|---|---|
VITE_API_URL |
http://127.0.0.1:8000 |
Backend base URL |
- Open the application and select the SOS button.
- Allow location access when prompted.
- Choose a service category, then call or navigate to a listed service.
- Optionally complete the accident report form and share the summary through WhatsApp.
| Method | Path | Purpose |
|---|---|---|
| POST | /api/nearby |
Returns categorized services for a lat and lng |
| GET | /api/emergency-numbers |
Returns national and regional helplines |
The backend sends one Overpass QL query covering hospitals, police, and ambulance stations within 10 km, and car repair and towing services within 15 km. Each result is categorized from its OpenStreetMap tags, and its distance from the user is calculated with the Haversine formula.
Addresses are assembled from OpenStreetMap address tags. When a result has no phone number, the backend substitutes the relevant national helpline: 108 for medical services, 100 for police, and 1073 for vehicle rescue.
The browser's online status is monitored, and an offline banner shows the age of the cached results. The helpline directory is built into the frontend, so it remains available if the backend cannot be reached.
- Full offline support through a service worker
- Additional languages
- Live traffic-aware routing