Skip to content

ydvSajal/urban-reach

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

129 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Urban Reach

Urban Reach is a modern web application designed to streamline urban management, reporting, and worker assignments. Built with React, Vite, Tailwind CSS, and Supabase, it provides tools for citizens and workers to interact, report issues, and manage city operations efficiently.

πŸ—οΈ System Architecture & Workflow

Process Flow Architecture

graph TB
    subgraph "🌐 Frontend Layer"
        A[Web Application<br/>React + Vite + TypeScript]
        B[Mobile Responsive UI<br/>TailwindCSS + Shadcn/ui]
        C[Real-time Updates<br/>WebSocket Subscriptions]
    end
    
    subgraph "πŸ” Authentication Layer"
        D[User Authentication<br/>OTP via Email]
        E[Role-based Access<br/>Admin/Worker/Citizen]
        F[Session Management<br/>JWT + localStorage]
    end
    
    subgraph "☁️ Backend Services"
        G[Supabase Backend<br/>PostgreSQL + Auth + Storage]
        H[API Gateway<br/>RESTful + Real-time]
        I[File Storage<br/>Image Compression]
    end
    
    subgraph "πŸ—ΊοΈ External Services"
        J[OpenStreetMap<br/>Geocoding Service]
        K[Leaflet Maps<br/>Interactive Mapping]
        L[Browser APIs<br/>GPS + Camera + Notifications]
    end
    
    A --> D
    B --> E
    C --> F
    D --> G
    E --> H
    F --> I
    G --> J
    H --> K
    I --> L
Loading

User Journey Flowcharts

1. πŸ” Authentication & Onboarding Flow

flowchart TD
    START([User Visits Platform]) --> ROLE{Select User Role}
    
    ROLE -->|Admin| ADMIN[Admin Portal<br/>@bennett.edu.in required]
    ROLE -->|Worker| WORKER[Worker Portal<br/>+ Worker Details]
    ROLE -->|Citizen| CITIZEN[Citizen Portal<br/>Standard Registration]
    
    ADMIN --> EMAIL[Enter Email Address]
    WORKER --> EMAIL
    CITIZEN --> EMAIL
    
    EMAIL --> OTP[πŸ“§ OTP Sent via Email<br/>Supabase Auth]
    OTP --> VERIFY[Enter 6-digit OTP]
    
    VERIFY --> VALID{OTP Valid?}
    VALID -->|❌ No| ERROR[Show Error + Retry<br/>Max 3 attempts]
    ERROR --> VERIFY
    
    VALID -->|βœ… Yes| PROFILE[Create/Update Profile<br/>Set Role & Council ID]
    PROFILE --> DASHBOARD{Route to Dashboard}
    
    DASHBOARD -->|Admin| ADMIN_DASH[πŸ“Š Admin Dashboard<br/>Reports + Workers + Analytics]
    DASHBOARD -->|Worker| WORKER_DASH[πŸ”§ Worker Dashboard<br/>Assigned Tasks + Map]
    DASHBOARD -->|Citizen| CITIZEN_DASH[πŸ‘€ Citizen Dashboard<br/>Submit + Track Reports]
    
    style START fill:#e1f5fe
    style ADMIN_DASH fill:#f3e5f5
    style WORKER_DASH fill:#e8f5e8
    style CITIZEN_DASH fill:#fff3e0
Loading

2. πŸ“ Report Submission Flow (Citizen Journey)

