Skip to content

About

Community Reporting Platform

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

75 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ™๏ธ CivicTrack: Empowering Communities, One Report at a Time

CivicTrack Banner

License: MIT React TypeScript Vite MongoDB Express Firebase Tailwind


๐Ÿš€ Production-Ready Full-Stack Civic Engagement Platform

Bridging Communities and Government Through Technology

GitHub last commit GitHub code size GitHub top language

๐Ÿ“Š Project Achievements

  • โœ… 40+ API Endpoints implemented and tested
  • โœ… 15+ React Components with TypeScript
  • โœ… 5 Database Models with geospatial indexing
  • โœ… Complete Authentication System with Clerk
  • โœ… Security Hardened with XSS protection and input sanitization
  • โœ… Production Deployment Ready with comprehensive documentation
  • โœ… 84 Files committed across frontend and backend
  • โœ… 2,500+ Lines of Code written in 8 hours + extended development

โ“ Problem Statement

Modern cities face numerous civic challenges that often go unreported or unaddressed due to inefficient reporting mechanisms. Citizens need a simple, transparent way to report issues like potholes, broken streetlights, or garbage collection problems, while local authorities require a streamlined system to track and resolve these issues effectively.

๐Ÿ’ก Our Solution

CivicTrack is a modern, user-friendly platform that bridges the gap between citizens and local authorities. Our solution enables:

  • ๐Ÿ“ฑ Easy Issue Reporting: Intuitive mobile-first interface for quick reporting
  • ๐Ÿ“ Location-Based Tracking: Pinpoint issues precisely on an interactive map
  • ๐Ÿ“ธ Visual Documentation: Support for multiple image uploads
  • ๐Ÿ” Transparent Tracking: Real-time status updates on reported issues
  • ๐Ÿค Community Engagement: Upvote and comment on local issues
  • ๐Ÿ›๏ธ Government Integration: Streamlined workflow for authorities

๐Ÿ—๏ธ System Architecture

graph TB
    subgraph "Frontend Layer"
        A[React SPA<br/>TypeScript + Vite]
        B[Clerk Authentication<br/>User Management]
        C[Admin Dashboard<br/>Statistics & Moderation]
        D[Glassmorphism UI<br/>Dynamic Background Detection]
    end
    
    subgraph "UI Components"
        E[BackgroundWrapper<br/>Dots, Grid, Shader Variants]
        F[Layout Component<br/>Transparent Navbar]
        G[Protected Routes<br/>Role-based Access]
        H[Form Components<br/>Input Sanitization]
    end
    
    subgraph "Backend Services"
        I[Express.js API Server<br/>TypeScript + Node.js]
        J[Email Service<br/>SMTP + Templates]
        K[File Upload Service<br/>Cloudinary + Multer]
        L[Authentication Middleware<br/>Clerk Integration]
    end
    
    subgraph "Data Layer"
        M[(MongoDB Atlas<br/>User & Issue Data)]
        N[(Cloudinary<br/>Media Storage)]
        O[Clerk Backend<br/>User Authentication]
    end
    
    subgraph "Security & Monitoring"
        P[Input Sanitization<br/>XSS Protection]
        Q[Rate Limiting<br/>CORS Security]
        R[Secure Logging<br/>Production Safe]
        S[Dynamic Color Detection<br/>Accessibility Features]
    end
    
    A -->|HTTPS/REST API| I
    B -->|Auth Tokens| L
    C -->|Admin Operations| I
    D -->|Background Detection| S
    E -->|UI Rendering| D
    F -->|Navbar State| D
    G -->|Route Protection| B
    H -->|Form Validation| P
    I -->|Geospatial Queries| M
    I -->|Image Processing| K
    K -->|Media Upload| N
    I -->|Notifications| J
    L -->|User Verification| O
    I -->|Security Layer| P
    I -->|Security Policies| Q
    I -->|Audit Logging| R
    
    classDef frontend fill:#e1f5fe
    classDef ui fill:#f8bbd9
    classDef backend fill:#f3e5f5
    classDef database fill:#e8f5e8
    classDef security fill:#fff3e0
    
    class A,B,C,D frontend
    class E,F,G,H ui
    class I,J,K,L backend
    class M,N,O database
    class P,Q,R,S security
Loading

