Skip to content

maniac-24/Smart-Tourist-Safety-Monitoring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart Tourist Safety Monitoring & Incident Response System

A comprehensive real-time tourist safety platform combining AI-powered geo-fencing, blockchain-based digital identity, and emergency response systems to ensure tourist safety across India.

🌟 Overview

This platform provides end-to-end tourist safety management with real-time location tracking, intelligent geo-fence alerts, emergency SOS capabilities, and a centralized police command center. Built for Smart India Hackathon, it addresses critical tourist safety challenges through modern technology.

🌐 Live Application

Frontend: https://smart-tourist-safety-monitoring-one.vercel.app
Backend API: https://smart-tourist-safety-monitoring-ch2m.onrender.com

The application is fully deployed and ready to use! Access the live platform to explore tourist safety features, geo-fencing, emergency response, and more.

� DKey Features

🔐 Blockchain Digital Identity

  • Ethereum Sepolia-based tourist ID registration
  • Smart contract-powered identity verification
  • QR code generation for instant verification
  • PDF tourist ID card with email delivery
  • Immutable identity records on blockchain

🗺️ Intelligent Geo-Fencing System

  • Real-time location tracking with Socket.io
  • Dynamic safety zones (safe, medium-risk, high-risk, restricted)
  • Automatic alert generation on zone entry
  • Safety score calculation based on location
  • Time-based zone restrictions
  • Polygon and radius-based geo-fence support

🆘 Emergency Response

  • One-click SOS button with GPS coordinates
  • Automatic SMS alerts via Twilio to emergency contacts
  • Real-time notifications to police dashboard
  • Location history tracking
  • Alert severity classification (low, medium, high, critical)
  • Incident report management

👮 Police Command Center

  • Real-time tourist location monitoring
  • Live geo-fence alert dashboard
  • Tourist status tracking (safe, warning, SOS)
  • Alert acknowledgment system
  • Incident report management
  • Historical alert analytics

🏨 Tourism Services

  • 16+ curated destinations across India
  • Northeast India special destinations (Tawang, Gangtok, Kohima, etc.)
  • Hotel listings and details
  • Professional tour guide directory
  • Guide inquiry and booking system
  • Destination reviews and ratings

🌐 Multi-Language Support

  • English, Hindi, Kannada, Bengali, Tamil, Telugu
  • i18next-powered internationalization
  • Language selector component
  • Localized UI elements

📱 Progressive Web App (PWA)

  • Offline functionality
  • Install as mobile app
  • Push notifications
  • Service worker caching
  • Map tile caching for offline use

🛠️ Tech Stack

Frontend

  • Framework: React 18 with Vite
  • Styling: Tailwind CSS 4
  • State Management: Zustand
  • Routing: React Router DOM v7
  • Maps: Leaflet & React Leaflet
  • Blockchain: ethers.js v6
  • Real-time: Socket.io Client
  • Animations: Framer Motion
  • i18n: react-i18next
  • UI Components: Lucide React icons
  • PDF Generation: jsPDF, html2canvas
  • QR Codes: qrcode.react

Backend

  • Runtime: Node.js with Express 5
  • Database: MongoDB with Mongoose
  • Authentication: JWT (jsonwebtoken)
  • Real-time: Socket.io
  • File Upload: Multer, Cloudinary
  • Email: Nodemailer
  • SMS: Twilio
  • Geo-spatial: @turf/turf, @turf/boolean-point-in-polygon
  • PDF Generation: PDFKit

Blockchain

  • Smart Contracts: Solidity 0.8.28
  • Development: Hardhat
  • Network: Ethereum Sepolia Testnet
  • Provider: Infura

DevOps

  • Deployment: Vercel
  • Version Control: Git
  • Environment: dotenv

📁 Project Structure