flowchart TD
    CITIZEN_DASH[πŸ‘€ Citizen Dashboard] --> SUBMIT[πŸ†• Submit New Report]
    
    SUBMIT --> FORM[πŸ“ Report Form]
    
    FORM --> DETAILS[Fill Report Details]
    DETAILS --> TITLE[πŸ“‹ Issue Title]
    DETAILS --> CATEGORY[🏷️ Category Selection<br/>Roads/Water/Electricity/etc.]
    DETAILS --> DESC[πŸ“„ Detailed Description]
    DETAILS --> PRIORITY[⚠️ Priority Level<br/>Low/Medium/High]
    
    FORM --> LOCATION[πŸ“ Location Selection]
    LOCATION --> GPS_OR_MANUAL{GPS or Manual?}
    GPS_OR_MANUAL -->|πŸ›°οΈ GPS| GPS_DETECT[Auto-detect Location<br/>Browser Geolocation API]
    GPS_OR_MANUAL -->|✏️ Manual| MANUAL_ADDR[Enter Address Manually]
    
    GPS_DETECT --> GEOCODE[πŸ—ΊοΈ Geocoding Service<br/>OpenStreetMap Nominatim]
    MANUAL_ADDR --> GEOCODE
    GEOCODE --> ADDR_VALID[βœ… Address Validation<br/>& Formatting]
    
    FORM --> IMAGES[πŸ“Έ Optional Images]
    IMAGES --> UPLOAD[πŸ“€ Image Upload<br/>Drag & Drop Interface]
    UPLOAD --> COMPRESS[πŸ—œοΈ Image Compression<br/>& Validation]
    COMPRESS --> STORAGE[☁️ Supabase Storage]
    
    ADDR_VALID --> VALIDATE[πŸ” Form Validation]
    STORAGE --> VALIDATE
    TITLE --> VALIDATE
    CATEGORY --> VALIDATE
    DESC --> VALIDATE
    PRIORITY --> VALIDATE
    
    VALIDATE --> VALID_CHECK{All Fields Valid?}
    VALID_CHECK -->|❌ No| SHOW_ERRORS[❗ Show Validation Errors]
    SHOW_ERRORS --> FORM
    
    VALID_CHECK -->|βœ… Yes| SUBMIT_DB[πŸ’Ύ Submit to Database<br/>Create Report Record]
    SUBMIT_DB --> REPORT_NUM[πŸ”’ Generate Report Number<br/>Auto-increment ID]
    REPORT_NUM --> AUTO_ASSIGN[πŸ€– Auto-assign Worker<br/>Based on Category & Availability]
    
    AUTO_ASSIGN --> NOTIFY[πŸ“’ Send Notifications]
    NOTIFY --> CITIZEN_NOTIFY[πŸ“§ Notify Citizen<br/>Report Submitted Successfully]
    NOTIFY --> WORKER_NOTIFY[πŸ”” Notify Assigned Worker<br/>New Task Available]
    NOTIFY --> ADMIN_NOTIFY[πŸ“Š Update Admin Dashboard<br/>New Report Counter]
    
    CITIZEN_NOTIFY --> SUCCESS[βœ… Success Page<br/>Show Report Number]
    SUCCESS --> TRACK[πŸ‘€ Track Report Status<br/>Real-time Updates]
    
    style SUBMIT fill:#4caf50
    style SUCCESS fill:#8bc34a
    style NOTIFY fill:#ff9800
Loading

3. πŸ‘¨β€πŸ’Ό Admin Management Flow

flowchart TD
    ADMIN_DASH[πŸ“Š Admin Dashboard] --> VIEW_REPORTS[πŸ“‹ View All Reports]
    
    VIEW_REPORTS --> FILTER[πŸ” Filter & Search]
    FILTER --> BY_STATUS[πŸ“Š By Status<br/>Pending/In Progress/Resolved]
    FILTER --> BY_CATEGORY[🏷️ By Category<br/>Roads/Water/etc.]
    FILTER --> BY_PRIORITY[⚠️ By Priority Level]
    FILTER --> BY_DATE[πŸ“… By Date Range]
    
    VIEW_REPORTS --> SELECT_REPORT[πŸ‘† Select Report]
    SELECT_REPORT --> REPORT_DETAIL[πŸ“„ Report Detail View]
    
    REPORT_DETAIL --> VIEW_INFO[πŸ‘€ View Information]
    VIEW_INFO --> REPORT_DATA[πŸ“‹ Report Details<br/>Title, Description, Location]
    VIEW_INFO --> IMAGES_GALLERY[πŸ–ΌοΈ Images Gallery<br/>Evidence Photos]
    VIEW_INFO --> MAP_LOCATION[πŸ—ΊοΈ Location on Map<br/>Interactive Leaflet Map]
    VIEW_INFO --> STATUS_HISTORY[πŸ“ˆ Status Timeline<br/>Complete Audit Trail]
    
    REPORT_DETAIL --> ASSIGNMENT{Current Status?}
    ASSIGNMENT -->|πŸ“ Pending| ASSIGN_WORKER[πŸ‘· Assign Worker]
    ASSIGNMENT -->|πŸ‘€ Assigned| VIEW_WORKER[πŸ‘€ View Current Worker<br/>Performance & Contact]
    ASSIGNMENT -->|πŸ”„ In Progress| MONITOR[πŸ“Š Monitor Progress<br/>Real-time Updates]
    ASSIGNMENT -->|βœ… Resolved| REVIEW[πŸ“‹ Review Resolution<br/>Citizen Feedback]
    
    ASSIGN_WORKER --> WORKER_FILTER[πŸ” Filter Available Workers]
    WORKER_FILTER --> BY_SPECIALTY[πŸ› οΈ By Specialty Match<br/>Category-specific Skills]
    WORKER_FILTER --> BY_WORKLOAD[πŸ“Š By Current Workload<br/>Capacity Management]
    WORKER_FILTER --> BY_PERFORMANCE[⭐ By Performance Rating<br/>Historical Success Rate]
    WORKER_FILTER --> BY_LOCATION[πŸ“ By Proximity<br/>Distance from Issue]
    
    WORKER_FILTER --> SELECT_WORKER[πŸ‘· Select Best Worker]
    SELECT_WORKER --> CONFIRM_ASSIGN[βœ… Confirm Assignment]
    
    CONFIRM_ASSIGN --> UPDATE_STATUS[πŸ”„ Update Report Status<br/>Pending β†’ Assigned]
    UPDATE_STATUS --> UPDATE_WORKLOAD[πŸ“Š Update Worker Workload<br/>Increment Task Counter]
    UPDATE_WORKLOAD --> SEND_NOTIFICATIONS[πŸ“’ Send Notifications]
    
    SEND_NOTIFICATIONS --> WORKER_NOTIFICATION[πŸ”” Notify Worker<br/>New Task Assigned]
    SEND_NOTIFICATIONS --> CITIZEN_NOTIFICATION[πŸ“§ Notify Citizen<br/>Worker Assigned to Issue]
    SEND_NOTIFICATIONS --> HISTORY_LOG[πŸ“ Create Status History<br/>Audit Trail Entry]
    
    VIEW_WORKER --> REASSIGN[πŸ”„ Reassign Option]
    REASSIGN --> ASSIGN_WORKER
    
    ADMIN_DASH --> BULK_OPS[⚑ Bulk Operations]
    BULK_OPS --> BULK_SELECT[β˜‘οΈ Multi-select Reports]
    BULK_SELECT --> BULK_STATUS[πŸ”„ Bulk Status Update]
    BULK_SELECT --> BULK_EXPORT[πŸ“€ Bulk Data Export<br/>CSV/Excel Format]
    BULK_SELECT --> BULK_ASSIGN[πŸ‘₯ Bulk Worker Assignment]
    
    ADMIN_DASH --> ANALYTICS[πŸ“ˆ Analytics Dashboard]
    ANALYTICS --> REPORT_STATS[πŸ“Š Report Statistics<br/>Trends & Patterns]
    ANALYTICS --> WORKER_PERFORMANCE[⭐ Worker Performance<br/>Metrics & Rankings]
    ANALYTICS --> COUNCIL_INSIGHTS[πŸ›οΈ Council-level Insights<br/>Area-wise Analysis]
    
    style ADMIN_DASH fill:#9c27b0
    style ASSIGN_WORKER fill:#2196f3
    style SEND_NOTIFICATIONS fill:#ff9800
    style ANALYTICS fill:#4caf50
Loading

4. πŸ‘·β€β™‚οΈ Worker Task Management Flow

flowchart TD
    WORKER_DASH[πŸ”§ Worker Dashboard] --> VIEW_TASKS[πŸ“‹ View Assigned Tasks]
    
    VIEW_TASKS --> TASK_CATEGORIES[πŸ“Š Task Categories]
    TASK_CATEGORIES --> NEW_TASKS[πŸ†• New Assignments<br/>Recently Assigned]
    TASK_CATEGORIES --> IN_PROGRESS[πŸ”„ In Progress Tasks<br/>Currently Working On]
    TASK_CATEGORIES --> PENDING_REVIEW[⏳ Pending Review<br/>Awaiting Feedback]
    TASK_CATEGORIES --> COMPLETED[βœ… Completed Tasks<br/>Successfully Resolved]
    
    VIEW_TASKS --> PERFORMANCE[πŸ“ˆ Performance Metrics]
    PERFORMANCE --> CURRENT_LOAD[πŸ“Š Current Workload<br/>Active Tasks Count]
    PERFORMANCE --> COMPLETION_RATE[⭐ Completion Rate<br/>Success Percentage]
    PERFORMANCE --> AVG_TIME[⏱️ Average Completion Time<br/>Efficiency Metric]
    PERFORMANCE --> RATING[🌟 Performance Rating<br/>Overall Score]
    
    VIEW_TASKS --> SELECT_TASK[πŸ‘† Select Task]
    SELECT_TASK --> TASK_DETAIL[πŸ“„ Task Detail View]
    
    TASK_DETAIL --> VIEW_TASK_INFO[πŸ‘€ View Task Information]
    VIEW_TASK_INFO --> REPORT_INFO[πŸ“‹ Report Details<br/>Issue Description & Category]
    VIEW_TASK_INFO --> LOCATION_MAP[πŸ—ΊοΈ Location & Directions<br/>GPS Navigation Ready]
    VIEW_TASK_INFO --> EVIDENCE_PHOTOS[πŸ“Έ Evidence Images<br/>Issue Documentation]
    VIEW_TASK_INFO --> CITIZEN_CONTACT[πŸ“ž Citizen Contact Info<br/>Communication Details]
    VIEW_TASK_INFO --> TASK_HISTORY[πŸ“ˆ Task History<br/>Previous Status Updates]
    
    TASK_DETAIL --> UPDATE_STATUS[πŸ”„ Update Task Status]
    UPDATE_STATUS --> STATUS_OPTIONS{Current Status?}
    
    STATUS_OPTIONS -->|πŸ“ Acknowledged| START_WORK[▢️ Start Work<br/>Status: In Progress]
    STATUS_OPTIONS -->|πŸ”„ In Progress| PROGRESS_OPTIONS[πŸ› οΈ Progress Options]
    STATUS_OPTIONS -->|Any Status| ADD_NOTES[πŸ“ Add Work Notes<br/>Document Actions Taken]
    
    PROGRESS_OPTIONS --> NEED_INFO[❓ Request Information<br/>Status: Pending Info]
    PROGRESS_OPTIONS --> COMPLETE_TASK[βœ… Mark Complete<br/>Status: Resolved]
    PROGRESS_OPTIONS --> CANNOT_FIX[❌ Cannot Fix<br/>Status: Closed]
    PROGRESS_OPTIONS --> ESCALATE[⬆️ Escalate Issue<br/>Status: Escalated]
    
    START_WORK --> RECORD_START[⏰ Record Start Time<br/>Performance Tracking]
    COMPLETE_TASK --> RECORD_COMPLETION[⏱️ Record Completion Time<br/>Calculate Duration]
    CANNOT_FIX --> CLOSURE_REASON[πŸ“ Document Closure Reason<br/>Detailed Explanation]
    ESCALATE --> ESCALATE_ADMIN[πŸ“’ Notify Admin<br/>Requires Higher Authority]
    
    ADD_NOTES --> WORK_DESCRIPTION[πŸ“‹ Describe Actions Taken<br/>Detailed Work Log]
    ADD_NOTES --> PROGRESS_PHOTOS[πŸ“Έ Add Progress Photos<br/>Before/After Evidence]
    ADD_NOTES --> ISSUE_NOTES[❗ Note Any Issues<br/>Complications or Discoveries]
    
    UPDATE_STATUS --> VALIDATE_INPUT[πŸ” Validate Status Update<br/>Check Required Fields]
    VALIDATE_INPUT --> SUBMIT_UPDATE[πŸ“€ Submit Status Update]
    
    SUBMIT_UPDATE --> UPDATE_DATABASE[πŸ’Ύ Update Database<br/>Save Status Change]
    UPDATE_DATABASE --> CREATE_HISTORY[πŸ“ Create History Entry<br/>Audit Trail Record]
    CREATE_HISTORY --> UPDATE_METRICS[πŸ“Š Update Worker Metrics<br/>Performance Calculation]
    UPDATE_METRICS --> SEND_NOTIFICATIONS[πŸ“’ Send Notifications]
    
    SEND_NOTIFICATIONS --> CITIZEN_UPDATE[πŸ“§ Notify Citizen<br/>Progress Update]
    SEND_NOTIFICATIONS --> ADMIN_UPDATE[πŸ“Š Update Admin Dashboard<br/>Real-time Status]
    SEND_NOTIFICATIONS --> REALTIME_SYNC[πŸ”„ Real-time Sync<br/>Live Dashboard Updates]
    
    TASK_DETAIL --> MAP_INTEGRATION[πŸ—ΊοΈ Map Features]
    MAP_INTEGRATION --> VIEW_LOCATION[πŸ“ View Task Location<br/>Interactive Map]
    MAP_INTEGRATION --> GET_DIRECTIONS[🧭 Get Directions<br/>Navigation to Site]
    MAP_INTEGRATION --> REPORT_GPS[πŸ“‘ Report GPS Issues<br/>Location Problems]
    
    WORKER_DASH --> MOBILE_OPTIMIZED[πŸ“± Mobile Optimizations]
    MOBILE_OPTIMIZED --> CAMERA_CAPTURE[πŸ“Έ Camera Capture<br/>Quick Photo Upload]
    MOBILE_OPTIMIZED --> OFFLINE_MODE[πŸ“Ά Offline Mode<br/>Limited Connectivity Support]
    MOBILE_OPTIMIZED --> PUSH_NOTIFICATIONS[πŸ”” Push Notifications<br/>Real-time Alerts]
    
    style WORKER_DASH fill:#4caf50
    style UPDATE_STATUS fill:#2196f3
    style SEND_NOTIFICATIONS fill:#ff9800
    style COMPLETE_TASK fill:#8bc34a
    style ESCALATE fill:#f44336
Loading

5. πŸ”” Notification & Real-time System Flow

flowchart TD
    TRIGGER[⚑ System Event Triggers] --> EVENT_TYPES[πŸ“‹ Event Types]
    
    EVENT_TYPES --> STATUS_CHANGE[πŸ”„ Status Change<br/>Report Progress Update]
    EVENT_TYPES --> WORKER_ASSIGNMENT[πŸ‘· Worker Assignment<br/>New Task Allocation]
    EVENT_TYPES --> NEW_REPORT[πŸ“ New Report Created<br/>Citizen Submission]
    EVENT_TYPES --> ESCALATION[⬆️ Report Escalation<br/>Issue Requires Attention]
    EVENT_TYPES --> COMPLETION[βœ… Task Completion<br/>Work Finished]
    
    STATUS_CHANGE --> NOTIFICATION_ENGINE[πŸ”§ Notification Engine]
    WORKER_ASSIGNMENT --> NOTIFICATION_ENGINE
    NEW_REPORT --> NOTIFICATION_ENGINE
    ESCALATION --> NOTIFICATION_ENGINE
    COMPLETION --> NOTIFICATION_ENGINE
    
    NOTIFICATION_ENGINE --> CHECK_PREFERENCES[βš™οΈ Check User Preferences<br/>Notification Settings]
    CHECK_PREFERENCES --> USER_PREFS[πŸ‘€ User Preference Database<br/>Email/Push/In-app Settings]
    
    USER_PREFS --> EMAIL_CHECK{πŸ“§ Email Enabled?}
    EMAIL_CHECK -->|βœ… Yes| EMAIL_PROCESS[πŸ“¬ Process Email Notification]
    EMAIL_CHECK -->|❌ No| SKIP_EMAIL[⏭️ Skip Email]
    
    EMAIL_PROCESS --> EMAIL_TEMPLATE[πŸ“„ Email Template Processing<br/>Dynamic Content Generation]
    EMAIL_TEMPLATE --> SUPABASE_EMAIL[πŸ“§ Supabase Email Function<br/>SMTP Delivery]
    
    USER_PREFS --> PUSH_CHECK{πŸ“± Push Notifications?}
    PUSH_CHECK -->|βœ… Yes| PUSH_PROCESS[πŸ”” Process Push Notification]
    PUSH_CHECK -->|❌ No| SKIP_PUSH[⏭️ Skip Push]
    
    PUSH_PROCESS --> BROWSER_PERMISSION[πŸ” Browser Permission Check<br/>Notification API Access]
    BROWSER_PERMISSION --> NATIVE_NOTIFICATION[πŸ“² Show Native Notification<br/>Browser/Mobile Alert]
    
    USER_PREFS --> INAPP_CHECK{πŸ“± In-App Notifications?}
    INAPP_CHECK -->|βœ… Yes| INAPP_PROCESS[πŸ”” Process In-App Notification]
    INAPP_CHECK -->|❌ No| SKIP_INAPP[⏭️ Skip In-App]
    
    INAPP_PROCESS --> CREATE_RECORD[πŸ’Ύ Create Notification Record<br/>Database Storage]
    CREATE_RECORD --> REALTIME_BROADCAST[πŸ“‘ Supabase Realtime Broadcast<br/>Live WebSocket Update]
    
    REALTIME_BROADCAST --> NOTIFICATION_PROVIDER[πŸ”§ Notification Provider Context<br/>React Global State]
    NOTIFICATION_PROVIDER --> UPDATE_UI[πŸ”„ Update UI Components<br/>Real-time Interface Updates]
    
    UPDATE_UI --> NOTIFICATION_CENTER[πŸ”” Notification Center<br/>In-App Message List]
    UPDATE_UI --> BADGE_COUNTER[πŸ”΄ Notification Badge<br/>Unread Count Display]
    UPDATE_UI --> TOAST_POPUP[🍞 Toast Notifications<br/>Temporary Pop-up Messages]
    
    NOTIFICATION_CENTER --> MARK_READ[πŸ‘οΈ Mark as Read Functionality<br/>User Interaction]
    NOTIFICATION_CENTER --> NOTIFICATION_HISTORY[πŸ“œ Notification History<br/>Message Archive]
    
    NOTIFICATION_ENGINE --> REALTIME_DASHBOARD[πŸ“Š Real-time Dashboard Updates]
    REALTIME_DASHBOARD --> COUNTER_UPDATES[πŸ”’ Update Counters<br/>Live Statistics]
    REALTIME_DASHBOARD --> LIST_REFRESH[πŸ“‹ Refresh Lists<br/>Dynamic Content Update]
    REALTIME_DASHBOARD --> STATUS_INDICATORS[🚦 Status Indicators<br/>Visual State Changes]
    REALTIME_DASHBOARD --> WORKER_ASSIGNMENTS[πŸ‘· Worker Assignment Display<br/>Live Task Updates]
    
    SUPABASE_EMAIL --> DELIVERY_STATUS[πŸ“¬ Email Delivery Status<br/>Success/Failure Tracking]
    NATIVE_NOTIFICATION --> USER_INTERACTION[πŸ‘† User Interaction<br/>Click/Dismiss Handling]
    MARK_READ --> UPDATE_PREFERENCES[βš™οΈ Update User Preferences<br/>Learning from User Behavior]
    
    style NOTIFICATION_ENGINE fill:#ff9800
    style REALTIME_BROADCAST fill:#2196f3
    style EMAIL_PROCESS fill:#4caf50
    style PUSH_PROCESS fill:#9c27b0
    style INAPP_PROCESS fill:#00bcd4
Loading

πŸ—οΈ Technical Architecture Overview

graph TB
    subgraph "πŸ‘₯ User Layer"
        CITIZENS[πŸ‘€ Citizens<br/>Report Issues & Track Progress]
        WORKERS[πŸ‘· Workers<br/>Handle Tasks & Update Status]
        ADMINS[πŸ‘¨β€πŸ’Ό Admins<br/>Manage System & Analytics]
    end
    
    subgraph "🌐 Presentation Layer"
        REACT[βš›οΈ React 18 + TypeScript<br/>Component-based UI]
        ROUTER[🧭 React Router<br/>Client-side Navigation]
        STATE[πŸ“Š State Management<br/>React Query + Context API]
        UI[🎨 UI Framework<br/>TailwindCSS + Shadcn/ui]
    end
    
    subgraph "πŸ”§ Business Logic Layer"
        AUTH[πŸ” Authentication Logic<br/>OTP + Role-based Access]
        WORKFLOWS[πŸ”„ Workflow Management<br/>Report Lifecycle]
        NOTIFICATIONS[πŸ”” Notification System<br/>Multi-channel Delivery]
        GEOCODING[πŸ—ΊοΈ Location Services<br/>GPS + Address Resolution]
    end
    
    subgraph "🌍 External Services"
        OSM[πŸ—ΊοΈ OpenStreetMap<br/>Geocoding + Address Data]
        LEAFLET[πŸ—ΊοΈ Leaflet Maps<br/>Interactive Mapping]
        BROWSER[🌐 Browser APIs<br/>GPS + Camera + Notifications]
    end
    
    subgraph "☁️ Backend Services"
        SUPABASE[⚑ Supabase Platform]
        DATABASE[πŸ—ƒοΈ PostgreSQL Database<br/>Structured Data + RLS]
        STORAGE[πŸ“¦ File Storage<br/>Image Management]
        REALTIME[πŸ“‘ Real-time Engine<br/>WebSocket Subscriptions]
        FUNCTIONS[βš™οΈ Edge Functions<br/>Email + Automation]
    end
    
    subgraph "πŸ“Š Data Layer"
        REPORTS[πŸ“‹ Reports Table<br/>Issue Management]
        USERS[πŸ‘₯ Users & Profiles<br/>Role Management]
        WORKERS_DB[πŸ‘· Workers Table<br/>Skill & Workload Tracking]
        NOTIFICATIONS_DB[πŸ”” Notifications<br/>Message History]
        HISTORY[πŸ“œ Status History<br/>Audit Trail]
    end
    
    CITIZENS --> REACT
    WORKERS --> REACT
    ADMINS --> REACT
    
    REACT --> AUTH
    ROUTER --> WORKFLOWS
    STATE --> NOTIFICATIONS
    UI --> GEOCODING
    
    AUTH --> SUPABASE
    WORKFLOWS --> DATABASE
    NOTIFICATIONS --> REALTIME
    GEOCODING --> OSM
    
    SUPABASE --> REPORTS
    DATABASE --> USERS
    STORAGE --> WORKERS_DB
    REALTIME --> NOTIFICATIONS_DB
    FUNCTIONS --> HISTORY
    
    GEOCODING --> LEAFLET
    NOTIFICATIONS --> BROWSER
    
    style CITIZENS fill:#fff3e0
    style WORKERS fill:#e8f5e8
    style ADMINS fill:#f3e5f5
    style SUPABASE fill:#00d4aa
    style REACT fill:#61dafb
