Skip to content

Butwal-Hacks/Team-Nexus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Team-Nexus

Sanket - Community Issue Reporting Platform

πŸ“Ί Video Demo: https://drive.google.com/file/d/1dSckmA7L9jk7Mi8yuiNkYuucIlfMpUNy/view
πŸ“Š Presentation: https://www.canva.com/design/DAG5QKm85xA/5BiWu2bSbC-JSU7VHmF7-A/edit

A full-stack Progressive Web Application (PWA) for municipal issue reporting and management, enabling citizens to report and track civic problems while providing administrators with powerful tools for efficient resolution and resource allocation.

🌟 Features

For Citizens

  • Issue Reporting: Report civic issues with photos, location, and detailed descriptions
  • AI-Powered Descriptions: Automatic issue description enhancement using Google Gemini AI
  • Anonymous Reporting: Option to report issues anonymously
  • Real-time Updates: Get notifications on issue status changes
  • Upvoting System: Support important issues by upvoting
  • Comments & Discussions: Engage in community discussions on reported issues
  • Heatmap Visualization: View geographic distribution of issues
  • Leaderboard: Track top contributors to the community
  • Multilingual Support: Available in English and Nepali (i18n)
  • Offline Support: PWA with service worker for offline functionality
  • User Profiles: Track your reported issues and contributions

For Administrators

  • Admin Dashboard: Comprehensive overview of all reported issues
  • Issue Management: Update status, priority, and assign to categories
  • Budget Tracking: Allocate and track budgets for issue resolution
  • Timeline Management: Create and manage resolution timelines
  • Evidence Uploads: Add before/after photos and evidence documentation
  • Advanced Analytics: Statistical insights and prediction dashboards
  • Priority Management: AI-powered priority calculation and manual override
  • Review System: Review and approve/reject reported issues
  • PDF Reports: Generate detailed PDF reports for issues
  • QR Code Generation: Create QR codes for easy issue tracking
  • Push Notifications: Send notifications to users about issue updates

πŸ—οΈ Tech Stack

Frontend

  • React 19.2 - Modern UI library
  • Vite - Fast build tool and dev server
  • React Router v7 - Client-side routing
  • TanStack Query - Server state management
  • Tailwind CSS v4 - Utility-first CSS framework
  • Leaflet - Interactive maps with heatmap support
  • Recharts - Data visualization
  • Lucide React - Icon library
  • i18next - Internationalization
  • Lottie React - Animation support
  • Axios - HTTP client

Backend

  • Node.js & Express - Server framework
  • MongoDB & Mongoose - Database and ODM
  • JWT - Authentication
  • bcryptjs - Password hashing
  • Cloudinary - Image storage and management
  • Multer - File upload handling
  • Google Generative AI - AI-powered features
  • PDFKit - PDF generation
  • QRCode - QR code generation
  • Nodemailer - Email notifications
  • Twilio - SMS notifications (optional)
  • Web Push - Push notification support

πŸ“‹ Prerequisites

  • Node.js (v16 or higher)
  • MongoDB (local or Atlas)
  • npm or yarn package manager
  • Cloudinary account (for image uploads)
  • Google AI API key (for Gemini AI features)

πŸš€ Installation

1. Clone the Repository

git clone <repository-url>
cd Final

2. Server Setup

cd server
npm install

Create a .env file in the server directory:

PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key

# Cloudinary
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret

# Google AI
GEMINI_API_KEY=your_gemini_api_key

# Email (Optional)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_email_password

# Twilio (Optional)
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_PHONE_NUMBER=your_twilio_phone_number

# Push Notifications
VAPID_PUBLIC_KEY=your_vapid_public_key
VAPID_PRIVATE_KEY=your_vapid_private_key

3. Client Setup

cd ../client
npm install

Create a .env file in the client directory:

VITE_API_URL=http://localhost:5000
VITE_GOOGLE_CLIENT_ID=your_google_oauth_client_id

4. Create Admin User

cd ../server
node scripts/createAdmin.js

πŸƒ Running the Application

Development Mode

Terminal 1 - Start the Backend:

cd server
npm run dev

Server will run on http://localhost:5000

Terminal 2 - Start the Frontend:

cd client
npm run dev

Client will run on http://localhost:5173

Production Mode

Build the Client:

cd client
npm run build

Start the Server:

cd ../server
npm start

πŸ“ Project Structure

Final/
β”œβ”€β”€ client/                  # React frontend application
β”‚   β”œβ”€β”€ public/             # Static assets
β”‚   β”‚   β”œβ”€β”€ hero.json       # Lottie animation
β”‚   β”‚   β”œβ”€β”€ manifest.json   # PWA manifest
β”‚   β”‚   └── sw.js           # Service worker
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ api/            # API service functions
β”‚   β”‚   β”œβ”€β”€ assets/         # Images and static files
β”‚   β”‚   β”œβ”€β”€ components/     # Reusable React components
β”‚   β”‚   β”œβ”€β”€ context/        # React context providers
β”‚   β”‚   β”œβ”€β”€ data/           # Static data files
β”‚   β”‚   β”œβ”€β”€ hooks/          # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ locales/        # Translation files (en, np)
β”‚   β”‚   β”œβ”€β”€ pages/          # Page components
β”‚   β”‚   β”œβ”€β”€ router/         # Route configuration
β”‚   β”‚   β”œβ”€β”€ styles/         # CSS files
β”‚   β”‚   β”œβ”€β”€ utils/          # Utility functions
β”‚   β”‚   β”œβ”€β”€ App.jsx         # Main app component
β”‚   β”‚   β”œβ”€β”€ i18n.js         # i18n configuration
β”‚   β”‚   └── main.jsx        # App entry point
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ tailwind.config.ts
β”‚   └── vite.config.js
β”‚
└── server/                  # Node.js backend application
    β”œβ”€β”€ config/             # Configuration files
    β”‚   β”œβ”€β”€ cloudinary.js   # Cloudinary setup
    β”‚   β”œβ”€β”€ db.js           # MongoDB connection
    β”‚   └── gemini.js       # Google AI setup
    β”œβ”€β”€ controllers/        # Request handlers
    β”‚   β”œβ”€β”€ adminController.js
    β”‚   β”œβ”€β”€ aiController.js
    β”‚   β”œβ”€β”€ authController.js
    β”‚   β”œβ”€β”€ budgetController.js
    β”‚   β”œβ”€β”€ commentController.js
    β”‚   β”œβ”€β”€ evidenceController.js
    β”‚   β”œβ”€β”€ issueController.js
    β”‚   β”œβ”€β”€ notificationController.js
    β”‚   β”œβ”€β”€ pdfController.js
    β”‚   β”œβ”€β”€ predictionController.js
    β”‚   β”œβ”€β”€ priorityController.js
    β”‚   β”œβ”€β”€ reviewController.js
    β”‚   β”œβ”€β”€ timelineController.js
    β”‚   └── upvoteController.js
    β”œβ”€β”€ middleware/         # Express middleware
    β”‚   β”œβ”€β”€ adminMiddleware.js
    β”‚   └── authMiddleware.js
    β”œβ”€β”€ models/             # Mongoose schemas
    β”‚   β”œβ”€β”€ BeforeAfter.js
    β”‚   β”œβ”€β”€ Budget.js
    β”‚   β”œβ”€β”€ Comment.js
    β”‚   β”œβ”€β”€ Issue.js
    β”‚   β”œβ”€β”€ IssueEvidence.js
    β”‚   β”œβ”€β”€ IssueHistory.js
    β”‚   β”œβ”€β”€ Notification.js
    β”‚   β”œβ”€β”€ OfflineIssue.js
    β”‚   β”œβ”€β”€ PushSubscription.js
    β”‚   β”œβ”€β”€ Review.js
    β”‚   β”œβ”€β”€ Upvote.js
    β”‚   └── User.js
    β”œβ”€β”€ routes/             # API routes
    β”‚   β”œβ”€β”€ adminRoutes.js
    β”‚   β”œβ”€β”€ authRoutes.js
    β”‚   β”œβ”€β”€ budgetRoutes.js
    β”‚   β”œβ”€β”€ commentRoutes.js
    β”‚   β”œβ”€β”€ evidenceRoutes.js
    β”‚   β”œβ”€β”€ issueRoutes.js
    β”‚   β”œβ”€β”€ notificationRoutes.js
    β”‚   β”œβ”€β”€ predictionRoutes.js
    β”‚   β”œβ”€β”€ priorityRoutes.js
    β”‚   β”œβ”€β”€ pushRoutes.js
    β”‚   β”œβ”€β”€ reviewRoutes.js
    β”‚   β”œβ”€β”€ timelineRoutes.js
    β”‚   β”œβ”€β”€ upvoteRoutes.js
    β”‚   └── userRoutes.js
    β”œβ”€β”€ scripts/            # Utility scripts
    β”‚   β”œβ”€β”€ createAdmin.js  # Create admin user
    β”‚   └── setAdmin.js     # Set existing user as admin
    β”œβ”€β”€ uploads/            # Uploaded files storage
    β”œβ”€β”€ utils/              # Helper functions
    β”œβ”€β”€ package.json
    └── server.js           # Server entry point

πŸ”‘ Key Functionalities

Authentication & Authorization

  • JWT-based authentication
  • Role-based access control (User/Admin)
  • Google OAuth integration
  • Secure password hashing

Issue Management

  • CRUD operations for issues
  • Image upload with Cloudinary
  • Location tracking with coordinates
  • Category and ward classification
  • Severity levels
  • Status tracking (pending, in-progress, resolved, rejected)

AI Integration

  • Automatic issue description enhancement
  • Priority prediction algorithms
  • Intelligent categorization

Real-time Features

  • Push notifications for status updates
  • Real-time comment updates
  • Notification system

Data Visualization

  • Geographic heatmap of issues
  • Statistical dashboards
  • Charts and graphs for analytics
  • Prediction insights

Offline Capability

  • Service worker implementation
  • Offline issue storage
  • Background sync when online

🌐 API Endpoints

Authentication

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

Issues

  • GET /api/issues - Get all issues
  • GET /api/issues/:id - Get single issue
  • POST /api/issues - Create new issue
  • PUT /api/issues/:id - Update issue
  • DELETE /api/issues/:id - Delete issue

Admin

  • GET /api/admin/dashboard - Get dashboard data
  • GET /api/admin/issues - Get all issues (admin view)
  • PUT /api/admin/issues/:id - Update issue status
  • GET /api/admin/statistics - Get statistics

Comments

  • GET /api/comments/issue/:id - Get issue comments
  • POST /api/comments - Add comment
  • DELETE /api/comments/:id - Delete comment

Upvotes

  • POST /api/upvotes/:id - Toggle upvote
  • GET /api/upvotes/:id - Get upvote status

Reviews

  • POST /api/reviews/:id - Submit review
  • GET /api/reviews/:id - Get reviews

Budget

  • POST /api/budget/:id - Add budget
  • GET /api/budget/:id - Get budget details

Timeline

  • POST /api/timeline/:id - Add timeline entry
  • GET /api/timeline/:id - Get timeline

Evidence

  • POST /api/evidence/:id - Upload evidence
  • GET /api/evidence/:id - Get evidence

Priority

  • GET /api/priority/:id - Get priority score
  • PUT /api/priority/:id - Update priority

Predictions

  • GET /api/predictions - Get prediction analytics

Notifications

  • GET /api/notifications - Get user notifications
  • PUT /api/notifications/:id/read - Mark as read
  • POST /api/notifications/subscribe - Subscribe to push notifications

πŸ›‘οΈ Security Features

  • JWT token-based authentication
  • Password encryption with bcryptjs
  • Protected routes with middleware
  • Input validation and sanitization
  • CORS configuration
  • Secure file upload handling

πŸ“± Progressive Web App (PWA)

The application is a fully functional PWA with:

  • Offline support
  • Service worker caching
  • App manifest for installation
  • Responsive design
  • Push notification support

🌍 Internationalization

The app supports multiple languages:

  • English (en)
  • Nepali (np)

Language can be switched from the user interface.

🀝 Contributing

  1. Fork the repository
  2. Create your 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.

πŸ‘₯ Team

Team Nexus

πŸ“ž Support

For support, please contact the development team or open an issue in the repository.

πŸ™ Acknowledgments

  • Google Generative AI for AI-powered features
  • Cloudinary for image management
  • MongoDB Atlas for database hosting
  • The open-source community for amazing tools and libraries

Built with ❀️ by Team Nexus

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages