EmergencyGuard is a production-ready emergency response application that provides real-time emergency calling, GPS location sharing, emergency contact notifications, and comprehensive emergency logging.
THIS IS A REAL EMERGENCY RESPONSE SYSTEM that makes actual emergency calls and sends real notifications. Use responsibly and only during genuine emergencies.
- Real Emergency Calling: Direct integration with emergency services (911, 112)
- GPS Location Sharing: Automatic location sharing with emergency responders
- Emergency Contact Alerts: SMS and email notifications to trusted contacts
- Real-time Tracking: Continuous location monitoring during emergencies
- Emergency Logging: Comprehensive event logging with timestamps and locations
- Progressive Web App (PWA): Installable on mobile devices
- Offline Support: Service worker for offline functionality
- Push Notifications: Browser-based emergency alerts
- Device Integration: Haptic feedback, battery monitoring, network status
- Cross-Platform: Works on iOS, Android, desktop browsers
- Comprehensive Disclaimers: Clear legal protections and usage guidelines
- Fallback Systems: Direct 911 calling if app fails
- Permission Management: Smart handling of location and notification permissions
- Export Functionality: Emergency history export for authorities
EmergencyGuard/
βββ client/ # Frontend React Application
β βββ components/ # Reusable UI components
β βββ pages/ # Route-based page components
β βββ hooks/ # Custom React hooks
β βββ services/ # Frontend services
β βββ utils/ # Utility functions
βββ server/ # Backend Express Application
β βββ controllers/ # Route controllers
β βββ services/ # Business logic services
β βββ models/ # Data models
β βββ middleware/ # Express middleware
β βββ utils/ # Server utilities
βββ database/ # Database configuration
β βββ schemas/ # Database schemas
β βββ migrations/ # Database migrations
β βββ seeds/ # Seed data
βββ shared/ # Shared TypeScript types
βββ docs/ # Documentation
βββ config/ # Configuration files
- Framework: React 18 + TypeScript
- Routing: React Router 6 (SPA mode)
- Styling: TailwindCSS 3 + Radix UI
- Build Tool: Vite
- PWA: Service Worker + Web App Manifest
- State Management: React hooks + Context API
- Runtime: Node.js + Express
- Language: TypeScript
- Database: SQLite (development) / PostgreSQL (production)
- Authentication: JWT (ready for implementation)
- Email/SMS: SendGrid/Twilio integration ready
- API Documentation: OpenAPI 3.0 + Swagger
- Package Manager: pnpm
- Testing: Vitest
- Linting: ESLint + Prettier
- CI/CD: GitHub Actions ready
- Deployment: Netlify/Vercel compatible
- Node.js 18+
- pnpm (recommended) or npm
- Git
-
Clone the repository
git clone https://github.com/your-org/emergency-guard.git cd emergency-guard -
Install dependencies
pnpm install
-
Set up environment variables
cp .env.example .env # Edit .env with your configuration -
Initialize database
pnpm run db:setup pnpm run db:migrate
-
Start development server
pnpm run dev
-
Open application
- Navigate to
http://localhost:8080 - The app will be running with hot reload
- Navigate to
# Development
pnpm dev # Start development server (client + server)
pnpm dev:client # Start only client development server
pnpm dev:server # Start only server development server
# Building
pnpm build # Build production application
pnpm build:client # Build only client
pnpm build:server # Build only server
# Testing
pnpm test # Run all tests
pnpm test:watch # Run tests in watch mode
pnpm test:coverage # Run tests with coverage
# Database
pnpm db:setup # Initialize database
pnpm db:migrate # Run database migrations
pnpm db:seed # Seed database with test data
pnpm db:reset # Reset database
# Linting & Formatting
pnpm lint # Lint code
pnpm lint:fix # Fix linting issues
pnpm format # Format code with Prettier
# Type Checking
pnpm typecheck # Check TypeScript types
# Production
pnpm start # Start production server
pnpm preview # Preview production build-
Create a feature branch
git checkout -b feature/your-feature-name
-
Make your changes
- Follow the existing code style
- Add tests for new functionality
- Update documentation as needed
-
Test your changes
pnpm test pnpm typecheck pnpm lint -
Commit and push
git commit -m "feat: add your feature description" git push origin feature/your-feature-name
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/emergency_guard
DATABASE_URL_DEV=sqlite://./dev.db
# Emergency Services
EMERGENCY_PHONE_NUMBER=911
TWILIO_ACCOUNT_SID=your_twilio_sid
TWILIO_AUTH_TOKEN=your_twilio_token
TWILIO_PHONE_NUMBER=+1234567890
# Email Services
SENDGRID_API_KEY=your_sendgrid_key
FROM_EMAIL=noreply@emergencyguard.com
# Security
JWT_SECRET=your_super_secret_jwt_key
ENCRYPTION_KEY=your_encryption_key
# External APIs
GOOGLE_MAPS_API_KEY=your_google_maps_key
WEATHER_API_KEY=your_weather_key
# App Configuration
NODE_ENV=development
PORT=8080
CLIENT_URL=http://localhost:8080# Monitoring & Analytics
SENTRY_DSN=your_sentry_dsn
GOOGLE_ANALYTICS_ID=GA-XXXXXXXXX
# Feature Flags
ENABLE_SMS_ALERTS=true
ENABLE_EMAIL_ALERTS=true
ENABLE_PUSH_NOTIFICATIONS=true
# Development
DEBUG=emergency-guard:*
LOG_LEVEL=infoPOST /api/emergency/call- Initiate emergency callPOST /api/emergency/alert-contacts- Alert emergency contactsPOST /api/emergency/log-event- Log emergency eventGET /api/emergency/history- Get emergency history
POST /api/auth/register- Register new userPOST /api/auth/login- User loginGET /api/user/profile- Get user profilePUT /api/user/profile- Update user profile
GET /api/health- System health checkGET /api/status- System status
For detailed API documentation, see docs/api.md or visit /api/docs when running the server.
tests/
βββ unit/ # Unit tests
β βββ client/ # Frontend unit tests
β βββ server/ # Backend unit tests
βββ integration/ # Integration tests
βββ e2e/ # End-to-end tests
βββ fixtures/ # Test data and fixtures
# Run all tests
pnpm test
# Run specific test suites
pnpm test:unit
pnpm test:integration
pnpm test:e2e
# Run tests with coverage
pnpm test:coverage
# Run tests in watch mode
pnpm test:watch- Connect your repository to Netlify
- Set build command:
pnpm build - Set publish directory:
dist/spa - Add environment variables in Netlify dashboard
- Connect your repository to Vercel
- Vercel will auto-detect the build settings
- Add environment variables in Vercel dashboard
# Build for production
pnpm build
# Start production server
pnpm start# Build Docker image
docker build -t emergency-guard .
# Run container
docker run -p 8080:8080 -e NODE_ENV=production emergency-guard- Rate Limiting: Prevents abuse of emergency endpoints
- Input Validation: All inputs are validated and sanitized
- Secure Communications: HTTPS required in production
- Data Encryption: Sensitive data encrypted at rest and in transit
- Environment Variables: Secrets stored in environment variables
- Authentication: JWT-based authentication ready for implementation
- Authorization: Role-based access control ready
- Audit Logging: All emergency events are logged with timestamps
We welcome contributions to EmergencyGuard! Please see CONTRIBUTING.md for guidelines.
This project adheres to a Code of Conduct. By participating, you are expected to uphold this code.
- Follow TypeScript best practices
- Write tests for new features
- Update documentation for API changes
- Use conventional commits
- Keep emergency functionality reliable and fast
This project is licensed under the MIT License - see the LICENSE file for details.
IMPORTANT: EmergencyGuard is provided as-is without warranty. The developers are not responsible for emergency response failures, delayed responses, or any consequences of using this system. This app supplements but does not replace calling emergency services directly. Always call 911 or your local emergency number in life-threatening situations.
- Technical Issues: Open an issue on GitHub
- Security Issues: Email security@emergencyguard.com
- Emergency Support: This app is not for support - call 911
- Emergency services and first responders worldwide
- Open source community for tools and libraries
- Users who trust us with their safety
Built with β€οΈ for emergency preparedness and safety