Your AI-driven personal safety assistant combining geolocation, maps, AI (Gemini/OpenAI), and the MERN stack to make urban navigation safer and smarter.
Details
| Section | Section |
|---|---|
| Features | Quick Start |
| Use Cases | Frontend Contribution |
| Tech Stack | Contributing |
| System Architecture | Roadmap |
| Repository Structure | Contributors |
| Feature | Description |
|---|---|
| JWT Authentication | Secure login & signup with bcrypt password hashing |
| Real-time Geolocation | Live location tracking with high accuracy |
| Nearby Safe Zones | Find hospitals, police stations, pharmacies instantly |
| AI Safety Assistant | Gemini/OpenAI powered safety recommendations |
| One-tap SOS | Emergency alerts with live location sharing |
| Safe Route Planning | AI-powered safest route recommendations |
| Cross-platform | Responsive design for all devices |
| Dark/Light Theme | Accessible interface with theme toggle |
graph TD
A[User Scenario] --> B[Walking Home Late]
A --> C[Traveling in New City]
A --> D[Emergency Situation]
B --> E[Open SafePathAI App]
C --> E
D --> E
E --> F[View Safe Routes & Zones]
E --> G[Ask AI Assistant]
E --> H[Hit SOS Button]
F --> I[Get Safety Recommendations]
G --> I
H --> J[Send Emergency Alerts]
I --> K[Reach Destination Safely]
J --> K
Real-world Scenario:
Imagine you're walking home late at night. You open SafePathAI to:
- View nearby safe zones including hospitals and police stations
- Consult the AI assistant for the safest route recommendations
- Access instant SOS functionality that shares your live location with emergency contacts
The app provides peace of mind through real-time safety monitoring and intelligent route planning.
System Architecture
flowchart TD
subgraph Frontend
A[Next.js UI] --> B[Map Integration]
A --> C[AI Chat Interface]
A --> D[SOS Dashboard]
end
subgraph Backend
E[Express Server] --> F[JWT Auth]
E --> G[MongoDB]
E --> H[AI Service]
E --> I[Map APIs]
end
subgraph External Services
J[Gemini/OpenAI] --> H
K[Mapbox/Google Maps] --> I
L[Emergency Services] --> M[SOS Alerts]
end
A <--> E
F --> G
H --> J
I --> K
Repository Structure
SafePathAI/
βββ π backend/
β βββ π src/
β β βββ π models/ # Database schemas
β β β βββ User.ts # User authentication model
β β β βββ Place.ts # Safe locations model
β β β βββ SOS.ts # Emergency alerts model
β β β βββ Chat.ts # AI conversation history
β β βββ π routes/ # API endpoints
β β β βββ auth.ts # Login/signup routes
β β β βββ places.ts # Location data routes
β β β βββ ai.ts # AI assistant routes
β β β βββ sos.ts # Emergency alert routes
β β βββ π controllers/ # Business logic
β β βββ π middleware/ # Auth & error handling
β β βββ index.ts # Server entry point
β βββ .env.example # Environment template
β βββ package.json
β βββ package-lock.json
β βββ tsconfig.json
β
βββ π frontend/
β βββ π public/
β β βββ vite.svg
β β βββ index.html
β βββ π src/
β β βββ π components/
β β β βββ π Dashboard/
β β β β βββ UserLocation.tsx
β β β βββ Chat.tsx
β β β βββ DarkModeToggle.tsx
β β β βββ Footer.tsx
β β β βββ Map.tsx
β β β βββ Navbar.tsx
β β β βββ SOSButton.tsx
β β βββ π context/
β β β βββ AuthContext.tsx
β β β βββ ThemeContext.tsx
β β βββ π pages/
β β β βββ Dashboard.tsx
β β β βββ Emergency.tsx
β β β βββ Favorites.tsx
β β β βββ Login.tsx
β β β βββ Signup.tsx
β β βββ π services/
β β β βββ api.ts
β β β βββ (other service files)
β β βββ App.css
β β βββ App.tsx
β β βββ index.css
β β βββ main.tsx
β βββ .gitignore
β βββ DESIGN_GUIDE.md
β βββ README.md
β βββ eslint.config.js
β βββ package.json
β βββ package-lock.json
β βββ postcss.config.cjs
β βββ postcss.config.js
β βββ tailwind.config.js
β βββ tsconfig.app.json
β βββ tsconfig.json
β
βββ .gitignore
βββ LICENSE.md
βββ README.md
βββ package.json
βββ package-lock.jsonQuick Start
Installation
# 1. Clone the repository
git clone https://github.com/SrinjoyeeDey/SafePathAI-AI-Powered-Safety-Assistance-App.git
cd SafePathAI-AI-Powered-Safety-Assistance-App/backend
# 2. Install dependencies
npm install
# 3. Configure environment
cp .env.example .env
# Edit .env with your API keys
# 4. Start development server
npm run dev
# 5. Backend API running at:
# http://localhost:4000/apigraph LR
A[Clone Repository] --> B[Install Dependencies]
B --> C[Configure Environment]
C --> D[Start Server]
D --> E[API Ready!]
Environment Variables
Create .env file in /backend:
PORT=4000
MONGO_URI=your_mongodb_connection_string
JWT_ACCESS_SECRET=your_jwt_access_secret
JWT_REFRESH_SECRET=your_jwt_refresh_secret
OPENAI_API_KEY=your_openai_or_gemini_key
MAPBOX_API_KEY=your_mapbox_api_keyFrontend Contribution
- Mobile-responsive dashboard with Next.js + shadcn/ui
- Map integration with real-time location tracking
- AI chat interface with message history
- SOS emergency panel with one-tap functionality
- Theme system (green/white palette with dark/light mode)
Please follow our Design Guide for:
- Color Palette: Green/white theme with accessibility standards
- Typography: Consistent font hierarchy and spacing
- Components: Reusable UI patterns with shadcn/ui
- Responsive Layouts: Mobile-first approach
Look for issues tagged with:
good-first-issue frontend ui documentation
π€ Contributing
Development Workflow
graph LR
A[Fork Repository] --> B[Create Branch]
B --> C[Make Changes]
C --> D[Run Tests]
D --> E[Submit PR]
E --> F[Review & Merge]
Steps to Contribute
- Fork the repository
- Create a feature branch: git checkout -b feature/amazing-feature
- Commit your changes: git commit -m 'Add amazing feature'
- Push to the branch: git push origin feature/amazing-feature
- Open a Pull Request
- Use TypeScript for all new code
- Follow React/Next.js best practices
- Use shadcn/ui components for consistency
- Write meaningful commit messages
- Test your changes thoroughly
- Update documentation if needed
| Feature | Description |
|---|---|
| Core Backend | JWT Auth, MongoDB, Basic AI |
| Frontend Development | Next.js UI, Map Integration |
| Real-time Features | Live location sharing, notifications |
| Advanced AI | Predictive safety analytics |
| Mobile App | React Native application |
| Multi-language | Internationalization support |
| Offline Mode | Basic functionality without internet |
| Community Features | User reviews, safety tips |
- Learn Real-world Skills: MERN stack + AI integration
- Showcase Talent: Build portfolio with modern technologies
- Make Impact: Create something that enhances personal safety
- Join Community: Collaborate with developers worldwide
- Recognition: Featured in contributors section & certificates
- Discussions: Share ideas in GitHub Discussions
- Issues: Report bugs or request features
- Documentation: Help improve docs and guides
- Code Reviews: Participate in peer reviews