Skip to content

ARCoder181105/tourist-safety-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›ก๏ธ Tourist Safety Platform

A Web3-powered tourist safety ecosystem combining real-time location tracking, emergency alerts, and immutable incident reporting on the blockchain.

Built for Hackathon Blockchain Web App Backend

๐ŸŒŸ Overview

The Tourist Safety Platform is a comprehensive solution that addresses tourist safety concerns through a decentralized, privacy-focused approach. By combining blockchain technology with real-time location sharing and emergency response systems, we create a transparent yet secure environment for tourists and authorities.

๐ŸŽฏ Key Problems Solved

  • Tourist Vulnerability: Tourists are often unfamiliar with local dangers and lack quick access to help
  • Emergency Response Delays: Traditional systems can be slow and lack transparency
  • Data Privacy vs Safety: Balancing personal privacy with the need for authorities to access information during emergencies
  • Incident Documentation: Creating tamper-proof records of incidents and emergency responses

๐Ÿš€ Features

๐ŸŒ Tourist Web App (For Tourists & Citizens)

  • Blockchain-based Registration: Secure identity creation with encrypted personal data
  • Real-time Location Sharing: GPS tracking with privacy controls
  • One-Touch SOS: Emergency alerts with automatic blockchain logging
  • Disaster Reporting: Upload photos and descriptions of dangerous situations
  • Danger Zone Warnings: Get notified when entering marked unsafe areas
  • Encrypted Profile: Personal details accessible only to authorized authorities
  • Responsive Design: Works seamlessly on mobile browsers and desktops

๐Ÿ’ป Admin Portal (For Authorities)

  • Live Safety Dashboard: Real-time map showing active tourist locations (ID-only for privacy)
  • SOS Management: View and respond to emergency alerts
  • Danger Zone Control: Mark and manage dangerous areas on the map
  • Disaster Reports: Review user-submitted safety reports with photos
  • e-FIR System: File immutable First Information Reports (FIRs) on blockchain
  • Selective Data Access: Decrypt user information only when legally authorized

๐Ÿ”— Blockchain Integration

  • Identity Management: Blockchain-based user IDs mapped to encrypted data
  • Immutable SOS Logging: All emergency alerts permanently recorded
  • Transparent e-FIR: Tamper-proof incident reports for legal purposes
  • Privacy by Design: Personal data encrypted, authorities hold decryption keys

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Tourist Web    โ”‚    โ”‚  Admin Portal   โ”‚    โ”‚   Blockchain    โ”‚
โ”‚  App (React)    โ”‚    โ”‚   (React.js)    โ”‚    โ”‚   (Avalanche)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚                      โ”‚                      โ”‚
          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚      Backend API       โ”‚
                    โ”‚   (Node.js + MongoDB)  โ”‚
                    โ”‚    + WebSocket Server  โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Tech Stack

Frontend

  • Tourist Web App: React.js + TypeScript + Vite + Tailwind CSS + Material-UI
  • Admin Portal: React.js + Vite + Tailwind CSS + ShadCN UI
  • Maps Integration: React Leaflet + Google Maps API
  • Animations: Framer Motion

Backend

  • API Server: Node.js + Express.js
  • Database: MongoDB (user data, reports, SOS events)
  • Real-time: WebSocket (Socket.io) for live location updates
  • Security: JWT authentication + Node Forge encryption + Notistack notifications

Blockchain

  • Network: Avalanche Fuji Testnet (fast, low fees)
  • Smart Contracts: Solidity
  • Integration: Ethers.js

๐Ÿ“‚ Project Structure

tourist-safety-project/
โ”œโ”€โ”€ user-webapp/                # React tourist web application
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/        # Reusable UI components
โ”‚   โ”‚   โ”œโ”€โ”€ pages/            # Auth, Dashboard, Profile, SOS pages
โ”‚   โ”‚   โ”œโ”€โ”€ services/         # API, blockchain, location services
โ”‚   โ”‚   โ”œโ”€โ”€ utils/            # Encryption, validation helpers
โ”‚   โ”‚   โ””โ”€โ”€ hooks/            # Custom React hooks
โ”œโ”€โ”€ admin-portal/              # React admin dashboard
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/       # MapView, AlertCard, UserCard
โ”‚   โ”‚   โ”œโ”€โ”€ pages/           # Dashboard, SOS, Reports, e-FIR
โ”‚   โ”‚   โ””โ”€โ”€ services/        # API services for admin functions
โ”œโ”€โ”€ backend/                   # Node.js server
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ models/          # User, SOS, Report, FIR schemas
โ”‚   โ”‚   โ”œโ”€โ”€ routes/          # API endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ controllers/     # Business logic
โ”‚   โ”‚   โ””โ”€โ”€ utils/           # Blockchain integration, encryption
โ”œโ”€โ”€ blockchain/                # Solidity smart contracts
โ”‚   โ”œโ”€โ”€ contracts/           # Identity, SosAlert, EFIR contracts
โ”‚   โ””โ”€โ”€ scripts/             # Deployment scripts
โ””โ”€โ”€ docs/                     # Project documentation

๐Ÿ› ๏ธ Installation & Setup

Prerequisites

  • Node.js (v18+)
  • MongoDB
  • TypeScript
  • Hardhat
  • Metamask or Web3 wallet

