Skip to content

πŸ…1st PlaceπŸ… USDA Rural Development AI chatbot, Challenge X

Notifications You must be signed in to change notification settings

HugoChambert/USDA-CHATBOT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

USDA Chatbot

A beautiful, production-ready chatbot interface for querying USDA Rural Development programs. Built with React, TypeScript, Tailwind CSS, and Supabase.

πŸ“ Project Structure

usda-chatbot/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ App.tsx          (Main chatbot component)
β”‚   β”œβ”€β”€ main.tsx         (Entry point)
β”‚   └── index.css        (Tailwind imports)
β”œβ”€β”€ index.html           (HTML template)
β”œβ”€β”€ package.json         (Dependencies)
β”œβ”€β”€ vite.config.ts       (Vite config)
β”œβ”€β”€ tailwind.config.js   (Tailwind config)
β”œβ”€β”€ tsconfig.json        (TypeScript config)
β”œβ”€β”€ tsconfig.app.json    (TypeScript app config)
└── .env                 (Environment variables)

πŸš€ Setup Instructions

1. Clone or download the project

git clone <your-repo-url>
cd usda-chatbot

2. Install dependencies

npm install

3. Set up environment variables

Create a .env file in the root directory:

VITE_SUPABASE_URL=your_supabase_url_here
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key_here

4. Run the development server

npm run dev

The app will be available at http://localhost:5173

5. Build for production

npm run build

🎨 Customization Tips

Colors

You can customize the chatbot colors by editing src/App.tsx:

  • Header background: Line 198 - from-slate-800 to-slate-700
  • User messages: Line 238 - bg-green-700
  • Bot avatar: Line 224 - bg-slate-800
  • Background gradient: Line 183 - from-blue-400 to-blue-100

Text Content

  • Welcome message: Lines 42-43
  • USDA keywords: Lines 24-34 - Add or remove keywords to improve search

Layout

  • Chat height: Line 196 - height: '600px'
  • Max width: Line 195 - max-w-md
  • Avatar size: Line 224 - w-10 h-10

πŸ—„οΈ Database Structure

The chatbot queries a Supabase database with the following table:

usda_programs table

Column Type Description
title text Program name
description text Program description
url text Link to program details
category text Program category

πŸ“ Features

  • Smart keyword detection: Automatically detects USDA-related topics
  • Database search: Queries Supabase for relevant programs
  • Conversational responses: Provides helpful, contextual answers
  • Floating widget: Can be opened and closed
  • Responsive design: Works on all screen sizes
  • Loading states: Animated indicators for better UX
  • Error handling: Graceful error messages

πŸ› οΈ Technologies Used

  • React 18 - UI framework
  • TypeScript - Type safety
  • Vite - Build tool
  • Tailwind CSS - Styling
  • Supabase - Database and backend
  • Lucide React - Icons

πŸ“¦ Dependencies

Production

  • @supabase/supabase-js - Supabase client
  • lucide-react - Icon library
  • react & react-dom - React framework

Development

  • @vitejs/plugin-react - Vite React plugin
  • tailwindcss - CSS framework
  • typescript - TypeScript compiler
  • autoprefixer & postcss - CSS processing

🎯 How It Works

  1. User Input: User types a question about USDA programs
  2. Keyword Extraction: System extracts relevant keywords from the query
  3. Database Search: Searches the usda_programs table using extracted keywords
  4. Response Generation: Creates a conversational response with matching programs
  5. Display: Shows formatted results with program details and links

πŸ”’ Security Notes

  • Never commit your .env file to version control
  • Keep your Supabase keys secure
  • Use Row Level Security (RLS) policies in Supabase for production

πŸ“„ License

MIT License - Feel free to use this project for your own purposes.

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“§ Support

For questions or issues, please open an issue on GitHub.

About

πŸ…1st PlaceπŸ… USDA Rural Development AI chatbot, Challenge X

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published