Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env
node_modules
138 changes: 82 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,86 +1,112 @@
# HackToFuture 4.0 — Template
# JanSetu: AI-Powered Smart City Complaint Analysis & Automation System

Welcome to your official HackToFuture 4 repository.
JanSetu is a next-generation civic governance platform designed to bridge the gap between citizens and government authorities using Artificial Intelligence, Real-time Mapping, and Multi-channel Communication (WhatsApp + Web).

This repository template will be used for development, tracking progress, and final submission of your project. Ensure that all work is committed here within the allowed hackathon duration.

---

### Instructions for the teams:
## 🚀 Key Features

- Fork the Repository and name the forked repo in this convention: hacktofuture4-team_id (for eg: hacktofuture4-A01)
### 1. Multi-Channel Reporting
* **WhatsApp Chatbot**: Direct reporting via WhatsApp. Supports stateful conversations, intent detection, and native **GPS Location Pin** sharing.
* **Web Portal**: A high-fidelity React dashboard for citizens to report issues with images and geolocation.

---
### 2. JanSetu AI Brain (Powered by Groq)
* **Automatic Categorization**: AI identifies if a report belongs to Water Supply, Electricity, Public Works, etc.
* **Severity Analysis**: Determines the urgency of every case based on semantic context (e.g., "Live wire" = High Priority).
* **Semantic Clustering**: Uses TF-IDF Vectorization to group similar reports, identifying city-wide **Hotspots** automatically.

## Rules
### 3. Executive Command Center
* **Overwatch Map**: Real-time visual heatmaps of civic issues using `react-leaflet`.
* **Departmental Dashboards**: Authority-specific feeds that prioritize the most urgent cases first.
* **Analytics Engine**: Instant reporting of load distribution across city departments.

- Work must be done ONLY in the forked repository
- Only Four Contributors are allowed.
- After 36 hours, Please make PR to the Main Repository. A Form will be sent to fill the required information.
- Do not copy code from other teams
- All commits must be from individual GitHub accounts
- Please provide meaningful commits for tracking.
- Do not share your repository with other teams
- Final submission must be pushed before the deadline
- Any violation may lead to disqualification
### 4. Smart Notifications & Escalation
* **Direct Alerts**: Automated emails to department heads when new critical issues are assigned.
* **Escalation Protocols**: If an issue isn't resolved within its SLA deadline, it is automatically escalated and flagged in the Executive Insight view.

---

# The Final README Template
## 🛠️ Technology Stack

## Problem Statement / Idea
* **Frontend**: React.js, TailwindCSS, Framer Motion, Lucide Icons.
* **Backend**: Node.js, Express.
* **Database**: MongoDB (Atlas/Local).
* **AI/LLM**: Groq Cloud (Llama 3 8B/70B).
* **Communications**: Twilio WhatsApp API, Nodemailer.
* **Mapping**: Leaflet, OpenStreetMap (Nominatim Geocoding).

Clearly describe the problem you are solving.
---

- What is the problem?
- Why is it important?
- Who are the target users?
## 📥 Setup Instructions

---
### 1. Prerequisites
* Node.js (v18+)
* MongoDB installed locally or a MongoDB Atlas URI.
* Groq API Key (get it [here](https://console.groq.com/)).
* Twilio Account (for WhatsApp integration).

## Proposed Solution
### 2. Environment Configuration
Create a `.env` file in the `server` directory:

Explain your approach:
```env
PORT=5000
MONGO_URI=mongodb://localhost:27017/jansetu
GROQ_API_KEY=your_groq_key_here

- What are you building?
- How does it solve the problem?
- What makes your solution unique?
# Twilio Configuration
TWILIO_ACCOUNT_SID=your_sid
TWILIO_AUTH_TOKEN=your_token
TWILIO_NUMBER=whatsapp:+14155238886

---
# Email Configuration
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password
```

## Features
### 3. Installation

List the core features of your project:
**For Backend:**
```bash
cd server
npm install
npm run dev
```

- Feature 1
- Feature 2
- Feature 3
**For Frontend:**
```bash
cd client
npm install
npm run dev
```

---

## Tech Stack

Mention all technologies used:
## 📱 WhatsApp Integration Settings

- Frontend:
- Backend:
- Database:
- APIs / Services:
- Tools / Libraries:
To test WhatsApp reporting:
1. **Start Ngrok**: `ngrok http 5000`
2. **Twilio Sandbox**: Go to Twilio Messaging Settings -> WhatsApp Sandbox.
3. **Webhook URL**: Set the "When a message comes in" URL to `https://your-ngrok-url.ngrok.io/api/whatsapp`.
4. **Try it**: Send a status query like *"Total number of complaints"* or a report like *"Report a water leak at MGM Hospital"* followed by your location pin.

---

## Project Setup Instructions

Provide clear steps to run your project:

```bash
# Clone the repository
git clone <repo-link>
## 🏛️ Project Structure

```text
├── client/
│ ├── src/
│ │ ├── components/ # Reusable UI (Navbar, Map, Chatbot)
│ │ ├── pages/ # Strategic Views (Landing, Dashboards, Rewards)
│ │ └── context/ # Auth & Global State
├── server/
│ ├── models/ # Mongoose Schemas (Complaint, User)
│ ├── routes/ # APIs (Auth, Complaints, WhatsApp, Analytics)
│ ├── services/ # Logic (AI Brain, Clustering, Notifications)
│ └── controllers/ # Request Handlers
```

# Install dependencies
...
## 📜 License
This project was developed for the **HackToFuture** hackathon. All rights reserved.

# Run the project
...
```
---
**Build a smarter city, one report at a time.** 🌍✨
24 changes: 24 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
16 changes: 16 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# React + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)

## React Compiler

The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).

## Expanding the ESLint configuration

If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
29 changes: 29 additions & 0 deletions client/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import { defineConfig, globalIgnores } from 'eslint/config'

export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{js,jsx}'],
extends: [
js.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
rules: {
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
},
},
])
13 changes: 13 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>client</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
Loading