Dinner Matchmaker is a web application that helps you generate personalized recipes based on your guests' dietary preferences and restrictions.
- Overview
- Features
- Technologies Used
- Architecture
- Project Structure
- Setup and Installation
- Authentication
- Guest Management
- Recipe Generation
- Database Schema
- Recipe Storage
- AI Integration
- Contributing
Dinner Matchmaker helps you plan meals when hosting guests with various dietary restrictions. The application allows you to create profiles for your guests, specify their dietary preferences, and then generate suitable recipes that accommodate everyone's needs.
- User Authentication: Secure login and registration system
- Guest Profiles: Create, edit, and delete guest profiles with dietary preferences
- Guest Categorization: Organize guests by categories (family, friends, colleagues, etc.)
- Dietary Preferences: Support for various dietary restrictions (vegetarian, vegan, gluten-free, etc.)
- Recipe Generation: AI-powered recipe generation based on guest preferences
- Recipe Storage: Save and retrieve your favorite recipes
- Customizable Recipe Options: Set cooking time, preparation time, difficulty, and more
- Multiple AI Providers: Generate recipes using Gemini or Perplexity AI models
- React - UI library
- TypeScript - Type-safe JavaScript
- Tailwind CSS - Utility-first CSS framework
- Shadcn UI - UI component library
- Lucide React - Icon library
- React Router - Client-side routing
- Zustand - State management
- React Hook Form - Form handling
- Supabase - Backend-as-a-Service platform
- Supabase Auth - Authentication service
- PostgreSQL - Database (via Supabase)
- Row Level Security - Database security policies
- Google Gemini API - AI for recipe generation
- Perplexity API - Alternative AI for recipe generation
The application follows a modern web architecture:
- Frontend: React Single Page Application (SPA)
- Backend: Serverless using Supabase
- Database: PostgreSQL hosted on Supabase
- Authentication: Handled by Supabase Auth
- State Management: Combination of local state, React Context, and Zustand
- External Services: Google Gemini API and Perplexity API for recipe generation
src/
├── components/ # React components
│ ├── layout/ # Layout components
│ ├── ui/ # UI components (from shadcn)
│ ├── guest-form/ # Guest form components
│ ├── recipe/ # Recipe-related components
├── hooks/ # Custom React hooks
├── integrations/ # External service integrations
│ └── supabase/ # Supabase client and types
├── lib/ # Utility functions
├── pages/ # Page components
├── services/ # Service functions
│ ├── recipe/ # Recipe generation services
│ └── translations/ # Translation services
├── store/ # Zustand stores
└── types/ # TypeScript type definitions
-
Clone the repository:
git clone [repository-url] cd dinner-matchmaker -
Install dependencies:
npm install
-
Set up Supabase:
- Create a Supabase project
- Set up the database tables as defined in the Database Schema section
- Configure authentication providers
- Configure RLS policies
-
Create environment variables: Create a
.envfile with the following variables:VITE_SUPABASE_URL=your-supabase-url VITE_SUPABASE_ANON_KEY=your-supabase-anon-key -
Run the development server:
npm run dev
The application uses Supabase Auth for authentication. The authentication flow is as follows:
- Users register or log in through the Auth component
- Upon successful authentication, the user is redirected to the home page
- The authenticated user's session is stored in the browser
- Protected routes check for authentication and redirect to the login page if not authenticated
Authentication logic is primarily in src/components/Auth.tsx and src/App.tsx.
Guests are managed through the following components and services:
GuestManager.tsx: Main component for managing guestsGuestList.tsx: Displays the list of guestsCreateGuestForm.tsx: Form for creating and editing guestsGuestProfile.tsx: Contains the Guest type definitionguestDatabaseService.ts: Service for CRUD operations on guests
Each guest has:
- A name
- A category (family, friends, colleagues, other)
- Dietary preferences (vegetarian, vegan, etc.)
Guest data is stored in the guests table in Supabase.
Recipes are generated based on selected guests' dietary preferences and user-specified options:
- User selects guests from the guest list
- User configures recipe options (preparation time, cooking time, difficulty, etc.)
- System generates a recipe that accommodates all dietary restrictions
The recipe generation process uses either the Google Gemini API or Perplexity API, depending on user selection.
Key components:
RecipeContainer.tsx: Main container for recipe functionalityRecipePreferences.tsx: Component for recipe optionsRecipeGenerator.tsx: Logic for generating recipesrecipeService.ts: Service for interacting with AI APIs
The database consists of the following tables:
id: UUID (primary key)name: Textcategory: Text (family, friends, colleagues, other)preferences: JSON (dietary preferences)created_at: Timestamp
id: UUID (primary key)user_id: UUID (foreign key to auth.users)title: Textingredients: JSON Arrayinstructions: JSON Arraydietary_info: JSON Arraybudget: Text (optional)created_at: Timestamp
id: UUID (primary key)gemini_api_key: Textperplexity_api_key: Text (nullable)created_at: Timestamp
Saved recipes are stored in the saved_recipes table in Supabase. The recipeStorageService.ts file provides functionality to:
- Save recipes to the database
- Retrieve saved recipes
- Delete recipes from the database
Each saved recipe is associated with the user who created it through the user_id field.
The application integrates with two AI services:
-
Google Gemini API:
- Used by default for recipe generation
- Integration is in
recipeService.ts - API key is stored in the
global_api_keystable
-
Perplexity API:
- Alternative AI provider for recipe generation
- Integration is in
perplexityService.ts - API key is stored in the
global_api_keystable
The recipe generation process follows these steps:
- Create a prompt based on guest preferences and recipe options
- Send the prompt to the selected AI service
- Parse the AI response into a structured recipe format
- Display the recipe to the user
To contribute to this project:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
When adding a new feature, consider:
- Adding appropriate tests
- Updating documentation
- Following the existing code style
- Ensuring proper TypeScript typing
- Respecting the component structure