SafeSphere is a web-based safety platform designed to help people feel more secure. It uses real-time location tracking, risk modeling, and automated emergency features to provide a blanket of security when you're on the move.
The idea is simple: combining browser capabilities with safety datasets to give you a clear picture of your surroundings, while keeping emergency tools just a tap or a voice command away.
Here is what SafeSphere can do:
- Real-time GPS tracking
- Risk mapping to show you potentially unsafe areas
- Smart SOS system with a cancellation countdown lock
- Voice-triggered emergency activation (just say "Help" or "Emergency")
- Audio evidence recording
- Live location sharing with your contacts
- Automated safety check-ins
- Simulation mode if you just want to test it out
Everything runs directly in your browser. We also included an optional AI pipeline if you want to generate your own safety zones from news articles.
git clone https://github.com/YOUR-USERNAME/SafeSphere.git
cd SafeSphereBecause SafeSphere needs to load local data files (like areas.json), you can't just double-click the index.html file. Modern browsers will block it for security reasons (CORS).
Instead, you just need to spin up a quick local server. If you have Python installed, it's super easy:
Start a Local Server:
python3 -m http.server 8000Open in your browser: Head over to http://localhost:8000/index.html
SafeSphere/
│
├── index.html # Main interface
├── script.js # Core logic and risk engine
├── data.js # Data layer
├── style.css # UI styling
├── areas.json # AI-generated risk zones
├── assets/ # Audio and media files
└── articles/ # Source content for AI extraction
Note: Make sure
areas.jsonstays in the same folder asindex.html.
SafeSphere doesn't just guess risk levels; it calculates a dynamic score based on a few factors:
- How close you are to known danger zones
- Weighted severity of past incidents
- Population density
- Lighting conditions
- The time of day
Zones are color-coded on the map for quick reading:
| Risk Level | Color |
|---|---|
| Low | Green |
| Medium | Yellow |
| High | Red |
- You activate the SOS button.
- A 5-second countdown starts in case it was an accident.
- If you don't cancel it, the alarm goes off and the incident is logged.
When your hands are full or you can't reach your phone, you can just use your voice. The system listens for keywords like "Help" or "Emergency" and automatically triggers the SOS.
- Automatically uses your microphone to capture audio evidence.
- The recording is saved straight to your local device with a timestamp.
- Note: We deliberately don't store these recordings on any external servers yet.
Need to tell someone where you are? The app generates a Google Maps link with your exact coordinates that you can quickly share or copy to your clipboard.
Set a timer. If it expires and you haven't clicked the button to confirm you are safe, SafeSphere automatically triggers an SOS.
We built a simulation mode so you can test how the app reacts as it "moves" through different risk zones. It's great for presentations or just seeing how things work under the hood.
If you're interested in the data generation side, SafeSphere includes a Python pipeline that reads safety-related articles, extracts the location data, geocodes it, and generates the areas.json file.
python3 -m venv venvActivate it:
- Mac/Linux:
source venv/bin/activate - Windows:
venv\Scripts\activate
pip install openai requests python-dotenvCreate a .env file in the root directory:
OPENAI_API_KEY=your_api_key_herepython main.py- HTML5, CSS3, JavaScript (ES6)
- Leaflet.js (Mapping)
- Geolocation API
- Web Speech Recognition API
- MediaRecorder API
- Web Share API
- AI-generated JSON datasets
- OpenStreetMap geocoding
- Python processing pipeline
Recommended: Google Chrome or Microsoft Edge Permissions: Make sure to allow Location and Microphone access when prompted, otherwise core features won't work.
SafeSphere is built entirely on the frontend right now. This means there is no central database storing your data, and any evidence files it creates are saved directly onto your device.
We've got a lot planned to make SafeSphere even better. Some things we're looking to add:
- A dedicated backend API
- A real-time database for continuous logging
- Risk heatmap visualizers
- User authentication
- Cloud storage for evidence files
- SMS-based alerts