CitiSafeguard is an admin dashboard for managing traffic laws, reports, and cases within a city. It includes features for adding and managing laws, handling user reports, and assigning investigations to admins. This project is built using Next.js with a MongoDB database.
- Traffic Law Management: Create, update, and delete traffic laws within the system.
- User Reports: View and manage user reports regarding traffic violations.
- Admin Management: Assign admins to investigate cases, view and manage admin details.
- Notifications: Send notifications to users and admins based on specific actions or updates.
- Civic Points System: Track user civic points and manage transactions.
- Frontend: Next.js
- Backend: Next.js API Routes
- Database: MongoDB with Prisma ORM
- Authentication: Clerk for user authentication
- Node.js v18+
- MongoDB (Local or Cloud Instance)
- Prisma CLI
-
Clone the repository:
git clone https://github.com/your-username/citi-safeguard.git cd citi-safeguard
-
Install dependencies:
npm install
-
Setup environment variables:
Create a
.env
file at the root of your project and add the following variables:
DATABASE_URL="Your_Mongo_url" NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_Y29taWMtc2VhbC02NS5jbGVyay5hY2NvdW50cy5kZXYk CLERK_SECRET_KEY= "" NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up CLERK_WEBHOOK_SIGNING_SECRET="" NEXT_PUBLIC_APP_URL=http://localhost:3000
4. **Generate Prisma client:**
Run the following command to generate the Prisma client:
```bash
npx prisma generate
-
Run the development server:
npm run dev
Open http://localhost:3000 in your browser to see the app in action.
-
GET /api/laws/{lawId}
- Fetch details of a specific law by its ID.
-
PATCH /api/laws/{lawId}
- Update the name of a specific law by its ID.
-
DELETE /api/laws/{lawId}
- Delete a specific law by its ID.
-
GET /api/reports
- Fetch all reports made by users.
-
POST /api/reports
- Create a new report.
-
GET /api/admins
- Fetch a list of all admins.
-
POST /api/admins
- Create a new admin.
Here is the README for the user side of the CitiSafeguard app:
CitiSafeguard is a user portal designed for citizens to report traffic violations, view traffic laws, and track their civic points. The platform enables users to stay informed about city regulations and contribute to maintaining law and order through reporting and interacting with the system. This project is built using Next.js with a MongoDB database.
- Report Violations: Users can report traffic violations, including location, description, and evidence (e.g., photo or video).
- View Traffic Laws: Access up-to-date information on traffic laws, penalties, and regulations in the city.
- Civic Points: Track civic points earned for reporting violations and other contributions to the city's safety.
- Notifications: Receive notifications for updates on reported violations, changes in traffic laws, and other relevant information.
- Profile Management: Manage user information such as username, email, and password.
- Frontend: Next.js
- Backend: Next.js API Routes
- Database: MongoDB with Prisma ORM
- Authentication: Clerk for user authentication
- Node.js v18+
- MongoDB (Local or Cloud Instance)
- Prisma CLI
-
Clone the repository:
git clone https://github.com/your-username/citi-safeguard-user.git cd citi-safeguard-user
-
Install dependencies:
npm install
-
Setup environment variables:
Create a
.env
file at the root of your project and add the following variables:DATABASE_URL="Your_MongoDB_URL" NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY= "" CLERK_SECRET_KEY="Your_Clerk_Secret_Key" NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up CLERK_WEBHOOK_SIGNING_SECRET="Your_Clerk_Webhook_Secret" NEXT_PUBLIC_APP_URL=http://localhost:3000
-
Generate Prisma client:
Run the following command to generate the Prisma client:
npx prisma generate
-
Run the development server:
npm run dev
-
Open http://localhost:3000 in your browser to see the app in action.
-
POST /api/violations
Create a new traffic violation report.
-
GET /api/violations
Fetch a list of all violations reported by the user.
-
GET /api/laws
Fetch all traffic laws available to users.
-
GET /api/civic-points
Fetch the user's civic points and transaction history.
To test the API endpoints, you can use Thunder Client (VS Code extension) or Postman. Set up the necessary headers and body for each request according to the API documentation above.
Feel free to fork this repository, create new branches, and submit pull requests for new features or bug fixes.
For any questions or support, please reach out to:
- GitHub: dshreyash-108
- GitHub: AmitNayak514