Skip to content

krrish0001/urbanRelay_new

Repository files navigation

UrbanRelay

A privacy-safe QR-based vehicle alert and escalation system that allows anyone to notify vehicle owners without exposing phone numbers.

Features

Core Functionality

  • Privacy-First Design: No phone numbers exposed to scanners
  • QR Code Generation: Unique encrypted QR codes for each vehicle
  • Instant Notifications: Real-time alerts when QR code is scanned
  • ETA Response System: Owners can respond with 2, 5, or 10-minute arrival times
  • Smart Escalation: Automatic escalation if owner doesn't respond

Security & Abuse Prevention

  • Rate Limiting: Prevents spam (max 3 scans per device per hour)
  • Geo-Validation: Location-based proximity checks
  • Device Tracking: Hashed device IDs to prevent abuse
  • Automatic Blocking: Devices exceeding rate limits are blocked

Escalation System

  1. Level 1 (5 min): SMS reminder sent to owner
  2. Level 2 (10 min): VoIP call initiated
  3. Level 3 (15 min): Automatic admin complaint registration

Tech Stack

Frontend

  • React 18 with TypeScript
  • Tailwind CSS for styling
  • Lucide React for icons
  • Supabase client for authentication and real-time updates

Backend

  • Supabase Database (PostgreSQL)
  • Supabase Authentication (Email/Password)
  • Supabase Edge Functions (Deno runtime)
  • Row Level Security (RLS) for data protection

Edge Functions

  1. register-vehicle: Vehicle registration and QR generation
  2. scan-notify: QR scan notification with rate limiting
  3. respond-eta: ETA response handling
  4. escalation-handler: Automated escalation processing

Database Schema

Tables

  • profiles: User profiles with notification preferences
  • vehicles: Vehicle information and QR codes
  • notifications: Scan notifications and responses
  • rate_limits: Device-based rate limiting
  • escalations: Escalation tracking
  • admin_complaints: Admin complaint system

Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Supabase account (already configured)

Installation

  1. Install dependencies:
npm install
  1. Environment variables are already configured in .env

  2. Run development server:

npm run dev
  1. Build for production:
npm run build

User Flows

Vehicle Owner Flow

  1. Sign up for an account
  2. Add vehicle details (make, model, color, nickname)
  3. Download generated QR code
  4. Print and place QR code on vehicle dashboard
  5. Receive real-time notifications when scanned
  6. Respond with ETA (2, 5, or 10 minutes)

Scanner Flow (No Account Required)

  1. Scan QR code on vehicle
  2. Optionally add message and location
  3. Submit notification to owner
  4. Wait for owner's ETA response

Admin Flow

  1. Access admin dashboard
  2. View all escalated complaints
  3. Update complaint status (investigating, resolved)
  4. Add admin notes to complaints

Key Features Explained

Rate Limiting

  • Maximum 3 scans per device per vehicle per hour
  • Automatic device blocking for abuse
  • Hashed device IDs for privacy

Geo-Validation

  • Scanner location captured (with permission)
  • Proximity validation (configurable radius)
  • Location included in notification to owner

Real-Time Updates

  • Notification list updates automatically
  • Status changes reflected immediately
  • No page refresh needed

Escalation Engine

The escalation-handler edge function should be scheduled to run periodically (e.g., every 2 minutes) to check for:

  • Pending notifications without response
  • Expired ETAs
  • Unresolved escalations

API Endpoints

Vehicle Management

  • POST /functions/v1/register-vehicle - Register new vehicle
  • GET /functions/v1/register-vehicle - Get user's vehicles

Notifications

  • POST /functions/v1/scan-notify - Send notification (public)
  • POST /functions/v1/respond-eta - Respond with ETA (authenticated)

Escalations

  • POST /functions/v1/escalation-handler - Process escalations (scheduled)

Security Considerations

Row Level Security (RLS)

All tables have RLS policies ensuring:

  • Users can only see their own data
  • Public can create notifications (with rate limits)
  • Admins have elevated access to complaints

Data Privacy

  • Phone numbers stored encrypted
  • QR codes use UUIDs, not predictable IDs
  • Device IDs are hashed before storage
  • No personal info exposed to scanners

Authentication

  • Email/password authentication via Supabase
  • JWT-based session management
  • Secure edge function authorization

Production Deployment

The application is production-ready with:

  • Optimized Vite build
  • TypeScript for type safety
  • Comprehensive error handling
  • Real-time database subscriptions
  • Responsive design for all devices

Future Enhancements

Potential features for future development:

  • SMS/Email notifications via Twilio/SendGrid
  • VoIP calling integration
  • Push notifications
  • Mobile app (React Native)
  • Analytics dashboard
  • Multi-language support
  • Vehicle groups/fleets
  • Custom escalation rules

Support

For issues or questions, contact your system administrator.


Built with UrbanRelay - Privacy-Safe Vehicle Alert System

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors