A modern, responsive web application that empowers citizens to report and track public infrastructure issues, helping communities build better cities together.
Live Demo β’ Report Bug β’ Request Feature
- About The Project
- Key Features
- Tech Stack
- Getting Started
- Project Structure
- User Roles & Permissions
- Authentication Flow
- API Integration
- Deployment
- Contributing
- Troubleshooting
- License
- Contact
PIIRS (Public Infrastructure Issue Reporting System) is a comprehensive web application designed to streamline the process of reporting, tracking, and resolving public infrastructure issues. The platform connects citizens with municipal staff and administrators to create a transparent and efficient problem-solving ecosystem.
- Citizen Empowerment: Enable residents to easily report infrastructure problems in their community
- Transparency: Track the status and progress of reported issues in real-time
- Efficiency: Streamline communication between citizens and municipal authorities
- Accountability: Role-based dashboards for citizens, staff, and administrators
- Community Impact: Foster civic engagement and improve urban living conditions
- π Secure Authentication - Firebase-powered user authentication with Google Sign-In
- π Report Issues - Submit detailed reports with descriptions, categories, and images
- π Personal Dashboard - Track all your submitted issues in one place
- π€ Profile Management - Update personal information and preferences
- π Issue Tracking - Monitor the status and resolution progress of your reports
- π Assigned Issues - View and manage issues assigned to you
- β Update Status - Mark issues as in-progress or resolved
- π Staff Dashboard - Dedicated workspace for efficient issue management
- π₯ User Management - Manage citizens and staff members
- π All Issues Overview - Comprehensive view of all reported issues
- π§ Staff Assignment - Assign issues to appropriate staff members
- π Analytics Dashboard - Monitor system-wide metrics and trends
- π¨ Modern UI/UX - Clean, responsive design with Tailwind CSS and DaisyUI
- π Responsive Design - Seamless experience across desktop, tablet, and mobile devices
- β‘ Fast Performance - Optimized with Vite for lightning-fast development and builds
- π Role-Based Access Control - Secure routes with custom authentication guards
- π± Progressive Web App - Installable as a native-like app
- React 19.2.0 - Modern React with latest features
- Vite 7.2.4 - Next-generation frontend tooling
- React Router 7.10.1 - Declarative routing for React applications
- Tailwind CSS 4.1.17 - Utility-first CSS framework
- DaisyUI 5.5.8 - Tailwind CSS component library
- React Icons 5.5.0 - Popular icon library
- TanStack React Query 5.90.12 - Powerful data synchronization
- Axios 1.13.2 - Promise-based HTTP client
- React Hook Form 7.68.0 - Performant form validation
- Firebase 12.6.0 - Authentication and hosting
- Custom Axios Interceptors - Secure API communication
- React Toastify 11.0.5 - Toast notifications
- React Responsive Carousel 3.2.23 - Image carousels
- React Awesome Slider 4.1.0 - Touch-friendly sliders
Ensure you have the following installed:
- Node.js (v18 or higher)
- npm or yarn package manager
- Git for version control
- Firebase Account for authentication services
- Backend API running or deployed
- Clone the repository
git clone https://github.com/jihanurrahman33/PIIRS_CLIENT.git
cd PIIRS_CLIENT- Install dependencies
npm install
# or
yarn installCreate a .env file in the root 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
# Backend API URL
VITE_API_BASE_URL=https://your-backend-api.com/api
# Image Hosting (if applicable)
VITE_IMAGE_HOSTING_KEY=your_imgbb_api_key
β οΈ Security Note: Never commit your.envfile. Keep all sensitive credentials secure and use environment-specific configurations for production.
Development Mode
npm run devThe application will open at http://localhost:5173
Production Build
npm run buildPreview Production Build
npm run previewLinting
npm run lintPIIRS_CLIENT/
βββ public/ # Static assets
βββ src/
β βββ assets/ # Images, icons, media files
β βββ auth/ # Route protection components
β β βββ AdminRoute.jsx # Admin-only route guard
β β βββ PrivateRoute.jsx # Authenticated user guard
β β βββ StaffRoute.jsx # Staff-only route guard
β βββ components/ # Reusable UI components
β β βββ Footer/
β β βββ IssueCard/
β β βββ IssueDetails/
β β βββ Loading/
β β βββ Logo/
β β βββ NavBar/
β βββ contexts/ # React Context providers
β β βββ AuthContext/ # Authentication context
β βββ firebase/ # Firebase configuration
β β βββ firebase.config.js
β βββ hooks/ # Custom React hooks
β β βββ useAuth.jsx # Authentication hook
β β βββ useAxios.jsx # Axios instance hook
β β βββ useAxiosSecure.jsx # Secure Axios with auth
β β βββ useRole.jsx # User role management
β β βββ useUser.jsx # Current user data
β βββ layouts/ # Layout components
β β βββ DashBoardLayout.jsx
β β βββ MainLayout.jsx
β βββ pages/ # Page components
β β βββ About/
β β βββ Auth/ # Login, Register, etc.
β β βββ Contact/
β β βββ Dashboard/
β β β βββ Admin/ # Admin dashboard pages
β β β βββ Citizen/ # Citizen dashboard pages
β β β βββ Staff/ # Staff dashboard pages
β β βββ Error/
β β βββ Home/ # Landing page components
β β βββ Issues/ # Browse issues
β β βββ ReportIssue/ # Issue submission form
β βββ router/ # Application routing
β β βββ router.jsx
β βββ App.jsx # Root component
β βββ App.css # Global styles
β βββ index.css # Base CSS
β βββ main.jsx # Application entry point
βββ .env # Environment variables (not in git)
βββ eslint.config.js # ESLint configuration
βββ firebase.json # Firebase hosting config
βββ index.html # HTML entry point
βββ package.json # Project dependencies
βββ README.md # Project documentation
βββ vite.config.js # Vite configuration
- Register and create an account
- Report new infrastructure issues
- View and track personal issues
- Update profile information
- Access citizen dashboard
- View assigned issues
- Update issue status (pending β in-progress β resolved)
- Manage workload through staff dashboard
- All citizen permissions
- Manage all users (citizens and staff)
- View all reported issues
- Assign issues to staff members
- Promote citizens to staff role
- Access comprehensive analytics
- All staff and citizen permissions
// 1. User Login
User β Firebase Auth β ID Token Generated
// 2. Token Attachment
const token = await currentUser.getIdToken();
config.headers.Authorization = `Bearer ${token}`;
// 3. API Request
Frontend (with token) β Backend API
// 4. Token Verification
Backend β Verify Firebase Token β Fetch User Data β Return Response
// 5. Authorization Check
Backend checks user role β Grant/Deny access based on permissions// Automatic token attachment to all requests
const axiosSecure = useAxiosSecure();
// Example usage
const response = await axiosSecure.get('/users/me');
const issues = await axiosSecure.get('/issues');// Citizen Route
<Route element={<PrivateRoute />}>
<Route path="/dashboard" element={<CitizenDashboard />} />
</Route>
// Staff Route
<Route element={<StaffRoute />}>
<Route path="/staff/assigned" element={<AssignedIssues />} />
</Route>
// Admin Route
<Route element={<AdminRoute />}>
<Route path="/admin/users" element={<ManageUsers />} />
</Route>const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| User Management | |||
GET |
/users/me |
Fetch current user profile | β |
GET |
/users |
Get all users (admin) | β Admin |
POST |
/users |
Create/update user | β |
PATCH |
/users/:id/role |
Update user role (admin) | β Admin |
| Issues | |||
GET |
/issues |
Fetch all issues | β |
GET |
/issues/:id |
Get issue details | β |
POST |
/issues |
Create new issue | β |
PATCH |
/issues/:id |
Update issue status | β Staff/Admin |
DELETE |
/issues/:id |
Delete issue | β Admin |
| Dashboard | |||
GET |
/issues/my-issues |
User's submitted issues | β |
GET |
/issues/assigned |
Staff assigned issues | β Staff |
GET |
/stats/dashboard |
Dashboard statistics | β |
# Build the project
npm run build
# Install Firebase CLI (if not installed)
npm install -g firebase-tools
# Login to Firebase
firebase login
# Initialize Firebase (if not done)
firebase init
# Deploy
firebase deploy# Install Vercel CLI
npm i -g vercel
# Deploy
vercel# Build command
npm run build
# Publish directory
dist
# Ensure _redirects file for SPA routing
echo "/* /index.html 200" > dist/_redirectsMake sure to configure all environment variables in your hosting platform:
- Vercel: Settings β Environment Variables
- Netlify: Site settings β Build & deploy β Environment
- Firebase: Use
.env.productionfile (not tracked in git)
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Write clean, readable, and maintainable code
- Follow the existing code style and conventions
- Use
react-hook-formfor form validation - Implement proper error handling and loading states
- Add comments for complex logic
- Test your changes thoroughly before submitting
- Update documentation if needed
Solution:
# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm install
npm run devSolution:
- Verify all Firebase environment variables are set correctly
- Check Firebase console for enabled authentication methods
- Ensure authorized domains include your localhost and production URLs
Solution:
- Check if user is logged in:
const { user } = useAuth() - Verify token is being attached in
useAxiosSecurehook - Check backend is accepting the Firebase token format
- Ensure CORS is configured on the backend
Solution:
- Verify user data includes
rolefield - Check
useRolehook is fetching role correctly - Ensure backend
/users/mereturns user role - Clear localStorage and login again
Solution:
# Check for ESLint errors
npm run lint
# Build with error details
npm run build --verboseDistributed under the MIT License. See LICENSE file for more information.
Md Jihanur Rahman
- π§ Email: mdjihanurrahman5@gmail.com
- πΌ LinkedIn: linkedin.com/in/md-jihanur-rahman
- π GitHub: @jihanurrahman33
Project Link: https://github.com/jihanurrahman33/PIIRS_CLIENT
Made with β€οΈ by Md Jihanur Rahman