1. Clone Repository

git clone https://github.com/your-username/tourist-safety-project.git
cd tourist-safety-project

2. Backend Setup

cd backend
npm install
cp .env.example .env  # Configure your environment variables
npm run dev

3. Blockchain Setup

cd blockchain
npm install
npx hardhat compile
npx hardhat run scripts/deploy.js --network fuji

4. Admin Portal Setup

cd admin-portal
npm install
npm run dev

5. Tourist Web App Setup

cd user-webapp
npm install
npm run dev

๐Ÿ”ง Configuration

Environment Variables

Backend (.env)

MONGODB_URI=mongodb://localhost:27017/tourist-safety
JWT_SECRET=your-jwt-secret
ENCRYPTION_KEY=your-32-byte-encryption-key
AVALANCHE_RPC_URL=https://api.avax-test.network/ext/bc/C/rpc
CONTRACT_ADDRESS_IDENTITY=0x...
CONTRACT_ADDRESS_SOS=0x...
CONTRACT_ADDRESS_EFIR=0x...

Admin Portal (.env)

VITE_API_BASE_URL=http://localhost:3000/api
VITE_WEBSOCKET_URL=ws://localhost:3000
VITE_BLOCKCHAIN_RPC=https://api.avax-test.network/ext/bc/C/rpc

Tourist Web App (.env)

VITE_API_BASE_URL=http://localhost:3000/api
VITE_WEBSOCKET_URL=ws://localhost:3000
VITE_BLOCKCHAIN_RPC=https://api.avax-test.network/ext/bc/C/rpc
VITE_GOOGLE_MAPS_API_KEY=your-google-maps-api-key

๐ŸŽฎ Usage

For Tourists (Web App)

  1. Register: Create a blockchain-based identity with encrypted personal details
  2. Share Location: Enable location sharing to appear on the safety dashboard
  3. Report Dangers: Upload photos and descriptions of unsafe situations
  4. Emergency SOS: One-touch emergency alert with automatic blockchain logging
  5. Stay Informed: Receive warnings when entering marked danger zones
  6. Cross-Device Access: Access from any device with a modern web browser

For Authorities (Admin Portal)

  1. Monitor Safety: View live map with active tourist locations (privacy-protected)
  2. Respond to SOS: Receive real-time emergency alerts and coordinate response
  3. Mark Danger Zones: Add/remove dangerous areas based on reports and incidents
  4. Review Reports: Analyze user-submitted safety reports and photos
  5. File e-FIR: Create immutable incident reports with selective data access

๐Ÿ”’ Security & Privacy

Privacy-First Design

  • Encrypted Storage: All personal data encrypted before storage
  • Selective Disclosure: Authorities only see blockchain IDs by default
  • Emergency Access: Police can decrypt data only with proper authorization
  • Blockchain Transparency: All SOS events and e-FIRs immutably logged

Security Measures

  • JWT Authentication: Secure API access
  • Node Forge Encryption: Military-grade data protection
  • Smart Contract Auditing: Automated testing for blockchain components
  • HTTPS/WSS: Encrypted communication channels

๐ŸŒ Blockchain Details

Smart Contracts

Identity.sol

  • Maps blockchain wallet addresses to encrypted user data hashes
  • Enables privacy-preserving identification

SosAlert.sol

  • Immutably logs all SOS events with timestamps
  • Provides transparency for emergency response auditing

EFIR.sol

  • Stores First Information Reports (FIRs) on blockchain
  • Creates tamper-proof legal documentation

Why Avalanche?

  • Fast Transactions: Sub-second finality
  • Low Fees: Minimal gas costs for frequent updates
  • EVM Compatible: Easy integration with existing tools
  • Eco-Friendly: Proof-of-Stake consensus

๐Ÿš€ Deployment

Production Deployment

  1. Backend: Deploy to AWS/Google Cloud with MongoDB Atlas
  2. Admin Portal: Build and deploy to Vercel/Netlify
  3. Tourist Web App: Build and deploy to Vercel/Netlify
  4. Blockchain: Deploy contracts to Avalanche Mainnet

๐Ÿค Contributing

This project was built for a hackathon, but contributions are welcome!

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ‘ฅ Team

  • Frontend Developer: Web app and admin portal development
  • Backend Developer: API design and WebSocket implementation
  • Blockchain Developer: Smart contract development and integration
  • UI/UX Designer: User experience and interface design

๐Ÿ† Hackathon Value Proposition

Innovation

  • First-of-its-kind blockchain-based tourist safety platform
  • Privacy-preserving emergency response system
  • Immutable incident documentation for legal purposes

Real-World Impact

  • Immediate Safety: Real-time emergency response for tourists
  • Data Transparency: Blockchain-verified incident reporting
  • Scalable Solution: Adaptable to smart cities and citizen safety

Technical Excellence

  • Modern Web Stack: React + TypeScript + Vite for optimal performance
  • Full-stack Web3 integration with practical use case
  • Privacy by design architecture
  • Production-ready codebase with comprehensive testing
  • Progressive Web App capabilities for mobile-like experience

๐Ÿ“ž Support

For questions, issues, or collaboration opportunities:


Built with โค๏ธ for safer travel experiences worldwide

About

More Updates soon....

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages