This project is a Book Recommendation App that provides personalized book suggestions. It is built using:
- Frontend: React Native (Expo)
- Backend: Flask with a MySQL database
- Database: MySQL, managed via SQLAlchemy ORM and Flask-Migrate
- Recommendation System: Machine Learning powered by Reinforcement Learning and Linear Contextual Bandits
The app allows users to browse, search, save, and interact with books, while using their interactions to generate personalized book recommendations.
- User Authentication: Registration and Login using JWT.
- Book Browsing: View available books with details such as title, author, description, and cover images.
- Search: Full-text search powered by Whoosh.
- Interactions: Users can like, save, and view books. These interactions are stored to personalize recommendations.
- Recommendations:
- Content-Based Filtering: Uses embeddings and cosine similarity to recommend books based on user preferences.
- Reinforcement Learning & Contextual Bandits: A machine learning model powered by Linear Contextual Bandits that uses user interactions to learn preferences and deliver contextual recommendations in real-time.
-
Clone the repository:
git clone https://github.com/your-repo/book-app.git cd backend -
Create a virtual environment and install dependencies:
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt -
Set up environment variables by copying
.env.exampleto.env:cp .env.example .env
-
Set up the MySQL database (Ensure MySQL is installed and running):
mysql -u root -p CREATE DATABASE bookapp; -
Run database migrations:
flask db upgrade
-
Start the backend server:
flask run
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install
-
Start the Expo server:
npm start
-
Build and run the containers:
docker-compose up --build
-
The backend will be accessible at
http://localhost:5000.
The app's recommendation engine combines:
- Content-based filtering: Books are recommended based on similarity with previously saved books, using embeddings.
- Reinforcement Learning: Contextual Bandits techniques like Linear Contextual Bandits learn from user interactions such as likes, saves, and views to provide recommendations that adapt to the user's preferences over time.
The app is deployed on AWS EC2. The backend runs inside a Docker container and communicates with an RDS MySQL database. Environment variables are managed via .env files and AWS Secrets Manager.
- Fork the repository.
- Create a new branch for your feature:
git checkout -b feature-name. - Commit your changes and open a pull request.
This project is licensed under the MIT License.