Modern, responsive chat interface for querying India's agricultural and climate data
Part of Project Samarth - Built for Build for Bharat Challenge ๐ฎ๐ณ
๐ Try it now: https://project-samarth-frontend-eight.vercel.app/
A beautiful, intuitive chat interface that lets users:
- โ๏ธ Ask questions in plain English
- ๐ Get data-backed answers from government sources
- ๐ See full citations for every claim
- ๐ Interact in real-time with instant responses
- Clean, professional design with Tailwind CSS
- Responsive layout (works on mobile, tablet, desktop)
- Real-time message streaming
- Loading states and animations
- Green "Backend Connected" indicator
- Sample questions to get started
- Message history
- Timestamp for each message
- Typing indicator while processing
- Every answer includes data sources
- Clickable links to datasets
- Ministry/department attribution
- Dataset resource IDs for verification
- Fast initial load
- Optimized React components
- Efficient state management
- Lazy loading where possible
- React 18 - UI library
- Tailwind CSS - Styling
- Lucide React - Icons
- Fetch API - Backend communication
- Vercel - Deployment platform
- Node.js 16+ and npm
- Clone the repository
git clone https://github.com/mrmallick07/project-samarth-frontend.git
cd project-samarth-frontend- Install dependencies
npm install- Configure backend URL
Create
.envfile:
REACT_APP_API_URL=http://localhost:5000/apiFor production, use:
REACT_APP_API_URL=https://project-samarth-api-cs4k.onrender.com/api- Start development server
npm startOpens at: http://localhost:3000
npm run buildCreates optimized build in build/ folder.
- Fork this repository
- Sign up at Vercel.com with GitHub
- Import this repository
- Add Environment Variable:
- Name:
REACT_APP_API_URL - Value: Your backend API URL
- Name:
- Deploy!
Vercel auto-deploys on every push to main branch.
project-samarth-frontend/
โโโ public/
โ โโโ index.html
โ โโโ favicon.ico
โโโ src/
โ โโโ App.js # Main component
โ โโโ App.css # Styles
โ โโโ index.js # Entry point
โโโ package.json
โโโ README.md
<div className="chat-container">
<Header /> {/* Title + Backend status */}
<SampleQuestions /> {/* Quick start questions */}
<MessageList /> {/* Chat history */}
<InputBox /> {/* User input */}
</div>- System Messages - Welcome, instructions
- User Messages - User queries (green, right-aligned)
- Bot Messages - AI responses with citations (white, left-aligned)
- Loading State - Spinner while processing
- Backend API: https://github.com/mrmallick07/project-samarth-backend
- Full Project: https://project-samarth-frontend-eight.vercel.app/
Solution:
- Check if backend is running
- Verify
REACT_APP_API_URLin.env - On free tier, first request takes 30-60 sec (backend waking up)
Solution: Backend must allow your frontend origin in CORS settings
Solution:
- Delete
node_modulesandpackage-lock.json - Run
npm installagain - Check Node.js version (requires 16+)
This is a hackathon prototype. To improve:
- Add dark mode toggle
- Export answers as PDF
- Add query history (with local storage)
- Add data visualization (charts)
- Implement voice input
- Add multi-language support
Noushad Mallick
- GitHub: @mrmallick07
- Built for: Build for Bharat Challenge 2024
MIT License
โญ Star this repo if you found it useful!


