Skip to content

mrmallick07/project-samarth-frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

19 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽจ Project Samarth - Frontend

Modern, responsive chat interface for querying India's agricultural and climate data

Part of Project Samarth - Built for Build for Bharat Challenge ๐Ÿ‡ฎ๐Ÿ‡ณ

Live Demo React Vercel


๐ŸŒ Live App

๐Ÿ‘‰ Try it now: https://project-samarth-frontend-eight.vercel.app/


๐ŸŽฏ What This Is

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

โœจ Features

๐ŸŽจ Modern UI/UX

  • 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

๐Ÿ’ฌ Smart Chat Interface

  • Sample questions to get started
  • Message history
  • Timestamp for each message
  • Typing indicator while processing

๐Ÿ“– Source Citations

  • Every answer includes data sources
  • Clickable links to datasets
  • Ministry/department attribution
  • Dataset resource IDs for verification

๐Ÿš€ Performance

  • Fast initial load
  • Optimized React components
  • Efficient state management
  • Lazy loading where possible

๐Ÿ› ๏ธ Tech Stack

  • React 18 - UI library
  • Tailwind CSS - Styling
  • Lucide React - Icons
  • Fetch API - Backend communication
  • Vercel - Deployment platform

๐Ÿ–ฅ๏ธ Screenshots

Landing Page

Landing Page

Query & Response

Query Response

Citations Display

Citations


๐Ÿ”ง Local Development

Prerequisites

  • Node.js 16+ and npm

Installation

  1. Clone the repository
git clone https://github.com/mrmallick07/project-samarth-frontend.git
cd project-samarth-frontend
  1. Install dependencies
npm install
  1. Configure backend URL Create .env file:
REACT_APP_API_URL=http://localhost:5000/api

For production, use:

REACT_APP_API_URL=https://project-samarth-api-cs4k.onrender.com/api
  1. Start development server
npm start

Opens at: http://localhost:3000

Build for Production

npm run build

Creates optimized build in build/ folder.


๐ŸŒ Deployment

Deploy to Vercel (Free)

  1. Fork this repository
  2. Sign up at Vercel.com with GitHub
  3. Import this repository
  4. Add Environment Variable:
    • Name: REACT_APP_API_URL
    • Value: Your backend API URL
  5. Deploy!

Vercel auto-deploys on every push to main branch.


๐Ÿ“ Project Structure

project-samarth-frontend/
โ”œโ”€โ”€ public/
โ”‚   โ”œโ”€โ”€ index.html
โ”‚   โ””โ”€โ”€ favicon.ico
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ App.js          # Main component
โ”‚   โ”œโ”€โ”€ App.css         # Styles
โ”‚   โ””โ”€โ”€ index.js        # Entry point
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ README.md

๐ŸŽจ UI Components

Main Chat Interface

<div className="chat-container">
  <Header />              {/* Title + Backend status */}
  <SampleQuestions />     {/* Quick start questions */}
  <MessageList />         {/* Chat history */}
  <InputBox />            {/* User input */}
</div>

Message Types

  1. System Messages - Welcome, instructions
  2. User Messages - User queries (green, right-aligned)
  3. Bot Messages - AI responses with citations (white, left-aligned)
  4. Loading State - Spinner while processing

๐Ÿ”— Related Repositories


๐Ÿ› Troubleshooting

Issue: "Backend not connected"

Solution:

  • Check if backend is running
  • Verify REACT_APP_API_URL in .env
  • On free tier, first request takes 30-60 sec (backend waking up)

Issue: CORS errors

Solution: Backend must allow your frontend origin in CORS settings

Issue: Build fails

Solution:

  • Delete node_modules and package-lock.json
  • Run npm install again
  • Check Node.js version (requires 16+)

๐Ÿค Contributing

This is a hackathon prototype. To improve:

  1. Add dark mode toggle
  2. Export answers as PDF
  3. Add query history (with local storage)
  4. Add data visualization (charts)
  5. Implement voice input
  6. Add multi-language support

๐Ÿ‘จโ€๐Ÿ’ป Author

Noushad Mallick

  • GitHub: @mrmallick07
  • Built for: Build for Bharat Challenge 2024

๐Ÿ“„ License

MIT License


โญ Star this repo if you found it useful!

๐ŸŒ Try Live Demo | ๐Ÿ”— Backend Repo | ๐Ÿ“ง Report Issues

Releases

No releases published

Packages

No packages published