Modern React interface for the SahakarBot legal assistant
Backend Repo | Watch Tutorial | Live Demo
Complete walkthrough covering:
- React chatbot interface design
- API integration with FastAPI backend
- Chat history management
- Responsive UI/UX design
- Deployment strategies
SahakarBot Frontend is a modern, responsive React application that provides an intuitive chat interface for querying the Maharashtra Co-operative Societies Act, 1960. Built with Vite for optimal performance and developer experience.
- π¬ Clean Chat Interface: Simple, intuitive conversation UI
- π Real-time Responses: Instant feedback with loading states
- π Chat History: Maintains conversation context
- π± Responsive Design: Works seamlessly on all devices
- β‘ Fast Performance: Vite-powered build optimization
- π¨ Modern UI: Clean, professional design
React Frontend (ChatBot.jsx)
β
User Input & State Management
β
HTTP POST Request to Backend (/query)
β
FastAPI Backend (SahakarBot-Backend)
β
RAG Pipeline Processing
β
Response from Backend
β
Display in Chat Interface
| Technology | Purpose |
|---|---|
| React 18 | UI framework |
| Vite | Build tool & dev server |
| JavaScript (ES6+) | Programming language |
| CSS3 | Styling |
| Fetch API | HTTP requests to backend |
- Node.js 18+
- npm or yarn
- Running backend API (see Backend Repo)
- Clone the repository
git clone https://github.com/omrawal/SahakarBot-Frontend.git
cd SahakarBot-Frontend- Install dependencies
npm installor
yarn install- Configure API endpoint
Update the API URL in your component (default: http://localhost:8000/query)
- Run development server
npm run devor
yarn devApp will be available at http://localhost:5173
SahakarBot-Frontend/
βββ src/
β βββ App.jsx # Main application component
β βββ ChatBot.jsx # Custom chatbot component
β βββ App.css # Application styles
β βββ main.jsx # Entry point
βββ public/
β βββ index.html
βββ package.json
βββ vite.config.js
βββ README.md
- User types a question in the input field
- Click "Send" or press Enter
- Question is sent to FastAPI backend
- Loading indicator appears while processing
- Answer is displayed in the chat
- Chat history is maintained for context
- "What is the registration process for a society?"
- "What are the eligibility criteria in Section 25?"
- "What documents are required for registration?"
Update the backend URL in ChatBot.jsx:
const response = await fetch("YOUR_BACKEND_URL/query", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
question: input,
chat_history: chatHistory,
}),
});Customize the appearance by modifying App.css:
- Colors
- Fonts
- Layout dimensions
- Animation timings
npm run buildor
yarn buildnpm install -g netlify-cli
netlify deploy --prodnpm install -g vercel
vercel --prodnpm install -g firebase-tools
firebase login
firebase init hosting
firebase deploy- Backend: SahakarBot-Backend - FastAPI + LangChain + ChromaDB
Learn how to build this project step-by-step:
I Built an AI Legal Assistant in 15 Minutes (FastAPI + LangChain + ChromaDB Tutorial)
Topics covered:
- React chatbot component creation
- API integration patterns
- State management for chat history
- UI/UX best practices
- Deployment options
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (git checkout -b feature/AmazingFeature)
- Commit your changes (git commit -m 'Add some AmazingFeature')
- Push to the branch (git push origin feature/AmazingFeature)
- Open a Pull Request
This project is licensed under the MIT License.
Om Rawal
- GitHub: @omrawal
- YouTube: Watch Tutorial
β Star this repo if you found it helpful!