This is the backend API service for the FlavoGen Recipe Sharing Platform. Built with Django and Django REST Framework, it provides a robust RESTful API that powers the FlavoGen Frontend.
- Frontend: React.js (Repository Link)
- Backend: Django REST Framework (This Repository)
- Database: PostgreSQL
- Authentication: Token-based Authentication
- File Storage: Local Media Storage
- Token-based authentication system
- User registration and login endpoints
- Password change functionality
- Permission-based access control
-
Recipe Management
- CRUD operations for recipes
- Image upload handling
- Ingredient management
- Recipe search functionality
-
User Interactions
- Rating system
- Comment management
- Bookmark functionality
- User feedback collection
-
AI Integration
- Chatbot API endpoint
- Recipe recommendations
- Search optimization
The Django admin interface (/admin) provides:
- User management dashboard
- Content moderation tools
- System monitoring
- Data management capabilities
POST /auth/ # Obtain authentication token
POST /users/ # Register new user
POST /login/ # User login
POST /change-password/ # Change passwordGET /recipes/ # List all recipes
POST /recipes/ # Create new recipe
GET /recipes/{id}/ # Get recipe details
PUT /recipes/{id}/ # Update recipe
DELETE /recipes/{id}/ # Delete recipe
GET /recipe-search/ # Search recipesPOST /comments/ # Add comment
POST /ratings/ # Rate recipe
POST /bookmarks/ # Bookmark recipe
GET /bookmarked-recipes/ # Get bookmarked recipes
POST /feedback/ # Submit feedback
POST /chatbot/ # Chat with AI assistant- Python 3.8+
- Django 5.1
- Django REST Framework
- PostgreSQL
- Token Authentication
Django>=5.1.3
djangorestframework>=3.14.0
django-cors-headers>=4.3.1
Pillow>=10.1.0
psycopg2-binary>=2.9.9
python-dotenv>=1.0.0
dj-database-url>=2.1.0
- Python 3.8+
- PostgreSQL
- pip
-
Clone the repository:
git clone <repository-url> cd Recipe_Sharing_Backend
-
Create virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment:
- Copy
.env.exampleto.env - Update database and other settings in
.env
- Copy
-
Database setup:
python manage.py migrate
-
Create admin user:
python manage.py createsuperuser
-
Run development server:
python manage.py runserver
Server will be available at:
- API:
http://localhost:8000/ - Admin Interface:
http://localhost:8000/admin
api/
βββ api/ # Project configuration
β βββ settings.py # Django settings
β βββ urls.py # Main URL routing
β βββ wsgi.py # WSGI configuration
βββ recipe_app/ # Main application
β βββ models.py # Data models
β βββ views.py # API views
β βββ serializers.py # Data serializers
β βββ urls.py # API endpoints
β βββ chatbotservices.py # AI chatbot logic
βββ media/ # Uploaded files
βββ manage.py # Django CLI
βββ requirements.txt # Dependencies
Required environment variables in .env:
# Django Settings
DEBUG=True
SECRET_KEY=your-secret-key
# Database
DB_NAME=flavo_data_base
DB_USER=postgres
DB_PASSWORD=your_password
DB_HOST=localhost
DB_PORT=5432
# CORS Settings
CORS_ALLOWED_ORIGINS=http://localhost:3000
- Set
DEBUG=Falsein production - Use strong
SECRET_KEY - Configure proper CORS settings
- Secure database credentials
- Implement rate limiting
- Regular security updates
- Follow Django REST Framework best practices
- Write tests for new features
- Document API changes
- Use meaningful commit messages
- Follow PEP 8 style guide
- Configure production-grade web server (e.g., Gunicorn)
- Set up proper static/media file serving
- Configure SSL/TLS
- Set up proper database backup
- Configure error logging
- Fork the repository
- Create feature branch
- Commit changes
- Push to branch
- Create Pull Request
This repository includes detailed sequence and class diagrams to illustrate the backend architecture and major workflows of the FlavoGen platform. These diagrams are located in the Sequence and Design Class Diagram/ folder.
- Design Class Diagram: High-level overview of backend classes and their relationships (
Design Class Diagram.jpgand.drawio.xml) - Sequence Diagrams: Step-by-step flows for key features:
- Add Recipe
- Add Review
- Bookmark Recipe
- Manage User Generated Content
- Rate Recipe
- Recipe Recommendation
- Search Recipe
- Share Recipe
- User Management
- View Recipe
Each diagram is available as a .jpg image for quick viewing and as a .drawio.xml file for editing in draw.io.
Folder structure:
Sequence and Design Class Diagram/
βββ Add Recipe.jpg
βββ Add Review.jpg
βββ Bookmark Recipe.jpg
βββ Design Class Diagram.jpg
βββ Manage User Generated Content.jpg
βββ Rate Recipe.jpg
βββ Recipe Recommendation.jpg
βββ Search Recipe.jpg
βββ Share Recipe.jpg
βββ User Management.jpg
βββ View Recipe.jpg
βββ Xml file/
βββ Add Recipe.drawio.xml
βββ Add Review.drawio.xml
βββ Bookmark Recipe.drawio.xml
βββ Design Class Diagram.drawio.xml
βββ Manage User Generated Content.drawio.xml
βββ Rate Recipe.drawio.xml
βββ Recipe Recommendation.drawio.xml
βββ Search Recipe.drawio.xml
βββ Share Recipe.drawio.xml
βββ User Management.drawio.xml
βββ View Recipe.drawio.xml
These diagrams are useful for understanding the backend logic, data flow, and system design. You can open the .drawio.xml files in draw.io for further editing or customization.