CivicPulse is a citizen-driven, civic engagement platform that empowers communities to report and resolve local infrastructure issues. Built with modern technologies (MERN stack), it enables seamless communication between citizens and local government authorities.
- πΈ Photo Reports - Upload photos of issues to provide evidence and help authorities understand problems
- πΊοΈ Interactive Map - Visualize all reported issues on an interactive Leaflet map with filters
- π Status Tracking - Track issues from open β in-progress β resolved/rejected
- π Upvote System - Community voting to prioritize issues by importance
- β‘ AI-Powered Descriptions - AI assistant to improve issue descriptions
- π¬ Smart Chat Widget - Built-in AI support chatbot for user assistance
- π Admin Dashboard - Comprehensive dashboard for administrators to manage and prioritize issues
- π Role-Based Access - Separate experiences for citizens and administrators
- π Geolocation - Mark exact locations of issues and find nearby problems
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CivicPulse β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββββββ ββββββββββββββββββββ β
β β React Frontend β β Express Backend β β
β β (Port 3000) β β (Port 5000) β β
β ββββββββββββββββββββ ββββββββββββββββββββ β
β β β β
β ββ Redux Toolkit State βββ ββ MongoDB (Issues) β
β ββ React Router β ββ MongoDB (Users) β
β ββ Framer Motion Anim β ββ JWT Auth β
β ββ Leaflet Maps β ββ Cloudinary (Images)
β ββ Tailwind CSS β ββ Google Gemini API β
β ββ Axios HTTP Client ββ CORS Enabled ββββββββββ
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
CivicPulse/
βββ client/ # React Frontend (Port 3000)
β βββ public/
β βββ src/
β β βββ api/
β β β βββ axiosInstance.js # Axios config with JWT interceptors
β β βββ components/
β β β βββ Navbar.jsx # Navigation with user auth menu
β β β βββ IssueCard.jsx # Reusable issue display component
β β β βββ IssuePopupCard.jsx # Popup card for map markers
β β β βββ ProtectedRoute.jsx # Auth guard for protected pages
β β β βββ StatusBadge.jsx # Status indicator badge
β β β βββ AiChatWidget.jsx # AI support chatbot
β β β βββ AiDescriptionImprover.jsx # AI description enhancement
β β βββ pages/
β β β βββ Home.jsx # Landing/home page
β β β βββ Login.jsx # User login
β β β βββ Register.jsx # User registration
β β β βββ ReportIssue.jsx # Issue reporting form
β β β βββ MapPage.jsx # Interactive map view
β β β βββ IssueDetail.jsx # Detailed issue view
β β β βββ MyIssues.jsx # User's reported issues
β β β βββ AdminDashboard.jsx # Admin control panel
β β β βββ AdminIssueDetail.jsx # Admin issue details
β β βββ store/ # Redux Toolkit State Management
β β β βββ store.js # Redux store config
β β β βββ hooks.js # useAppDispatch & useAppSelector
β β β βββ slices/
β β β β βββ authSlice.js # Authentication state
β β β β βββ issuesSlice.js # Issues state & thunks
β β β β βββ adminSlice.js # Admin stats state
β β β β βββ filterSlice.js # Map filter state
β β β β βββ uiSlice.js # UI state
β β β βββ useLogout.js # Logout hook
β β βββ App.jsx # Main app component
β β βββ index.js # React DOM render
β β βββ index.css # Global styles
β β βββ tailwind.config.js # Tailwind CSS config
β βββ package.json
β βββ .env.local (configure REACT_APP_API_URL)
β
βββ server/ # Express Backend (Port 5000)
βββ controllers/
β βββ authController.js # Login/Register endpoints
β βββ issueController.js # Issue CRUD operations
β βββ adminController.js # Admin operations + AI priority scoring
βββ models/
β βββ User.js # MongoDB User schema
β βββ Issue.js # MongoDB Issue schema
βββ routes/
β βββ auth.js # /api/auth routes
β βββ issues.js # /api/issues routes
β βββ admin.js # /api/admin routes
β βββ ai.js # /api/ai routes (Gemini chat + improve)
βββ middleware/
β βββ authMiddleware.js # JWT verification
β βββ uploadMiddleware.js # Multer image upload config
βββ utils/
β βββ cloudinary.js # Cloudinary image upload
β βββ sendEmail.js # Email notifications
βββ server.js # Express server entry point
βββ package.json
βββ .env (configure DB, API keys)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User Action β
βββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββ
β React Component β
β (e.g., ReportIssue.jsx) β
βββββββββββββββββ¬ββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββ
β Redux Slice Thunk β
β (e.g., createIssue) β
βββββββββββββββββ¬ββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββ
β Axios Request with JWT β
β (axiosInstance) β
βββββββββββββββββ¬ββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββ
β Express API Endpoint β
β /api/issues (POST) β
βββββββββββββββββ¬ββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββ
β Auth Middleware β
β (Verify JWT Token) β
βββββββββββββββββ¬ββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββ
β Controller β
β (issueController.js) β
βββββββββββββββββ¬ββββββββββββββββ
β
βββββββββ΄ββββββββ
β β
βΌ βΌ
ββββββββββββββββ ββββββββββββββββ
β Cloudinary β β MongoDB β
β (Images) β β (Data) β
ββββββββββββββββ ββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User Registration/Login β
ββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββ
β Frontend: /register or /login β
ββββββββββ¬ββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββ
β POST /api/auth/register β
β or /api/auth/login β
ββββββββββ¬ββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββ
β Backend: authController β
β - Validate credentials β
β - Hash password (bcryptjs) β
β - Create JWT token β
ββββββββββ¬ββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββ
β Return: { token, user } β
ββββββββββ¬ββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββ
β Store in localStorage & Redux β
β setAxiosStore() configures auth β
ββββββββββ¬ββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββ
β All Future Requests Include JWT β
β Header: Authorization: Bearer... β
ββββββββββββββββββββββββββββββββββββββ
- React 18 - UI library with hooks
- Redux Toolkit - State management
- React Router v6 - Client-side routing
- Tailwind CSS - Utility-first styling
- Framer Motion - Smooth animations
- Leaflet & React-Leaflet - Interactive maps
- Axios - HTTP client with interceptors
- React Dropzone - File upload handling
- Express.js - Web framework
- MongoDB - NoSQL database
- Mongoose - ODM for MongoDB
- JWT (jsonwebtoken) - Authentication
- bcryptjs - Password hashing
- Multer - File upload middleware
- Cloudinary - Cloud image storage
- CORS - Cross-origin requests
- Google Generative AI (Gemini) - AI integration
- dotenv - Environment variables
- React Dropzone - File drop zones
- React Leaflet - Map integration
{
_id: ObjectId,
name: String,
email: String (unique, lowercase),
passwordHash: String,
role: String ("citizen" | "admin"),
createdAt: Date
}{
_id: ObjectId,
title: String,
description: String,
category: String ("Potholes" | "Streetlights" | "Garbage" | ...),
status: String ("open" | "in-progress" | "resolved" | "rejected"),
location: {
type: "Point",
coordinates: [longitude, latitude]
},
imageUrls: [String],
reportedBy: ObjectId (ref: User),
upvotes: [ObjectId] (ref: User),
priorityScore: Number (0-10),
priorityLevel: String ("Critical" | "High" | "Medium" | "Low"),
priorityReason: String,
priorityCalculatedAt: Date,
createdAt: Date
}POST /api/auth/register - Register new user
POST /api/auth/login - User login
GET /api/auth/profile - Get logged-in user profile
GET /api/issues - Get all issues (with filters)
GET /api/issues/nearby - Get issues near coordinates
GET /api/issues/my - Get user's reported issues
GET /api/issues/:id - Get issue details
POST /api/issues - Create new issue
DELETE /api/issues/:id - Delete issue (by reporter)
PATCH /api/issues/:id/upvote - Upvote/downvote issue
GET /api/admin/issues - Get all issues (admin view)
GET /api/admin/stats - Get dashboard statistics
PATCH /api/admin/issues/:id/status - Update issue status
POST /api/admin/calculate-priorities - Calculate priority scores
POST /api/ai/improve - Improve issue description with AI
POST /api/ai/chat - Chat with AI support bot
- Node.js (v14+)
- MongoDB (local or Atlas)
- Cloudinary account (for image uploads)
- Google Gemini API key (for AI features)
cd server
npm install
# Create .env file
cat > .env << EOF
MONGODB_URI=mongodb://localhost:27017/civicpulse
PORT=5000
JWT_SECRET=your_jwt_secret_key
CLOUDINARY_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
GEMINI_API_KEY=your_gemini_api_key
FRONTEND_URL=http://localhost:3000
NODE_ENV=development
EOF
npm startcd client
npm install
# Create .env.local file
echo "REACT_APP_API_URL=http://localhost:5000/api" > .env.local
npm startVisit: http://localhost:3000
- Report issues with photos and location
- View all issues on interactive map
- Upvote issues to prioritize them
- Track their reported issues
- Filter issues by category and status
- Use AI chatbot for support
- View all reported issues
- Update issue status (open β in-progress β resolved/rejected)
- Calculate priority scores based on upvotes and reports
- View dashboard statistics
- Manage and prioritize issues efficiently
- JWT-based authentication with tokens stored in localStorage
- Password hashing with bcryptjs (10-salt rounds)
- Protected routes with ProtectedRoute component
- Axios interceptors for automatic token injection
- CORS configuration for cross-origin requests
- CORS configured to allow only the trusted frontend origin
- Environment variables for sensitive data
- Role-based access control (citizen vs admin)
- Mobile-first approach with Tailwind CSS
- Responsive breakpoints: sm (640px), md (768px), lg (1024px)
- Mobile-optimized navigation with hamburger menu
- Touch-friendly buttons and interactions
- Optimized image loading and caching
- Smooth animations with Framer Motion
- Interactive Leaflet map with dynamic markers
- Progress indicators and loading states
- Form validation with error messages
- Toast notifications for user feedback
- Dark mode ready (color system in place)
- Accessible components (aria-labels, keyboard navigation)
REACT_APP_API_URL=http://localhost:5000/api
MONGODB_URI=mongodb://...
PORT=5000
JWT_SECRET=your_secret_key
CLOUDINARY_NAME=...
CLOUDINARY_API_KEY=...
CLOUDINARY_API_SECRET=...
GEMINI_API_KEY=...
FRONTEND_URL=http://localhost:3000
NODE_ENV=development
- react, react-dom
- react-redux, @reduxjs/toolkit
- react-router-dom
- leaflet, react-leaflet
- framer-motion
- tailwindcss, postcss
- axios
- react-dropzone
- express
- mongodb, mongoose
- jsonwebtoken, bcryptjs
- multer, cloudinary
- cors
- dotenv
- @google/generative-ai (Gemini)
- nodemailer (status-update emails)
- express-validator
npm run build
# Deploy the 'build' foldergit push heroku mainUpdate FRONTEND_URL in backend environment variables to your deployed frontend URL.
{
"success": true,
"data": { ... },
"message": "Operation successful"
}{
"success": false,
"error": "Error message",
"status": 400
}- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
CivicPulse connects citizens and local governments through technology, enabling communities to report and resolve infrastructure issues collaboratively.
Tech Stack: MERN (MongoDB, Express, React, Node.js) with Redux Toolkit, Leaflet Maps, Tailwind CSS, and Google Gemini AI Integration
Status: Production Ready β
- Real-time notifications via WebSockets
- Advanced analytics dashboard
- Multi-language support
- Mobile app (React Native)
- Payment integration for donations
- Community badges and gamification
- Social media sharing
- Advanced search and filters
Built with β€οΈ by Priyanshu for better cities and communities