You love reading and want to inspire others to enjoy it too.
Solving this problem, We're creating a system that does two main things:
-
Submit Reading API: Users can tell the system the pages they read in a book. They can do this multiple times for the same book. Example Request:
{ "user_id": "111", "book_id": "1", "start_page": 2, "end_page": 12 }
-
Top 5 Recommended Books API: The system figures out and tells everyone the top five books based on how many unique pages people have read. Example Response:
[ { "book_id": "5", "book_name": "Clean Code", "num_of_read_pages": 100 }, { "book_id": "1", "book_name": "Harry Potter", "num_of_read_pages": 90 }, { "book_id": "10", "book_name": "The Kite Runner", "num_of_read_pages": 20 } ]
https://book-reads.onrender.com/api-docs
Submit Reading API:
- Users share the pages they read in a book.
- Multiple shares are allowed for the same book.
Top 5 Recommended Books API:
- Recommends the top five books based on the total pages read by everyone.
- The list is from most to least read pages.
Thank You SMS:
- Sends a "Thank You" SMS to the user after they share their reading.
For SMS, there are two options:
- Submit reading intervals for users and books.
- Get book recommendations based on reading statistics.
Make sure you have the following software installed:
- Clone the repository:
git clone https://github.com/AhmedMohammed3/book-recommendation-system.git
- Install dependencies:
cd book-recommendation-system
npm install
Update the configurations in the .env file or set environment variables as needed.
DB_USER=your_db_user
DB_PASS=your_db_password
DB_HOST=your_db_host
DB_NAME=your_db_name
PORT=your_server_port
USING_SMS_PROVIDER=the_required_sms_provider
SMS_PROVIDER_URL_1=sms_provider_1_url
SMS_PROVIDER_URL_2=sms_provider_2_url
To seed the database with initial data, run the following command:
npm run seed
To run tests, execute the following command:
npm test
This command will use Mocha to run tests located in the ./test directory. Chai is used for assertions, and Sinon is used for spies, stubs, and mocks.
The API documentation is available using Swagger UI.
Visit https://book-reads.onrender.com/api-docs to explore the API endpoints.
Start the server using the following command:
npm start
The server will run at http://localhost:your_server_port
- Open your terminal and clone the repository
git clone https://github.com/AhmedMohammed3/book-recommendation-system.git
- Create your branch
git checkout -b {YOUR_BRANCH_NAME}
- run
npm run seed
for seeding the database - run
npm run dev
to start the development server (It's automatically building and restarting). - Make your edits and review it well.
- Commit your changes with appropriate message. Follow these git style guides
git commit -m {YOUR_COMMIT_MSG}
- Push your changes
git push origin {YOUR_BRANCH_NAME}
- Create a pull request