A Next.js application that connects food donors with recipients to reduce waste and hunger using AI-powered matching.
- AI-Powered Matching: Intelligent matching of food donors with recipients based on location and needs
- Real-time Chatbot: AI assistant for user guidance and support
- Responsive Design: Works seamlessly across desktop and mobile devices
- Modern UI: Clean, accessible interface with smooth animations
- Form Validation: Robust input validation using Zod schemas
- Node.js (version 18 or higher)
- npm or yarn package manager
- Google AI API key (for AI features)
npm installCreate a .env.local file in the root directory:
# Google AI API Key - Get from https://makersuite.google.com/app/apikey
GOOGLE_API_KEY=your_google_ai_api_key_here
# Next.js Environment
NEXT_PUBLIC_APP_URL=http://localhost:9002To get a Google AI API key:
- Go to Google AI Studio
- Create a new API key
- Copy the key and paste it in your
.env.localfile
Option A: Run only the Next.js app (without AI features)
npm run devOption B: Run with AI features (recommended) You'll need two terminal windows:
Terminal 1 - Start the AI server:
npm run genkit:devTerminal 2 - Start the Next.js app:
npm run devOnce both servers are running, open your browser and go to:
- Main App:
http://localhost:9002 - AI Development Server: Usually runs on a different port (check terminal output)
This project is optimized for Vercel deployment. Follow these steps:
# Build the project locally to test
npm run buildOption A: Using Vercel CLI
# Install Vercel CLI
npm i -g vercel
# Deploy
vercel
# Follow the prompts and set up environment variablesOption B: Using Vercel Dashboard
- Push your code to GitHub
- Connect your repository to Vercel
- Add environment variables in Vercel dashboard:
GOOGLE_API_KEY: Your Google AI API keyNEXT_PUBLIC_APP_URL: Your Vercel app URL
In your Vercel dashboard, add these environment variables:
GOOGLE_API_KEY=your_actual_google_ai_api_key
NEXT_PUBLIC_APP_URL=https://your-app-name.vercel.app
- AI Features: The AI features will work on Vercel, but they use serverless functions
- Cold Starts: AI responses might be slower due to serverless cold starts
- API Limits: Be aware of Google AI API rate limits
- Fallback: The app includes fallback responses when AI is unavailable
npm run dev- Start Next.js development server on port 9002npm run genkit:dev- Start AI development servernpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLintnpm run typecheck- Run TypeScript type checking
src/
├── app/ # Next.js App Router pages
│ ├── donate/ # Donation interface
│ ├── receive/ # Recipient interface
│ ├── dashboard/ # User dashboard
│ └── login/ # Authentication
├── components/ # Reusable UI components
│ ├── ui/ # shadcn/ui components
│ ├── layout/ # Header, Footer
│ └── chatbot/ # AI chatbot component
├── ai/ # AI integration
│ └── flows/ # AI workflows
├── lib/ # Utility functions
└── hooks/ # Custom React hooks
If you get dependency errors:
# Clear npm cache
npm cache clean --force
# Delete node_modules and reinstall
rm -rf node_modules package-lock.json
npm installIf AI features don't work:
- Make sure you have a valid Google AI API key
- Ensure the
.env.localfile is in the root directory - Check that both the Next.js and Genkit servers are running
If you get TypeScript errors:
npm run typecheckIf the app doesn't start:
- Check if port 9002 is available
- Try running on a different port:
npm run dev -- -p 3000
Vercel Deployment Issues:
- Ensure all environment variables are set in Vercel dashboard
- Check build logs for any errors
- Verify Google AI API key is valid and has proper permissions
The application includes fallback mechanisms when AI services are unavailable:
- Chatbot will show a helpful error message
- Food matching will return a fallback match
- All errors are logged to the console for debugging
- Framework: Next.js 15 with App Router
- Language: TypeScript
- Styling: Tailwind CSS with custom design system
- UI Components: Radix UI primitives with shadcn/ui
- AI Integration: Google AI (Gemini 2.0 Flash) via Genkit
- Forms: React Hook Form with Zod validation
- Icons: Lucide React
- Charts: Recharts for data visualization
- Deployment: Vercel (optimized)
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.