A full-stack web application designed for citizens to report city infrastructure issues (such as potholes, garbage overflows, and broken streetlights) and for city authorities to manage and resolve them efficiently.
- Citizen Portal: Register, login, report issues with images and locations, track complaint status.
- Admin Dashboard: View all complaints, filter by status, update status, delete invalid reports.
- Responsive UI: Built with React and Tailwind CSS for a modern, mobile-friendly experience.
- Frontend: React, Vite, React Router, Tailwind CSS, Axios, Lucide React
- Backend: Node.js, Express, Multer (file uploads), JSON Web Tokens (auth), bcryptjs
- Database: MySQL
- Node.js (v16+)
- MySQL Server running locally
- Make sure your local MySQL server is running.
- The application will automatically create the
smart_city_dbdatabase and tables upon startup if your MySQL root credentials match the defaults.- Default user:
root - Default password: `` (empty)
- If your MySQL uses different credentials, create a
.envfile in theserverdirectory:DB_HOST=localhost DB_USER=your_mysql_username DB_PASSWORD=your_mysql_password DB_NAME=smart_city_db PORT=5000 JWT_SECRET=super_secret_key_change_me_in_production
- Default user:
This project uses concurrently to run both the frontend and backend with a single command.
-
Navigate to the project root:
cd smart-city -
Install root dependencies:
npm install
-
Start both client and server:
npm run dev
(This will start the Express API on port 5000, and the React app on port 5173)
-
Open your browser and navigate to
http://localhost:5173.
To fully test the application, follow this sequence:
- Go to
http://localhost:5173/register - Fill in the details (e.g., Name:
Admin Manager, Email:admin@city.gov). - Click the Admin role toggle at the bottom before submitting.
- Provide a password like
admin123and Register.
- Go to Register page again.
- Fill in details (e.g., Name:
John Doe, Email:john@example.com). - Ensure the Citizen role is selected.
- Provide a password like
citizen123and Register.
- Log in with
john@example.com. - Click Report Issue.
- Select an issue type like
Pothole. - Enter description:
Large pothole causing traffic slowdowns. - Enter location:
Main St. intersection heading North. - Upload a sample image and click Submit Report.
- The complaint will now be visible under My Complaints with a
Pendingstatus.
- Logout and log back in with
admin@city.gov. - The dashboard will show John's new complaint.
- Click the row to open the details panel.
- Review the image and description.
- Click Mark as In Progress.
- Switch back to the citizen account (optional) to see the updated badge!