FlavorFusion is a Django-based web application for managing and discovering recipes. It features a robust authentication system powered by Supabase and a dynamic filtering system.
- Setup and Installation
- Authentication (Supabase)
- Core Features
- Project Structure
- User Data Management
Create a .env file in the root directory with the following variables:
SUPABASE_URL=your_supabase_project_url
SUPABASE_KEY=your_supabase_anon_key
SECRET_KEY=your_django_secret_key
DEBUG=TrueInstall the required Python packages:
pip install django supabase python-dotenv dj-database-urlRun migrations and optionally seed the database with initial categories (Country, Ingredients, Tags):
python manage.py migrate
python seed_data.pyNote: seed_data.py creates recipes without authors. These will not appear on the home page as per the requirement to only show user-created content.
The application uses Supabase Auth for user registration and login, integrated with Django's session management.
- Signup: Users register via the
/signup/route. The account is created in Supabase, and a corresponding DjangoUserobject is synchronized in the local database. - Signin: Users log in via
/signin/. The application verifies credentials against Supabase and initializes a Django session. - Signout: Clears the Django session and logs the user out.
recipes/supabase_utils.py: Contains the client initialization logic.recipes/views.py: Containssignup,signin, andsignoutlogic.
The home page (/) displays a feed of recipes.
- Author Requirement: Only recipes with an assigned
author(User) are displayed. Seed recipes without authors are hidden from the main feed. - Search: Search by title or instructions.
- Filters: Filter by Country, Ingredients, and multiple Dietary Tags.
- Create Recipe: Authenticated users can add new recipes. The application automatically assigns the logged-in user as the
author. - Favorites: Users can toggle recipes as favorites.
- Rating: Users can rate recipes from 1 to 5 stars.
flavorfusion/: Project configuration and settings.recipes/: Core application logic.models.py: Database schema for Recipes, Ingredients, Countries, etc.views.py: Request handling and Auth logic.supabase_utils.py: Supabase client helper.
templates/: HTML templates.base.html: Main layout with Navigation and Flash Messages.recipes/: App-specific templates (home, detail, signup, signin).
All user-generated data is tied to their Django User account:
- Ownership: Each
Recipehas a foreign key toUser. - Favorites: Stored in the
Favoritemodel, linking aUserto aRecipe. - Ratings: Stored in the
Ratingmodel with a unique constraint per user/recipe pair.
When a user creates an account through Supabase, their data is persisted locally in the Django database, allowing for efficient querying and relationship management while offloading credential security to Supabase.