Loading

Features

  • πŸ” Multi-Role Authentication: Secure OTP-based login for Citizens, Workers, and Admins
  • πŸ“ Intelligent Report Management: Submit, track, and manage municipal issues with automatic worker assignment
  • πŸ‘· Worker Task System: Specialized worker dashboards with performance tracking and workload management
  • πŸ—ΊοΈ Advanced Location Services: GPS integration, interactive maps, and geocoding for precise issue location
  • πŸ“± Real-time Notifications: Multi-channel notifications (email, push, in-app) with user preferences
  • πŸ“Š Analytics & Insights: Comprehensive dashboards with performance metrics and trend analysis
  • ⚑ Bulk Operations: Efficient data export, bulk status updates, and batch processing
  • πŸ“Έ Media Management: Image upload with compression, galleries, and evidence documentation
  • πŸ”„ Live Updates: Real-time synchronization across all user interfaces using WebSocket technology

Tech Stack

  • Frontend: React 18 + TypeScript, Vite, TailwindCSS + Shadcn/ui
  • Backend: Supabase (PostgreSQL + Auth + Storage + Real-time + Functions)
  • Mapping: Leaflet + OpenStreetMap Nominatim for geocoding
  • State Management: React Query + Context API
  • Authentication: Supabase Auth with OTP email verification
  • Real-time: WebSocket subscriptions for live updates
  • File Handling: Supabase Storage with image compression
  • Deployment: Vercel with optimized build configuration

πŸš€ Live Demo

Visit the live application: https://urban-reach-1.vercel.app/

Test Accounts

  • Citizen Portal: /auth/citizen - Use any email for testing
  • Worker Portal: /auth/worker - Requires worker registration
  • Admin Portal: /auth/admin - Requires @bennett.edu.in email

πŸ“ Project Structure

urban-reach/
β”œβ”€β”€ πŸ“ src/
β”‚   β”œβ”€β”€ πŸ“ components/          # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ ui/                 # Shadcn/ui base components
β”‚   β”‚   β”œβ”€β”€ AuthForm.tsx        # Authentication interface
β”‚   β”‚   β”œβ”€β”€ ReportsMap.tsx      # Interactive mapping
β”‚   β”‚   β”œβ”€β”€ WorkerAssignment.tsx # Worker allocation system
β”‚   β”‚   β”œβ”€β”€ StatusUpdate.tsx    # Task status management
β”‚   β”‚   β”œβ”€β”€ NotificationCenter.tsx # Real-time notifications
β”‚   β”‚   └── ImageUpload.tsx     # File upload with compression
β”‚   β”œβ”€β”€ πŸ“ pages/               # Application page components
β”‚   β”‚   β”œβ”€β”€ Dashboard.tsx       # Admin overview
β”‚   β”‚   β”œβ”€β”€ CitizenDashboard.tsx # Citizen interface
β”‚   β”‚   β”œβ”€β”€ WorkerDashboard.tsx # Worker task management
β”‚   β”‚   β”œβ”€β”€ SubmitReport.tsx    # Issue submission form
β”‚   β”‚   └── ReportDetail.tsx    # Detailed report view
β”‚   β”œβ”€β”€ πŸ“ hooks/               # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ useGeocoding.ts     # Location services
β”‚   β”‚   β”œβ”€β”€ useRealtimeSubscription.ts # Live updates
β”‚   β”‚   └── useNetworkStatus.ts # Connectivity monitoring
β”‚   β”œβ”€β”€ πŸ“ lib/                 # Utility libraries
β”‚   β”‚   β”œβ”€β”€ geocoding.ts        # Address resolution
β”‚   β”‚   β”œβ”€β”€ notifications.ts    # Message handling
β”‚   β”‚   β”œβ”€β”€ storage.ts          # File management
β”‚   β”‚   └── error-handling.ts   # Error management
β”‚   └── πŸ“ integrations/        # External service integrations
β”‚       └── supabase/           # Database & auth configuration
β”œβ”€β”€ πŸ“ supabase/               # Backend configuration
β”‚   β”œβ”€β”€ πŸ“ migrations/         # Database schema evolution
β”‚   β”œβ”€β”€ πŸ“ functions/          # Edge functions (email automation)
β”‚   └── config.toml            # Supabase project settings
β”œβ”€β”€ πŸ“ public/                 # Static assets
└── πŸ“ docs/                   # Documentation files

πŸ› οΈ Development Setup

Prerequisites

  • Node.js 18+ and npm/yarn
  • Supabase account and project
  • Modern web browser with WebSocket support

Installation Steps

  1. Clone the repository:

    git clone https://github.com/ydvSajal/urban-reach.git
    cd urban-reach
  2. Install dependencies:

    npm install
  3. Environment Configuration: Create .env.local file with Supabase credentials:

    VITE_SUPABASE_URL=your_supabase_project_url
    VITE_SUPABASE_PUBLISHABLE_KEY=your_supabase_anon_key
  4. Database Setup: Run the included migrations to set up the database schema:

    npx supabase db reset
  5. Start development server:

    npm run dev
  6. Open in browser: Navigate to http://localhost:8080

πŸ—„οΈ Database Schema

Core Tables

  • profiles - User information with role-based access control
  • reports - Municipal issue submissions with full lifecycle tracking
  • workers - Worker profiles with specialization and performance metrics
  • councils - Municipal council management (Bennett University)
  • notifications - Multi-channel notification system with preferences
  • report_status_history - Complete audit trail for all status changes
  • worker_specialties - Skill categorization for optimal task assignment

Key Features

  • Row Level Security (RLS) for data protection and privacy
  • Automated triggers for performance calculation and auto-assignment
  • Real-time subscriptions for live dashboard updates
  • Comprehensive indexing for optimal query performance

🀝 Contributing

We welcome contributions to Urban Reach! Here's how you can help:

Development Guidelines

  1. Fork the repository and create a feature branch
  2. Follow the existing code style and use TypeScript
  3. Add tests for new features and ensure existing tests pass
  4. Update documentation for any API or workflow changes
  5. Submit a pull request with a clear description of changes

Code Quality Standards

  • ESLint configuration for code consistency
  • TypeScript for type safety and better development experience
  • Component testing with React Testing Library
  • Comprehensive error handling and user feedback

Areas for Contribution

  • πŸ”§ Feature Development: New workflows and user interface improvements
  • πŸ› Bug Fixes: Issue resolution and performance optimizations
  • πŸ“š Documentation: Guides, tutorials, and API documentation
  • πŸ§ͺ Testing: Unit tests, integration tests, and user acceptance testing
  • 🎨 UI/UX: Design improvements and accessibility enhancements

πŸ“š Documentation

Additional Resources

API References

πŸ”’ Security & Privacy

  • Row Level Security (RLS) enforced at database level
  • Role-based access control with strict permission boundaries
  • Input validation and sanitization for all user data
  • Secure file upload with type validation and size limits
  • Environment variable protection for sensitive credentials

πŸ“Š Performance Features

  • Code splitting with lazy-loaded routes for faster initial load
  • Image compression for optimal storage and bandwidth usage
  • Optimistic updates for immediate user feedback
  • Real-time synchronization with minimal data transfer
  • Mobile optimization with responsive design and touch interfaces

🌟 Future Roadmap

  • πŸ“± Mobile App Development - Native iOS and Android applications
  • πŸ€– AI-Powered Features - Intelligent issue categorization and priority detection
  • πŸ“ˆ Advanced Analytics - Predictive modeling and trend analysis
  • 🌍 Multi-language Support - Internationalization for broader accessibility
  • πŸ”— Third-party Integrations - Government databases and mapping services

πŸ“„ License

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

πŸ“ž Support & Contact


πŸ™οΈ Built for Smart Cities | πŸš€ Powered by Modern Web Technology | πŸ’‘ Open Source Innovation

Making urban management more efficient, transparent, and citizen-friendly.

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors