A modern meal planning application with AI-powered chat assistance, built with React, TypeScript, Supabase, and OpenAI.
- Weekly Meal Planning: Drag-and-drop interface for organizing meals
- AI Sous Chef: ChatGPT-powered assistant using tool calling to manage your meal plan
- Meal Inventory: Store and organize your favorite recipes and meal ideas
- Grocery List Generation: AI-powered ingredient extraction from your meal plan
- Recipe Management: Store recipes with URLs or custom instructions
- Multi-device Sync: All data stored securely in Supabase
- Frontend: React 18, TypeScript, Vite
- UI Components: shadcn/ui with Radix UI primitives
- Styling: Tailwind CSS
- Backend: Supabase (PostgreSQL, Auth, Edge Functions)
- AI: OpenAI GPT-4o with function calling
- State Management: TanStack Query (React Query)
- Node.js 18+ and npm/yarn/bun
- Supabase account (free tier works)
- OpenAI API key
- Supabase CLI (recommended)
git clone <YOUR_GIT_URL>
cd plan-it-drag-n-dinenpm install
# or
yarn install
# or
bun install- Go to supabase.com and create a new project
- Wait for the project to be provisioned (~2 minutes)
# Copy the example environment file
cp .env.example .env
# Edit .env with your Supabase credentials
# Find these at: https://app.supabase.com/project/_/settings/apiUpdate .env with your values:
VITE_SUPABASE_PROJECT_ID="your-project-id"
VITE_SUPABASE_PUBLISHABLE_KEY="your-anon-key"
VITE_SUPABASE_URL="https://your-project-id.supabase.co"Install and link Supabase CLI:
npm install -g supabase
supabase link --project-ref your-project-idPush database schema:
supabase db pushThis creates all necessary tables:
profiles- User profilesmeal_plans- Weekly meal planning datameal_items- Meal inventoryrecipes- Recipe storagegrocery_lists- AI-generated shopping listschat_messages- Chat historyfeedback- User feedback
Set your OpenAI API key as a Supabase secret:
supabase secrets set OPENAI_API_KEY=sk-your-openai-key-hereOr via Supabase Dashboard:
- Go to Project Settings โ Edge Functions โ Secrets
- Add
OPENAI_API_KEYwith your key
Deploy the AI-powered edge functions:
# Deploy all functions
supabase functions deploy
# Or deploy individually
supabase functions deploy meal-plan-chat
supabase functions deploy extract-ingredientsnpm run devVisit http://localhost:5173
- Sign Up/Login: Create an account using email/password
- Add Meals: Click any cell in the meal grid to add meals
- Use AI Assistant: Click "AI Sous Chef" to chat with the assistant
- "Add tacos to Tuesday dinner"
- "Fill out breakfast for the whole week"
- "What's on my meal plan?"
- Manage Inventory: View and organize your meal items
- Generate Grocery List: Click "Grocery List" to AI-generate ingredients
The AI assistant uses OpenAI function calling to interact with your meal plan:
You: "Add chicken tacos to Monday dinner"
AI: [Calls add_meal_item tool] โ "I've added chicken tacos to Monday dinner! ๐ฎ"
You: "Show me what's planned for this week"
AI: [Calls get_meal_plan tool] โ [Shows formatted meal plan]
You: "Add oatmeal to my inventory"
AI: [Calls add_to_inventory tool] โ "Added oatmeal to your inventory!"
See SECURITY.md for detailed security information.
- โ
Public keys (in
.env) are safe to commit - โ Row Level Security (RLS) protects all data
- โ Never commit
OPENAI_API_KEYor service role keys - โ Keep production secrets in Supabase dashboard only
plan-it-drag-n-dine/
โโโ src/
โ โโโ components/ # React components
โ โ โโโ ui/ # shadcn/ui components
โ โ โโโ ChatInterface.tsx
โ โ โโโ MealPlanBuilder.tsx
โ โโโ hooks/ # Custom React hooks
โ โ โโโ useMealPlanChat.ts
โ โโโ integrations/supabase/
โ โ โโโ client.ts # Supabase client
โ โ โโโ types.ts # Database types
โ โโโ pages/ # Route pages
โโโ supabase/
โ โโโ functions/ # Edge functions
โ โ โโโ meal-plan-chat/ # AI chat with tool calling
โ โ โโโ extract-ingredients/
โ โโโ migrations/ # Database migrations
โโโ .env.example # Environment template
โโโ SECURITY.md # Security documentation
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLint# View local database
supabase db studio
# Create new migration
supabase db diff -f migration_name
# Reset database (โ ๏ธ deletes all data)
supabase db reset# Serve functions locally
supabase functions serve
# View logs
supabase functions logs meal-plan-chat --tail- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Note: Never commit secrets. Check SECURITY.md before contributing.
This project is open source and available under the MIT License.
- Built with Lovable, Claude Code, and a patchwork of UI/UX tools
- UI components from shadcn/ui
- Icons from Lucide
- Backend by Supabase
- AI by OpenAI
For issues, questions, or contributions:
- Open an issue on GitHub
- Check SECURITY.md for security concerns
Happy meal planning! ๐ฝ๏ธ