├── client/                      # Frontend React application
│   ├── src/
│   │   ├── components/         # Reusable UI components
│   │   │   ├── Navbar.jsx
│   │   │   ├── GeofenceAlert.jsx
│   │   │   ├── LanguageSelector.jsx
│   │   │   └── ...
│   │   ├── pages/              # Route pages
│   │   │   ├── LoginPage.jsx
│   │   │   ├── DashboardPage.jsx
│   │   │   ├── PoliceDashboard.jsx
│   │   │   ├── GeoFenceAdmin.jsx
│   │   │   ├── MyLocationPage.jsx
│   │   │   ├── NorthEastDestinations.jsx
│   │   │   └── ...
│   │   ├── contexts/           # React contexts
│   │   │   ├── SocketContext.jsx
│   │   │   └── usenamcontext.jsx
│   │   ├── hooks/              # Custom React hooks
│   │   │   └── useLocationTracking.js
│   │   ├── store/              # Zustand stores
│   │   │   ├── userStore.js
│   │   │   ├── tourGuideStore.js
│   │   │   └── conversionStore.js
│   │   ├── data/               # Static data
│   │   │   ├── destinations.json
│   │   │   └── issues.json
│   │   ├── contracts/          # Solidity smart contracts
│   │   ├── utils/              # Utility functions
│   │   ├── i18n.js            # Internationalization config
│   │   └── main.jsx           # App entry point
│   ├── hardhat.config.cjs     # Hardhat blockchain config
│   ├── vite.config.js         # Vite build config
│   └── package.json
│
├── server/                     # Backend Node.js application
│   ├── controllers/           # Business logic
│   │   ├── user.controller.js
│   │   ├── tourGuide.controller.js
│   │   └── conversion.controller.js
│   ├── models/                # MongoDB schemas
│   │   ├── User.js
│   │   ├── GeoFence.js
│   │   ├── AlertHistory.js
│   │   ├── TourGuide.js
│   │   ├── IncidentReport.js
│   │   ├── ContactMessage.js
│   │   └── ...
│   ├── routes/                # API routes
│   │   ├── user.router.js
│   │   ├── geoFence.route.js
│   │   ├── tourGuide.route.js
│   │   ├── sendSms.js
│   │   └── ...
│   ├── middleware/            # Express middleware
│   │   ├── authMiddleware.js
│   │   ├── fecthuser.js
│   │   └── upload.js
│   ├── utils/                 # Utility functions
│   │   ├── geoFenceUtils.js
│   │   ├── seedGeoFences.js
│   │   ├── apiResponse.js
│   │   └── asyncHandler.js
│   ├── config/                # Configuration
│   │   └── cloudinary.js
│   ├── index.js              # Server entry point
│   ├── db.js                 # Database connection
│   └── package.json
│
└── README.md

🔧 Installation & Setup

Prerequisites

  • Node.js (v18 or higher)
  • MongoDB (local or Atlas)
  • Ethereum wallet with Sepolia testnet ETH
  • Infura API key
  • Twilio account (for SMS)
  • Cloudinary account (for image uploads)

Environment Variables

Client (.env in client/)

VITE_API_URL=http://localhost:5000
VITE_SOCKET_URL=http://localhost:5000
VITE_CONTRACT_ADDRESS=your_deployed_contract_address
INFURA_API_KEY=your_infura_api_key
PRIVATE_KEY=your_ethereum_private_key

Server (.env in server/)

PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
CLIENT_URL=http://localhost:5173

# Twilio
TWILIO_ACCOUNT_SID=your_twilio_sid
TWILIO_AUTH_TOKEN=your_twilio_token
TWILIO_PHONE_NUMBER=your_twilio_phone

# Cloudinary
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret

# Email
EMAIL_USER=your_email
EMAIL_PASS=your_email_password

Installation Steps

  1. Clone the repository
git clone <repository-url>
cd smart-tourist-safety
  1. Install client dependencies
cd client
npm install
  1. Install server dependencies
cd ../server
npm install
  1. Deploy Smart Contract (Optional - if not already deployed)
cd ../client
npx hardhat compile
npx hardhat run script/deploy.js --network sepolia
  1. Seed Geo-fences (Optional)
cd ../server
npm run seed:geofences
  1. Start the development servers

Terminal 1 (Backend):

cd server
npm run dev

Terminal 2 (Frontend):

cd client
npm run dev
  1. Access the application

🎯 Usage

For Tourists

  1. Register with blockchain-based digital ID
  2. Download PDF tourist ID card
  3. Login to access dashboard
  4. View real-time safety status
  5. Explore destinations, hotels, and tour guides
  6. Use emergency SOS button when needed
  7. Track location history

For Police/Authorities

  1. Access police dashboard at /police
  2. Monitor all tourists in real-time
  3. View geo-fence alerts
  4. Acknowledge and respond to incidents
  5. Access alert history and analytics
  6. Manage geo-fence zones at /geofence-admin

For Tour Guides

  1. Register as tour guide at /tourguide
  2. Create professional profile
  3. Receive tourist inquiries
  4. Manage bookings

🗺️ API Endpoints

Authentication

  • POST /api/v2/auth/register - Register new user
  • POST /api/v2/auth/login - User login
  • GET /api/v2/auth/current - Get current user

Geo-fencing

  • POST /api/v7/geofence/create - Create geo-fence
  • GET /api/v7/geofence/all - Get all geo-fences
  • POST /api/v7/geofence/check-location - Check location
  • GET /api/v7/geofence/alerts/all - Get all alerts
  • GET /api/v7/geofence/alerts/my-history - Get user alerts

Emergency

  • POST /api/v3/sendalert - Send emergency SMS

Tour Guides

  • POST /api/v5/tourguide/register - Register guide
  • GET /api/v5/tourguide/all - Get all guides
  • POST /api/v9/guide-inquiry - Submit inquiry

PDF Generation

  • POST /api/v1/pdfwork/generate - Generate tourist ID PDF

🔒 Security Features

  • JWT-based authentication
  • Blockchain identity verification
  • Encrypted password storage
  • CORS protection
  • Input validation and sanitization
  • Secure file upload handling
  • Environment variable protection

🌍 Supported Destinations

The platform features 16 major destinations including:

  • Taj Mahal, Agra
  • Kerala Backwaters
  • Goa Beaches
  • Rajasthan Palaces
  • Varanasi Ghats
  • Himalayas, Himachal Pradesh
  • Amritsar Golden Temple
  • Mumbai Gateway of India
  • Northeast India: Tawang, Gangtok, Kohima, Loktak Lake, Aizawl, Agartala

📱 Real-time Features

  • Live location tracking via Socket.io
  • Instant geo-fence alerts
  • Real-time police dashboard updates
  • Push notifications for emergencies
  • Live tourist status monitoring

🚀 Deployment

✅ Live Deployment

The application is currently deployed and running:

Deploy Your Own Instance

  • Frontend: Deploy to Vercel
  • Backend: Deploy to Render or Railway
  • Database: MongoDB Atlas

Deployment Guides

We've created comprehensive deployment documentation:

  1. QUICK_START.md - Fast deployment in 3 steps (~10 minutes)
  2. DEPLOYMENT_GUIDE.md - Complete step-by-step guide
  3. PRE_DEPLOYMENT_CHECKLIST.md - Pre-deployment verification
  4. DEPLOYMENT_ARCHITECTURE.md - System architecture overview
  5. TROUBLESHOOTING.md - Common issues and solutions
  6. DEPLOYMENT_SUMMARY.md - Quick overview

Deployment Configuration

  • ✅ React Router configured for Vercel (client/vercel.json)
  • ✅ CORS configured for production
  • ✅ Environment variables documented
  • ✅ Build commands optimized
  • ✅ Socket.io ready for production

Start here: Read QUICK_START.md to deploy in ~15 minutes!

🤝 Contributing

This project was built for Smart India Hackathon. For contributions or improvements, please follow standard Git workflow practices.

📄 License

This project is part of Smart India Hackathon submission.

👥 Team

Built by a dedicated team for Smart India Hackathon to enhance tourist safety across India.

🆘 Support

For issues or questions, please use the in-app support feature or contact the development team.


Built with ❤️ for Smart India Hackathon

About

Smart Tourist Safety Monitoring & Incident Response System using AI, Geo-Fencing, and Blockchain-based Digital ID

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages