CivicPulse is a web application designed to allow users to report and track community issues such as road damage, drainage problems, and more. The application includes a public-facing frontend for reporting and viewing issues and an admin panel for managing reports and users.
CivicPulse is a web application designed to allow users to report and track community issues such as road damage, drainage problems, and more. The application includes a public-facing frontend for reporting and viewing issues and an admin panel for managing reports and users.
You can view the video of the application here.
You can view the live demo of the application here.
Note: I have disabled my GCP account to avoid getting charged, so heatmap and places api would not be working.
Note: In some cases, clicking on the heatmap may cause the whole window to go blank. If this happens, simply reload the page. This issue typically occurs the first time you click on the heatmap.
multipart/form-data
, primarily used for uploading files.Clone the repository:
git clone https://github.com/rushilpatel21/CivicPulse.git
cd client
Install dependencies:
npm install
Create a .env
file in the frontend
directory and add the following environment variables:
VITE_GOOGLE_API_KEY=
VITE_GOOGLE_AUTH_DOMAIN=
VITE_GOOGLE_PROJECT_ID=
VITE_GOOGLE_STORAGE_BUCKET=
VITE_GOOGLE_MESSAGING_SENDER_ID=
VITE_GOOGLE_APP_ID=
VITE_GOOGLE_MEASUREMENT_ID=
VITE_GOOGLE_DATABASE_URL=
VITE_GOOGLE_PAID_API=
VITE_BACKEND_SERVER_PORT=
VITE_BACKEND_SERVER_PORT_DEV=
VITE_GOOGLE_RUSHIL_ID=
Start the development server:
npm run dev
Navigate to the backend
directory:
cd server
Install dependencies:
npm install
Create a .env
file in the backend
directory and add the following environment variables:
PORT=8000
GEMINI_API_KEY=""
GOOGLE_API_KEY=""
GOOGLE_AUTH_DOMAIN=""
GOOGLE_PROJECT_ID=""
GOOGLE_STORAGE_BUCKET=""
GOOGLE_MESSAGING_SENDER_ID=""
GOOGLE_APP_ID=""
GOOGLE_MEASUREMENT_ID=""
GOOGLE_DATABASE_URL=""
FIREBASE_TYPE=""
FIREBASE_PROJECT_ID=""
FIREBASE_PRIVATE_KEY_ID=""
FIREBASE_PRIVATE_KEY="
FIREBASE_CLIENT_EMAIL=""
FIREBASE_CLIENT_ID=""
FIREBASE_AUTH_URI=""
FIREBASE_TOKEN_URI=""
FIREBASE_AUTH_PROVIDER_X509_CERT_URL=""
FIREBASE_CLIENT_X509_CERT_URL=""
FIREBASE_UNIVERSE_DOMAIN=""
Start the backend server:
npm start
The CivicPulse web application interacts with a variety of backend endpoints to manage issues, user roles, and reports. Below is a detailed description of the API endpoints used in the application, along with the corresponding functions in the frontend code.
/gemini
POST
Gemini
const formData = new FormData();
// Append form data here
const response = await Gemini(formData);
/issues
GET
getIssues
const issues = await getIssues();
/issues/:id
GET
getIssuesById
const issue = await getIssuesById(issueId);
/issues/:id
DELETE
deleteIssueById
const response = await deleteIssueById(issueId);
/issues/issues/:id
DELETE
deleteIssueByIssueId
const response = await deleteIssueByIssueId(issueId);
/issues/:id
PUT
updateIssueProgress
const response = await updateIssueProgress(issueId, progress);
/issues/department/:department
GET
getIssuesByDepartment
const issues = await getIssuesByDepartment(department);
/issues/clearance
GET
getIssuesByClearance
const issues = await getIssuesByClearance();
/issues/month
GET
getIssuesByMonth
const issues = await getIssuesByMonth();
/issues/departmentType
GET
getIssuesByDepartmentType
const issues = await getIssuesByDepartmentType();
/issues/heatmap/getData
GET
getHeatmapData
const heatmapData = await getHeatmapData();
/admin/users
GET
getAllUsers
const users = await getAllUsers();
/admin/user/:id
DELETE
deleteUserInfo
const response = await deleteUserInfo(userId);
/admin/disable/:id
POST
disableUserInfo
const response = await disableUserInfo(userId);
/admin/enable/:id
POST
enableUserInfo
const response = await enableUserInfo(userId);
/admin/role/:id
GET
isAdmin
const isAdminUser = await isAdmin(userId);
/admin/role/:id
PUT
changeRoleById
const response = await changeRoleById(userId, role);
/bugs
POST
bugReportApi
const bugReport = {
description: "Bug description",
stepsToReproduce: "Steps to reproduce",
expectedOutcome: "Expected outcome",
actualOutcome: "Actual outcome"
};
const response = await bugReportApi(bugReport);
VITE_GOOGLE_API_KEY
: Your Google API key.VITE_GOOGLE_AUTH_DOMAIN
: Your Firebase Auth domain.VITE_GOOGLE_PROJECT_ID
: Your Firebase project ID.VITE_GOOGLE_STORAGE_BUCKET
: Your Firebase storage bucket.VITE_GOOGLE_MESSAGING_SENDER_ID
: Your Firebase messaging sender ID.VITE_GOOGLE_APP_ID
: Your Firebase app ID.VITE_GOOGLE_MEASUREMENT_ID
: Your Firebase measurement ID.VITE_GOOGLE_DATABASE_URL
: Your Firebase database URL.VITE_GOOGLE_PAID_API
: Your Google Paid API key.VITE_BACKEND_SERVER_PORT
: Port for the backend server in production.VITE_BACKEND_SERVER_PORT_DEV
: Port for the backend server in development.VITE_GOOGLE_RUSHIL_ID
: Your Google ID.PORT
: Port for the backend server (default: 8000).GEMINI_API_KEY
: Your Gemini API key.GOOGLE_API_KEY
: Your Firebase API key.GOOGLE_AUTH_DOMAIN
: Your Firebase Auth domain.GOOGLE_PROJECT_ID
: Your Firebase project ID.GOOGLE_STORAGE_BUCKET
: Your Firebase storage bucket.GOOGLE_MESSAGING_SENDER_ID
: Your Firebase messaging sender ID.GOOGLE_APP_ID
: Your Firebase app ID.GOOGLE_MEASUREMENT_ID
: Your Firebase measurement ID.GOOGLE_DATABASE_URL
: Your Firebase database URL.FIREBASE_TYPE
: Your Firebase type.FIREBASE_PROJECT_ID
: Your Firebase project ID.FIREBASE_PRIVATE_KEY_ID
: Your Firebase private key ID.FIREBASE_PRIVATE_KEY
: Your Firebase private key.FIREBASE_CLIENT_EMAIL
: Your Firebase client email.FIREBASE_CLIENT_ID
: Your Firebase client ID.FIREBASE_AUTH_URI
: Your Firebase Auth URI.FIREBASE_TOKEN_URI
: Your Firebase token URI.FIREBASE_AUTH_PROVIDER_X509_CERT_URL
: Your Firebase Auth provider x509 cert URL.FIREBASE_CLIENT_X509_CERT_URL
: Your Firebase client x509 cert URL.FIREBASE_UNIVERSE_DOMAIN
: Your Firebase universe domain./api/issues
: Handles creating, retrieving, updating, and deleting issues./api/users
: Manages user accounts and authentication./api/admin
: Provides admin-specific operations such as retrieving all issues and managing user roles.