๐Ÿ”„ Component Relationships

  • Frontend: React 19 + TypeScript + Vite 7 with modern UI patterns
  • Authentication: Clerk React SDK v5.38.1 with UserButton and session management
  • State Management: React Context API + Clerk hooks for auth state
  • Styling: Tailwind CSS with custom glassmorphism effects and backdrop-blur
  • UI Components:
    • BackgroundWrapper: Dots, grid, shader, and subtle variants for different page themes
    • Layout: Transparent glassmorphism navbar with dynamic text color adaptation
    • Protected Routes: Clerk-based route protection with role verification
  • Backend: Express.js with TypeScript + MongoDB with geospatial indexing
  • File Storage: Cloudinary with image optimization and upload handling
  • Email System: SMTP with HTML templates for notifications
  • Security:
    • Input sanitization with selective field processing
    • XSS protection with Content Security Policy
    • Dynamic background detection for accessibility
    • Clerk security features with JWT token validation
  • Maps Integration: OpenStreetMap with Leaflet for geolocation features
  • Admin Panel: Role-based access control with Clerk permissions

๐Ÿ› ๏ธ Technology Stack

๐Ÿ’ป Complete Technology Stack Details (Click to expand)

Frontend

  • โš›๏ธ Framework: React 18.2
  • ๐Ÿ“˜ Language: TypeScript 5.0
  • โšก Build Tool: Vite 4.4
  • ๐ŸŽจ Styling: Tailwind CSS 3.3
  • ๐Ÿ” Authentication: Clerk
  • ๐Ÿ—‚๏ธ State Management: React Context API
  • ๐Ÿงญ Routing: React Router 6.14
  • ๐Ÿ“ Form Handling: React Hook Form 7.45
  • ๐ŸŽฏ UI Components: Headless UI, Heroicons
  • ๐Ÿ—บ๏ธ Maps: OpenStreetMap, Leaflet
  • ๐Ÿ”’ Security: Input sanitization, XSS protection

Backend

  • ๐Ÿš€ Runtime: Node.js 18+ with TypeScript
  • ๐Ÿ—๏ธ Framework: Express.js 4.18
  • ๐Ÿ—„๏ธ Database: MongoDB with Mongoose ODM
  • ๐Ÿ”‘ Authentication: JWT with bcrypt
  • ๐Ÿ“ง Email Service: Nodemailer with SMTP
  • โ˜๏ธ Storage: Cloudinary with Multer
  • ๐Ÿ” Search: MongoDB text & geospatial indexing
  • ๐Ÿ“Š Analytics: Custom aggregation pipelines
  • ๐Ÿ›ก๏ธ Security: Rate limiting, CORS, validation

DevOps & Deployment

  • ๐Ÿ”ง Development: Concurrently, Nodemon
  • ๐Ÿ“ฆ Package Manager: npm
  • ๐ŸŒ Deployment: Vercel (Frontend and Backend)
  • ๐Ÿ“ Documentation: Markdown, API testing guides
  • ๐Ÿ”„ Version Control: Git with semantic commits

๐Ÿš€ Getting Started

๐Ÿ“‹ Prerequisites & Installation Guide (Click to expand)

Prerequisites

  • Node.js 18+
  • npm 9+
  • Git

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/civictrack.git
    cd CivicTrack
  2. Install dependencies

    cd client
    npm install
  3. Set up environment variables Create a .env file in the client directory:

    # Firebase Configuration
    VITE_FIREBASE_API_KEY=your_firebase_api_key
    VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
    VITE_FIREBASE_PROJECT_ID=your_project_id
    VITE_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
    VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
    VITE_FIREBASE_APP_ID=your_app_id
    VITE_FIREBASE_MEASUREMENT_ID=your_measurement_id
    
    # API Configuration
    VITE_API_URL=http://localhost:5000/api

    Create a .env file in the server directory:

    # Database
    MONGO_URI=mongodb://localhost:27017/civictrack
    
    # JWT
    JWT_SECRET=your_jwt_secret_key
    
    # Email Configuration
    SMTP_HOST=smtp.gmail.com
    SMTP_PORT=587
    SMTP_USER=your_email@gmail.com
    SMTP_PASS=your_app_password
    
    # Cloudinary
    CLOUDINARY_CLOUD_NAME=your_cloud_name
    CLOUDINARY_API_KEY=your_api_key
    CLOUDINARY_API_SECRET=your_api_secret
    
    # Frontend URL
    FRONTEND_URL=http://localhost:3000
  4. Start the development servers

    Frontend:

    cd client
    npm run dev

    Backend:

    cd server
    npm run dev
  5. Seed the database (optional)

    cd server
    npm run seed-full
  6. Open in your browser

    • Frontend: http://localhost:3000
    • Backend API: http://localhost:5000/api

๐Ÿ”Œ API Overview

๐Ÿ”— Complete API Endpoints Reference (Click to expand)

Core Endpoints Implemented

๐Ÿ” Authentication
POST   /api/users/register          - User registration with email verification
POST   /api/users/login             - JWT-based authentication
GET    /api/users/profile           - Get user profile
PUT    /api/users/profile           - Update user profile

๐Ÿ“ Issue Management  
GET    /api/issues                  - List issues with geospatial filtering
POST   /api/issues                  - Create new issue with location
GET    /api/issues/:id              - Get detailed issue information
PUT    /api/issues/:id              - Update issue (owner/admin only)
DELETE /api/issues/:id              - Delete issue (owner/admin only)
PUT    /api/issues/:id/upvote       - Upvote issue
GET    /api/issues/nearby           - Find nearby issues with radius

๐Ÿšฉ Community Moderation
POST   /api/flags/issues/:id/flag   - Flag inappropriate content
GET    /api/flags/admin             - Admin flag review (admin only)
PUT    /api/flags/admin/:id/review  - Review flagged content (admin only)

๐Ÿ“ง Email System
POST   /api/email/send-verification - Send email verification
POST   /api/email/verify            - Verify email address
POST   /api/email/forgot-password   - Password reset request
POST   /api/email/reset-password    - Reset password with token

๐Ÿ“Š Analytics & Statistics
GET    /api/statistics/dashboard    - Admin dashboard stats
GET    /api/statistics/trends       - Trend analysis data
GET    /api/statistics/location     - Location-based statistics
GET    /api/statistics/user         - User activity statistics

โ˜๏ธ File Management
POST   /api/upload/single           - Upload single image
POST   /api/upload/multiple         - Upload multiple images (max 5)
DELETE /api/upload/:publicId        - Delete uploaded image

๐Ÿ“š Complete API Documentation - 200+ test cases included

๐ŸŒ Deployment Links

โœจ Key Features

๐Ÿ›๏ธ Current Implementation Status: PRODUCTION READY (Click to expand)

๐Ÿ–ฅ๏ธ Frontend Application

  • โœ… Modern React SPA with TypeScript and Vite
  • โœ… Responsive Dashboard with issue filtering and statistics
  • โœ… Interactive Map Integration with OpenStreetMap
  • โœ… Secure Authentication with Firebase Auth
  • โœ… Admin Panel with role-based access control
  • โœ… Real-time Issue Tracking with status updates

๐Ÿ“ Issue Management System

  • โœ… Comprehensive Reporting Form with validation
  • โœ… Multiple Image Upload with Cloudinary integration
  • โœ… Geolocation Detection with manual override
  • โœ… Anonymous Reporting option for sensitive issues
  • โœ… Category-based Organization (9 predefined categories)
  • โœ… Issue Upvoting and community engagement

๏ฟฝ Security & Performance

  • โœ… Production-grade Security with XSS protection
  • โœ… Input Sanitization across all forms
  • โœ… Secure Token Storage with base64 encoding
  • โœ… Content Security Policy headers
  • โœ… Rate Limiting and CORS protection
  • โœ… Audit Logging with sensitive data filtering

๐Ÿ—„๏ธ Backend API (Full-Stack)

  • โœ… Complete REST API with 40+ endpoints
  • โœ… MongoDB Integration with geospatial indexing
  • โœ… Email System with verification and notifications
  • โœ… File Upload Service with image optimization
  • โœ… Flagging System for community moderation
  • โœ… Analytics Dashboard with trend analysis

๐Ÿ“ธ Application Screenshots

๐Ÿ–ฅ๏ธ Production Application Interface

๐Ÿ  Landing Page ๐Ÿ“Š Dashboard ๐Ÿ“ Report Issue
Home Dashboard Report
Modern landing with authentication Interactive dashboard with filtering Comprehensive reporting form
๐Ÿ” Issue Details ๐Ÿ—บ๏ธ Map Integration ๐Ÿ‘‘ Admin Panel
Details Map Admin
Detailed issue view with actions OpenStreetMap with location pins Admin dashboard

๐ŸŽฏ Key Visual Features

  • ๐Ÿ“ฑ Mobile-First Responsive Design - Works seamlessly across all devices
  • ๐ŸŽจ Modern UI/UX - Clean, intuitive interface with Tailwind CSS
  • ๐Ÿ—บ๏ธ Interactive Maps - Real-time location plotting with custom markers
  • ๐Ÿ“Š Data Visualization - Charts and statistics for civic insights
  • ๐Ÿ” Secure Authentication - Firebase-powered login with role management
  • ๐ŸŒ™ Accessibility Ready - Prepared for dark mode and screen readers

๐Ÿš€ Future Scope & USPs

๐ŸŽฏ Our Unique Selling Propositions (USPs) (Click to expand)

๐Ÿ˜๏ธ USP 1: "Hyperlocal Verified Community Action"

  • Community-Driven Verification: Multi-tier citizen verification system (email, phone, ID document, biometric)
  • Neighborhood-Specific Insights: Hyperlocal analytics and trending issues within specific areas
  • Verified Reporter Badge System: Trust levels based on successful report verification
  • Community Moderation: Citizen-led flagging and review system for accurate reporting
  • Local Government Integration: Direct municipal worker assignment and response tracking

๐Ÿ“ USP 2: "Report. Locate. React: Real-time Geo-Aware Incident Tracking"

  • Instant Geospatial Intelligence: Advanced location-based issue discovery and clustering
  • Real-time Status Broadcasting: Live updates on issue resolution progress with push notifications
  • Predictive Issue Mapping: AI-powered hotspot prediction based on historical data
  • Multi-Modal Reporting: Voice-to-text, image recognition, and quick-tap category selection
  • Emergency Response Integration: Priority routing for critical infrastructure issues
๐Ÿ”ฎ Planned Enhancements (Click to expand)
  • ๐Ÿค– AI-Powered Issue Categorization with image recognition
  • ๐Ÿ“ฑ Progressive Web App (PWA) for offline reporting
  • ๐Ÿ”” Smart Notification System with SMS/Email/Push integration
  • ๐ŸŽฎ Gamification & Civic Rewards for active community members
  • ๐Ÿ“Š Advanced Predictive Analytics for municipal planning
  • ๐ŸŒ Multi-language Support for diverse communities
  • ๐Ÿšจ Emergency Response Integration with local authorities
  • ๐Ÿ† Civic Engagement Leaderboards and community recognition

๐Ÿ™ Acknowledgements

๐ŸŒŸ Technology Partners & Special Thanks (Click to expand)
  • ๐Ÿ”ฅ Clerk for seamless authentication and real-time features
  • ๐ŸŽจ Tailwind CSS for beautiful, responsive styling
  • ๐ŸŽฏ React Icons for comprehensive icon library
  • โšก Vite for lightning-fast development experience
  • ๐Ÿ—„๏ธ MongoDB for flexible, scalable data storage
  • โ˜๏ธ Cloudinary for intelligent media management
  • ๐Ÿ—บ๏ธ OpenStreetMap for open-source mapping solutions
  • ๐Ÿ† Odoo x CGC Hackathon 2025 for this incredible opportunity to innovate

๐ŸŒŸ Special Thanks

  • Open Source Community for the amazing tools and libraries
  • Municipal Technology Partners for inspiration and civic engagement insights
  • Beta Testers who helped us identify and resolve critical issues

๐Ÿ“œ License

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

๐Ÿค Contributing

๐Ÿ”„ Development Workflow & Contribution Guidelines (Click to expand)

We welcome contributions from the community! Here's how you can help:

๐Ÿ”„ Development Workflow

  1. Fork the repository and create your feature branch
  2. Follow our coding standards: TypeScript, ESLint, Prettier
  3. Write comprehensive tests for new features
  4. Update documentation for any API changes
  5. Submit a pull request with detailed description

๐Ÿ› Reporting Issues

  • Use our issue reporting system to report bugs in the actual app
  • For development issues, create a GitHub issue with:
    • Clear problem description
    • Steps to reproduce
    • Expected vs actual behavior
    • Screenshots if applicable

๐Ÿ’ก Feature Requests

  • Check existing issues before creating new ones
  • Provide detailed use cases and user stories
  • Consider civic engagement best practices

๐ŸŒŸ Star us on GitHub if CivicTrack helps your community! ๐ŸŒŸ

Together, we're building stronger, more connected communities


footer

About

Community Reporting Platform

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages