A full-stack web application that provides personalized content or product recommendations based on user preferences. The backend is built with Django & Django REST Framework, the frontend with Vue.js & Tailwind CSS, and deployed using free-tier cloud services.
š Try the live application here: https://recengineapp.netlify.app/
Homepage:
Recommendations Page:
Follow these instructions to set up the project locally for development and testing.
Prerequisites:
Installation & Setup:
Clone the repository:
git clone https://github.com/Garbii1/recommendation-engine-project.git
cd recommendation-engine-project
Backend Setup (Django):
cd backend
python -m venv venv
# Linux/macOS:
source venv/bin/activate
# Windows (cmd/powershell):
.\venv\Scripts\activate
pip install -r requirements.txt
db.sqlite3
file by default):python manage.py migrate
python manage.py createsuperuser
DATABASE_URL
environment variable before running migrations/runserver, e.g., export DATABASE_URL='mysql://user:pass@host/dbname'
)Frontend Setup (Vue):
cd ../frontend
# Or just `cd frontend` if already in the root
npm install
.env
file in the frontend
directory:# frontend/.env
VUE_APP_API_URL=http://127.0.0.1:8000/api
(This tells the frontend dev server where the local backend API is)Running Locally:
Start the Backend Server:
backend
directory (with the virtualenv activated).python manage.py runserver
http://127.0.0.1:8000/api/
.Start the Frontend Development Server:
frontend
directory.npm run serve
http://localhost:8080
(or another port if 8080 is busy).Open http://localhost:8080
in your browser.
GET /api/categories/
: Retrieves a list of available item categories.{"categories": [{"value": "CategoryValue", "label": "CategoryLabel"}, ...]}
GET /api/items/
: Retrieves a list of all available items (optional endpoint).{"items": [{"id": ..., "name": ..., "description": ..., "category": ..., "image_url": ...}, ...]}
POST /api/recommendations/
: Submits user preferences and retrieves recommendations.{ "preferred_category": "CategoryName" }
{"recommendations": [ {item_object}, {item_object}, ... ]}
/var/www/yourusername_pythonanywhere_com_wsgi.py
).virtualenvwrapper
.DATABASE_URL
environment variable set in WSGI file.python manage.py collectstatic
and served via PythonAnywhere's static file mapping configuration (/static/
mapped to /home/Garbii/recommendation-engine-project/backend/staticfiles
).SECRET_KEY
, DATABASE_URL
, ALLOWED_HOSTS
, FRONTEND_URL
, DEBUG=False
) set directly in the WSGI file.frontend
base directory, npm run build
command, and frontend/dist
publish directory.VUE_APP_API_URL
set in Netlify UI pointing to the live PythonAnywhere API URL (https://garbii.pythonanywhere.com/api
).frontend/public/_redirects
file.psycopg2-binary
-> mysqlclient
) and updating DATABASE_URL
.os.environ
.manage.py
Commands (PythonAnywhere): Console commands like migrate
and createsuperuser
required prefixing with the DATABASE_URL
environment variable to connect to MySQL instead of the default SQLite.collectstatic
& Manifest): Encountered Missing staticfiles manifest entry
errors for the admin. This was resolved by ensuring collectstatic
ran correctly after all installations and configuration changes. A temporary workaround involved switching STATICFILES_STORAGE
to the non-manifest version (whitenoise.storage.CompressedStaticFilesStorage
), confirming the base setup worked, before ensuring the manifest version could run collectstatic
properly (by removing the staticfiles
dir and running collectstatic
clean). Ultimately, the non-manifest storage (CompressedStaticFilesStorage
) was used for stability.settings.py
using django-cors-headers
and reading FRONTEND_URL
from env var) and setting the FRONTEND_URL
in the PythonAnywhere WSGI file.import.meta.env
to Vue CLI's process.env
(prefixed with VUE_APP_
).User Authentication: Implement user registration and login (e.g., using Django Allauth).
Interaction History: Store user interactions (clicks, ratings, purchases) to improve recommendations.
Enhanced User Data Collection & Interaction Service:
POST /api/interactions/
) to securely collect detailed user behavior data:Interaction
, UserProfile
) to persistently store this interaction history.Integration Capabilities:
Advanced Algorithms: Implement more sophisticated recommendation techniques:
UI/UX Enhancements:
Testing: Add unit and integration tests for both backend and frontend.
Containerization: Dockerize the application for easier setup and deployment consistency.
Data Visualization & Dashboards:
User-Facing Visualization (Optional): Implement features explaining why an item was recommended (e.g., "Because you liked X", "Similar users also liked Y", "Based on your interest in Z category"). Could involve simple tags or more complex visualizations. * Utilize charting libraries (e.g., Chart.js, Plotly, D3.js on the frontend; Matplotlib/Seaborn on the backend for generating static charts/reports).